diff --git a/autorest/codegen/__init__.py b/autorest/codegen/__init__.py index 26ddbd6fd72..7a7a2d1beb9 100644 --- a/autorest/codegen/__init__.py +++ b/autorest/codegen/__init__.py @@ -76,6 +76,21 @@ def _validate_code_model_options(options: Dict[str, Any]) -> None: "If you want operation files, pass in flag --show-operations" ) + if options["package_mode"] == 'dataplane' and \ + not all([options["package_name"], options["client_name"], options["credential_scopes"], + options["package_pprint_name"], options["output_folder"], options["input_file"]]): + raise ValueError( + "--package-name, --title, --package-pprint-name, --credential-scopes, --output-folder" + " --input-file are necessary" + ) + + if options["package_mode"] == 'dataplane' and options["azure_arm"]: + raise ValueError( + "--package_mode=dataplane and --azure-arm can not be used at the same time" + ) + + + _LOGGER = logging.getLogger(__name__) class CodeGenerator(Plugin): @staticmethod @@ -134,7 +149,10 @@ def _create_code_model(self, yaml_data: Dict[str, Any], options: Dict[str, Union code_model.setup_client_input_parameters(yaml_data) # Get my namespace - namespace = self._autorestapi.get_value("namespace") + if not code_model.options.get("package_mode"): + namespace = self._autorestapi.get_value("namespace") + else: + namespace = code_model.options.get("namespace") _LOGGER.debug("Namespace parameter was %s", namespace) if not namespace: namespace = yaml_data["info"]["python_title"] @@ -289,6 +307,12 @@ def _build_code_model_options(self) -> Dict[str, Any]: "low_level_client": low_level_client, "combine_operation_files": self._autorestapi.get_boolean_value("combine-operation-files", version_tolerant), "python3_only": python3_only, + "package_mode": self._autorestapi.get_value("package-mode"), + "client_name": self._autorestapi.get_value("title"), + "credential_scopes": self._autorestapi.get_value("credential-scopes"), + "package_pprint_name": self._autorestapi.get_value("package-pprint-name"), + "output_folder": self._autorestapi.get_value("output-folder"), + "input_file": self._autorestapi.get_value("input-file"), } if options["builders_visibility"] is None: @@ -306,8 +330,16 @@ def _build_code_model_options(self) -> Dict[str, Any]: if azure_arm: options["credential"] = True options["head_as_boolean"] = True + + if options["package_mode"] == 'dataplane': + options["namespace"] = self._autorestapi.get_value("namespace") or options["package_name"].replace("-", '.') + options["credential"] = True + options["basic_setup_py"] = True + options["package_version"] = options["package_version"] if options["package_version"] else "1.0.0b1" + return options + def process(self) -> bool: # List the input file, should be only one inputs = self._autorestapi.list_inputs() diff --git a/autorest/codegen/serializers/__init__.py b/autorest/codegen/serializers/__init__.py index eda1ea1f881..9039d2617b5 100644 --- a/autorest/codegen/serializers/__init__.py +++ b/autorest/codegen/serializers/__init__.py @@ -5,6 +5,7 @@ # -------------------------------------------------------------------------- from typing import List, Optional from pathlib import Path +import time from jinja2 import PackageLoader, Environment from autorest.codegen.models.operation_group import OperationGroup @@ -29,6 +30,10 @@ "JinjaSerializer", ] +def _get_environment(template_path: str) -> Environment: + return Environment(loader=PackageLoader("autorest.codegen", template_path)) + + class JinjaSerializer: def __init__(self, autorestapi: AutorestAPI) -> None: self._autorestapi = autorestapi @@ -72,6 +77,27 @@ def serialize(self, code_model: CodeModel) -> None: self._serialize_and_write_models_folder(code_model=code_model, env=env, namespace_path=namespace_path) + if code_model.options["package_mode"] == 'dataplane': + self._serialize_and_write_package_folder( + namespace_path=Path("."), + template_path="templates/templates_package_dataplane", + code_model=code_model + ) + + + def _serialize_and_write_package_folder( + self, namespace_path: Path, template_path: str, code_model: CodeModel + ) -> None: + env = _get_environment(template_path) + for template_name in env.list_templates(): + release_time = time.strftime('%Y-%m-%d', time.localtime()) + sdk_folder = Path(code_model.options['output_folder']).parts[-2] + template = env.get_template(template_name) + result = template.render(code_model=code_model, release_time=release_time, sdk_folder=sdk_folder) + output_name = template_name.replace(".jinja2", "") + self._autorestapi.write_file(namespace_path / output_name, result) + + def _keep_patch_file(self, path_file: Path, env: Environment): if self._autorestapi.read_file(path_file): diff --git a/autorest/codegen/templates/templates_package_dataplane/CHANGELOG.md.jinja2 b/autorest/codegen/templates/templates_package_dataplane/CHANGELOG.md.jinja2 new file mode 100644 index 00000000000..b642ba8825d --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/CHANGELOG.md.jinja2 @@ -0,0 +1,6 @@ +# Release History + +## 1.0.0b1 ({{ release_time }}) + +- Initial version + diff --git a/autorest/codegen/templates/templates_package_dataplane/LICENSE.jinja2 b/autorest/codegen/templates/templates_package_dataplane/LICENSE.jinja2 new file mode 100644 index 00000000000..b2f52a2bad4 --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/LICENSE.jinja2 @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/autorest/codegen/templates/templates_package_dataplane/MANIFEST.in.jinja2 b/autorest/codegen/templates/templates_package_dataplane/MANIFEST.in.jinja2 new file mode 100644 index 00000000000..2895bc6f9c1 --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/MANIFEST.in.jinja2 @@ -0,0 +1,8 @@ +{% set folder_first = code_model.options['package_name'].split('-')[0] -%} +{% set folder_second = code_model.options['package_name'].split('-')[1] -%} +include *.md +include {{ folder_first }}/__init__.py +include {{ folder_first }}/{{ folder_second }}/__init__.py +include LICENSE +recursive-include tests *.py +recursive-include samples *.py *.md \ No newline at end of file diff --git a/autorest/codegen/templates/templates_package_dataplane/README.md.jinja2 b/autorest/codegen/templates/templates_package_dataplane/README.md.jinja2 new file mode 100644 index 00000000000..6faf7fdfc6d --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/README.md.jinja2 @@ -0,0 +1,91 @@ +{% set package_pprint_name = code_model.options['package_pprint_name'] -%} +{% set package_name = code_model.options['package_name'] -%} +{% set namespace = code_model.options['namespace'] -%} +{% set client_name = code_model.options['client_name'] -%} +# {{ package_pprint_name }} client library for Python + + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, +please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +## Getting started + +### Installating the package + +```bash +python -m pip install {{ package_name }} +``` + +#### Prequisites + +- Python 3.7+ is required to use this package. +- You need an [Azure subscription][azure_sub] to use this package. +- An existing {{ package_pprint_name }} instance. + +#### Create with an Azure Active Directory Credential +To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], +provide an instance of the desired credential type obtained from the +[azure-identity][azure_identity_credentials] library. + +To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] + +After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. +As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client: + +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: +`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` + +Use the returned token credential to authenticate the client: + +```python +>>> from {{ namespace }} import {{ client_name }} +>>> from azure.identity import DefaultAzureCredential +>>> client = {{ client_name }}(endpoint='', credential=DefaultAzureCredential()) +``` + +## Examples + +```python +>>> from {{ namespace }} import {{ client_name }} +>>> from azure.identity import DefaultAzureCredential +>>> from azure.core.exceptions import HttpResponseError + +>>> client = {{ client_name }}(endpoint='', credential=DefaultAzureCredential()) +>>> try: + + except HttpResponseError as e: + print('service responds error: {}'.format(e.response.json())) + +``` + +## Next steps + +More examples are coming soon... + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, +see the Code of Conduct FAQ or contact opencode@microsoft.com with any +additional questions or comments. + + +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials +[azure_identity_pip]: https://pypi.org/project/azure-identity/ +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential +[pip]: https://pypi.org/project/pip/ +[azure_sub]: https://azure.microsoft.com/free/ diff --git a/autorest/codegen/templates/templates_package_dataplane/dev_requirements.txt.jinja2 b/autorest/codegen/templates/templates_package_dataplane/dev_requirements.txt.jinja2 new file mode 100644 index 00000000000..8d3c7d8e114 --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/dev_requirements.txt.jinja2 @@ -0,0 +1,7 @@ +-e ../../../tools/azure-devtools +-e ../../../tools/azure-sdk-tools +../../core/azure-core +../../identity/azure-identity +aiohttp>=3.0 +typing_extensions>=3.7.2 +asyncio diff --git a/autorest/codegen/templates/templates_package_dataplane/samples/sample.py.jinja2 b/autorest/codegen/templates/templates_package_dataplane/samples/sample.py.jinja2 new file mode 100644 index 00000000000..aeb0eb8c90f --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/samples/sample.py.jinja2 @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import logging +import os + +{%- set namespace = code_model.options['namespace'] %} +{%- set client_name = code_model.options['client_name'] %} +{%- set test_prefix = code_model.options['package_name'].split('-')[-1].upper %} +from {{ namespace }} import {{ client_name }} +from azure.identity import DefaultAzureCredential +from azure.core.exceptions import HttpResponseError + +logging.basicConfig(level=logging.DEBUG) +LOG = logging.getLogger() + +# Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: +# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET, {{ test_prefix }}_ENDPOINT +try: + endpoint = os.environ["{{ test_prefix }}_ENDPOINT"] +except KeyError: + LOG.error("Missing environment variable '{{ test_prefix }}_ENDPOINT' - please set if before running the example") + exit() + +# Build a client through AAD +client = {{ client_name }}(credential=DefaultAzureCredential(), endpoint=endpoint) + +# write your sample here. For example: +# try: +# result = client.xxx.xx(...) +# print(result) +# except HttpResponseError as e: +# print('Failed to send JSON message: {}'.format(e.response.json())) diff --git a/autorest/codegen/templates/templates_package_dataplane/sdk_packaging.toml.jinja2 b/autorest/codegen/templates/templates_package_dataplane/sdk_packaging.toml.jinja2 new file mode 100644 index 00000000000..3cec4a678d0 --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/sdk_packaging.toml.jinja2 @@ -0,0 +1,8 @@ +{% set package_name = code_model.options['package_name'] -%} +{% set package_pprint_name = code_model.options['package_pprint_name'] -%} +[packaging] +package_name = "{{ package_name }}" +package_pprint_name = "{{ package_pprint_name }}" +package_doc_id = "" +is_stable = false +is_arm = false \ No newline at end of file diff --git a/autorest/codegen/templates/templates_package_dataplane/setup.py.jinja2 b/autorest/codegen/templates/templates_package_dataplane/setup.py.jinja2 new file mode 100644 index 00000000000..971cba69c82 --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/setup.py.jinja2 @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +{% set package_name = code_model.options['package_name'] -%} +{% set package_pprint_name = code_model.options['package_pprint_name'] -%} +{% set folder_second = code_model.options['package_name'].split('-')[1] -%} +import os +import re +from setuptools import setup, find_packages + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "{{ package_name }}" +PACKAGE_PPRINT_NAME = "{{ package_pprint_name }}" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search( + r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE + ).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft {{ package_pprint_name }} Client Library for Python", + long_description=open("README.md", "r").read(), + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/{{ sdk_folder }}/{{ package_name }}", + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.{{ folder_second }}", + ] + ), + install_requires=[ + "azure-core<2.0.0,>=1.20.1", + "msrest>=0.6.21", + 'six>=1.11.0', + ], + python_requires=">=3.6", +) diff --git a/autorest/codegen/templates/templates_package_dataplane/swagger/README.md.jinja2 b/autorest/codegen/templates/templates_package_dataplane/swagger/README.md.jinja2 new file mode 100644 index 00000000000..eca1036ad6e --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/swagger/README.md.jinja2 @@ -0,0 +1,20 @@ +### Settings + +```yaml +input-file: +{% for file in code_model.options['input_file'] -%} +- {{ file }} +{% endfor -%} +output-folder: {{ '../' + code_model.options["package_name"].replace('-', '/') }} +namespace: {{ code_model.options['namespace'] }} +package-name: {{ code_model.options['package_name'] }} +license-header: MICROSOFT_MIT_NO_VERSION +clear-output-folder: true +no-namespace-folders: true +python: true +title: {{ code_model.options['client_name'] }} +version-tolerant: true +package-version: {{ code_model.options['package_version'] }} +add-credential: true +credential-scopes: {{ code_model.options['credential_scopes'] }} +``` diff --git a/autorest/codegen/templates/templates_package_dataplane/tests/test_smoke.py.jinja2 b/autorest/codegen/templates/templates_package_dataplane/tests/test_smoke.py.jinja2 new file mode 100644 index 00000000000..049910b66db --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/tests/test_smoke.py.jinja2 @@ -0,0 +1,18 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +{% set test_prefix = code_model.options['package_name'].split('-')[-1] -%} +from testcase import {{ test_prefix.capitalize() }}Test, {{ test_prefix.capitalize() }}PowerShellPreparer + + +class {{ test_prefix.capitalize() }}SmokeTest({{ test_prefix.capitalize() }}Test): + + @{{ test_prefix.capitalize() }}PowerShellPreparer() + def test_smoke(self, {{ test_prefix }}_endpoint): + client = self.create_client(endpoint={{ test_prefix }}_endpoint) + # test your code here, for example: + # result = client.xxx.xx(...) + # assert result is not None diff --git a/autorest/codegen/templates/templates_package_dataplane/tests/test_smoke_async.py.jinja2 b/autorest/codegen/templates/templates_package_dataplane/tests/test_smoke_async.py.jinja2 new file mode 100644 index 00000000000..3070f053f8b --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/tests/test_smoke_async.py.jinja2 @@ -0,0 +1,19 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +{% set test_prefix = code_model.options['package_name'].split('-')[-1] -%} +from testcase import {{ test_prefix.capitalize() }}PowerShellPreparer +from testcase_async import {{ test_prefix.capitalize() }}AsyncTest + + +class {{ test_prefix.capitalize() }}SmokeAsyncTest({{ test_prefix.capitalize() }}AsyncTest): + + @{{ test_prefix.capitalize() }}PowerShellPreparer() + async def test_smoke_async(self, {{ test_prefix }}_endpoint): + client = self.create_client(endpoint={{ test_prefix }}_endpoint) + # test your code here, for example: + # result = await client.xxx.xx(...) + # assert result is not None diff --git a/autorest/codegen/templates/templates_package_dataplane/tests/testcase.py.jinja2 b/autorest/codegen/templates/templates_package_dataplane/tests/testcase.py.jinja2 new file mode 100644 index 00000000000..cb26b601f36 --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/tests/testcase.py.jinja2 @@ -0,0 +1,32 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +{% set namespace = code_model.options['namespace'] -%} +{% set client_name = code_model.options['client_name'] -%} +{% set test_prefix = code_model.options['package_name'].split('-')[-1] -%} +import functools +from devtools_testutils import AzureTestCase, PowerShellPreparer +from {{ namespace }} import {{ client_name }} + + +class {{ test_prefix.capitalize() }}Test(AzureTestCase): + def __init__(self, method_name, **kwargs): + super({{ test_prefix.capitalize() }}Test, self).__init__(method_name, **kwargs) + + def create_client(self, endpoint): + credential = self.get_credential({{ client_name }}) + return self.create_client_from_credential( + {{ client_name }}, + credential=credential, + endpoint=endpoint, + ) + + +{{ test_prefix.capitalize() }}PowerShellPreparer = functools.partial( + PowerShellPreparer, + "{{ test_prefix }}", + {{ test_prefix }}_endpoint="https://myservice.azure.com" +) diff --git a/autorest/codegen/templates/templates_package_dataplane/tests/testcase_async.py.jinja2 b/autorest/codegen/templates/templates_package_dataplane/tests/testcase_async.py.jinja2 new file mode 100644 index 00000000000..deb03459684 --- /dev/null +++ b/autorest/codegen/templates/templates_package_dataplane/tests/testcase_async.py.jinja2 @@ -0,0 +1,24 @@ +# coding: utf-8 +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +{% set namespace = code_model.options['namespace'] -%} +{% set client_name = code_model.options['client_name'] -%} +{% set test_prefix = code_model.options['package_name'].split('-')[-1] -%} +from devtools_testutils import AzureTestCase +from {{ namespace }}.aio import {{ client_name}} + + +class {{ test_prefix.capitalize() }}AsyncTest(AzureTestCase): + def __init__(self, method_name, **kwargs): + super({{ test_prefix.capitalize() }}AsyncTest, self).__init__(method_name, **kwargs) + + def create_client(self, endpoint): + credential = self.get_credential({{ client_name}}, is_async=True) + return self.create_client_from_credential( + {{ client_name}}, + credential=credential, + endpoint=endpoint, + ) diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py index f713bf7049d..5acb3311102 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py @@ -17,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py index 0c078e3bc0a..93e8ddb5991 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py @@ -20,7 +20,7 @@ from azure.core.credentials import AzureKeyCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_auto_rest_head_test_service.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_auto_rest_head_test_service.py index 2f7e5641698..e9bd56903bd 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_auto_rest_head_test_service.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_auto_rest_head_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_configuration.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_configuration.py index a083186545b..24eb69f4096 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_configuration.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_configuration.py @@ -15,7 +15,7 @@ from .._version import VERSION -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_http_success_operations.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_http_success_operations.py index 0e3f3f07c62..8f242475fd9 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_http_success_operations.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -63,7 +62,11 @@ async def head200( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -101,7 +104,11 @@ async def head204( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -139,7 +146,11 @@ async def head404( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py index d439759101d..110aa76ffe3 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -20,7 +19,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +113,11 @@ def head200( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -153,7 +156,11 @@ def head204( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -192,7 +199,11 @@ def head404( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py b/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py index 4177fead376..1442ace7def 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py @@ -17,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.rest import HttpRequest, HttpResponse diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py b/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py index 5bcc364b7cd..177e17de72f 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/aio/_auto_rest_head_test_service.py b/docs/samples/specification/basic/generated/azure/basic/sample/aio/_auto_rest_head_test_service.py index fdea0675c1c..5a36b5e9d47 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/aio/_auto_rest_head_test_service.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/aio/_auto_rest_head_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/aio/_configuration.py b/docs/samples/specification/basic/generated/azure/basic/sample/aio/_configuration.py index 7e46511ac0b..2d2f08e863a 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/aio/_configuration.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/aio/operations/_http_success_operations.py b/docs/samples/specification/basic/generated/azure/basic/sample/aio/operations/_http_success_operations.py index 0e3f3f07c62..8f242475fd9 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/aio/operations/_http_success_operations.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/aio/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -63,7 +62,11 @@ async def head200( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -101,7 +104,11 @@ async def head204( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -139,7 +146,11 @@ async def head404( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py b/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py index d439759101d..110aa76ffe3 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -20,7 +19,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +113,11 @@ def head200( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -153,7 +156,11 @@ def head204( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -192,7 +199,11 @@ def head404( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py b/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py index 54d68458231..ba6eb9dc80f 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class PollingPagingExampleConfiguration(Configuration): +class PollingPagingExampleConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for PollingPagingExample. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py b/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py index e9f089c23b4..21f2c3d13eb 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/aio/_configuration.py b/docs/samples/specification/directives/generated/azure/directives/sample/aio/_configuration.py index f48b2dc0827..61a30b50d65 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/aio/_configuration.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class PollingPagingExampleConfiguration(Configuration): +class PollingPagingExampleConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for PollingPagingExample. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/aio/_polling_paging_example.py b/docs/samples/specification/directives/generated/azure/directives/sample/aio/_polling_paging_example.py index 63a4d9e626d..59164814b3d 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/aio/_polling_paging_example.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/aio/_polling_paging_example.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py b/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py index 069e374924b..206af0b29e0 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -53,7 +52,11 @@ async def _basic_polling_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -96,7 +99,7 @@ async def begin_basic_polling( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -130,8 +133,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncCustomPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncCustomPoller(self._client, raw_result, get_long_running_output, polling_method) begin_basic_polling.metadata = {'url': '/basic/polling'} # type: ignore @@ -181,7 +183,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py b/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py index e66accd9423..22762872465 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -23,7 +22,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +103,11 @@ def _basic_polling_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -147,7 +150,7 @@ def begin_basic_polling( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -181,8 +184,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return CustomPoller(self._client, raw_result, get_long_running_output, polling_method) + return CustomPoller(self._client, raw_result, get_long_running_output, polling_method) begin_basic_polling.metadata = {'url': '/basic/polling'} # type: ignore @@ -233,7 +235,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py b/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py index 1b5177a2631..86d0611545f 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py @@ -17,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py b/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py index 705b8163edb..db4eeeafa5a 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py b/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py index a9661ead7c9..5d77e42627b 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_configuration.py b/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_configuration.py index 666f4a20d94..2b2707fd554 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_configuration.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py b/docs/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py index 3de2b6afda7..614687053ae 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -64,7 +63,11 @@ async def head200( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -103,7 +106,11 @@ async def head204( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -142,7 +149,11 @@ async def head404( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py b/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py index 6b1f352feb8..20ac9f413f2 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -115,7 +114,11 @@ def head200( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -155,7 +158,11 @@ def head204( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -195,7 +202,11 @@ def head404( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py index 059c153122f..3cd59d5a2b6 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py index 723516952c7..6612085aeef 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_configuration.py index f500f5b4ae9..91b58402d4b 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_multiapi_service_client.py index db9ea584bc7..21aa146c06c 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py index b825af6cd57..c0e06f6eba5 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -64,7 +63,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +107,11 @@ async def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -147,7 +154,7 @@ async def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -181,8 +188,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -213,7 +219,11 @@ async def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -308,7 +318,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -318,7 +332,7 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -338,8 +352,7 @@ def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return await get_next(next_link) + return await get_next(next_link) return AsyncItemPaged( internal_get_next, extract_data @@ -355,8 +368,7 @@ async def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -393,7 +405,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py index 3a321b8fde2..0e464be80e1 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -72,7 +71,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py index adc3f38146e..8c029f8c926 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -25,7 +24,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -187,7 +186,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,7 +231,11 @@ def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -271,7 +278,7 @@ def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,8 +312,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -338,7 +344,11 @@ def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,7 +444,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -444,7 +458,7 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -464,8 +478,7 @@ def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) return ItemPaged( internal_get_next, extract_data @@ -481,8 +494,7 @@ def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -520,7 +532,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py index 41e4a4abbba..92c032e0f22 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +107,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py index 61ff653fdf8..4654f164dee 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py index 509ad1b3541..12c93f62a94 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_configuration.py index 891fd33c477..bf6fc9dfc21 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_multiapi_service_client.py index 037f6a1f696..aa5485e3383 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py index 66198c36ac9..2ffc334eb1c 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -60,7 +59,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,7 +117,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py index 54f314c6f44..2a937989f62 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,7 +131,11 @@ async def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py index 1b75581e7d8..e403a5f2430 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,7 +75,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py index 44d62d0889e..690faa8c4ce 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +132,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,7 +191,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py index bcf91f04c76..f0868b0019f 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +147,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,7 +198,11 @@ def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py index 4348ec03f0c..b538d6eb530 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +113,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py index f249f39bc78..9714f36ee4a 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py index 7918c40f881..e335f2dd96b 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_configuration.py index 791da53e03b..74750a46bca 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_multiapi_service_client.py index efaa4973eb1..93b798c0b97 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py index 5c8091aac9b..d1d2fb329b5 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -72,7 +71,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,7 +130,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py index ba3586e11ab..53e084d678b 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py index 79ee4685ef4..e1290f4dd90 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -94,7 +93,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,7 +139,11 @@ async def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py index 1daa9d6d7db..1fea5bc2ef6 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -23,7 +22,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +134,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,7 +194,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py index 63f57d4ab65..db0b4afb127 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -121,7 +120,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py index 7650e1be197..76c46796345 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +159,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +206,11 @@ def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/__init__.py index 623e438eb9c..48ac23f1972 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py index 58cce5ae7e9..aec78df4db0 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestDurationTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_configuration.py index 8b18f16d3f2..73291612c7c 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestDurationTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/__init__.py index ecd1d021c33..2db0a55fdb1 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_duration_test_service import AutoRestDurationTestService - -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py index d870240475e..0e6c1e470e3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestDurationTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_configuration.py index f7cece514e6..5994e663a71 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/__init__.py index 807183c47fe..6bb953af616 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._duration_operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py index c5e046e5f25..8e509c3d630 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,17 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._duration_operations import ( - build_get_invalid_request, - build_get_null_request, - build_get_positive_duration_request, - build_put_positive_duration_request, -) - -T = TypeVar("T") +from ...operations._duration_operations import build_get_invalid_request, build_get_null_request, build_get_positive_duration_request, build_put_positive_duration_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DurationOperations: """DurationOperations async operations. @@ -58,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.timedelta]: """Get null duration value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -66,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,17 +80,22 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/duration/null"} # type: ignore + get_null.metadata = {'url': '/duration/null'} # type: ignore + @distributed_trace_async - async def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any) -> None: + async def put_positive_duration( + self, + duration_body: datetime.timedelta, + **kwargs: Any + ) -> None: """Put a positive duration value. :param duration_body: duration body. @@ -104,23 +105,29 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(duration_body, "duration") + _json = self._serialize.body(duration_body, 'duration') request = build_put_positive_duration_request( content_type=content_type, json=_json, - template_url=self.put_positive_duration.metadata["url"], + template_url=self.put_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,10 +138,14 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg if cls: return cls(pipeline_response, None, {}) - put_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + put_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace_async - async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: + async def get_positive_duration( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get a positive duration value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -142,17 +153,24 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_positive_duration_request( - template_url=self.get_positive_duration.metadata["url"], + template_url=self.get_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,17 +178,21 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + get_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get an invalid duration value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -178,17 +200,24 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -196,11 +225,12 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/duration/invalid"} # type: ignore + get_invalid.metadata = {'url': '/duration/invalid'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/__init__.py index 807183c47fe..6bb953af616 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/__init__.py @@ -9,5 +9,5 @@ from ._duration_operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py index e1dce8db854..187274c3a82 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -145,7 +137,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[datetime.timedelta] """Get null duration value. @@ -155,17 +148,24 @@ def get_null( :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,14 +173,15 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/duration/null"} # type: ignore + get_null.metadata = {'url': '/duration/null'} # type: ignore + @distributed_trace def put_positive_duration( @@ -198,23 +199,29 @@ def put_positive_duration( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(duration_body, "duration") + _json = self._serialize.body(duration_body, 'duration') request = build_put_positive_duration_request( content_type=content_type, json=_json, - template_url=self.put_positive_duration.metadata["url"], + template_url=self.put_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -225,11 +232,13 @@ def put_positive_duration( if cls: return cls(pipeline_response, None, {}) - put_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + put_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace def get_positive_duration( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.timedelta """Get a positive duration value. @@ -239,17 +248,24 @@ def get_positive_duration( :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_positive_duration_request( - template_url=self.get_positive_duration.metadata["url"], + template_url=self.get_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -257,18 +273,20 @@ def get_positive_duration( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + get_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.timedelta """Get an invalid duration value. @@ -278,17 +296,24 @@ def get_invalid( :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -296,11 +321,12 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/duration/invalid"} # type: ignore + get_invalid.metadata = {'url': '/duration/invalid'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py index 385afe6573c..05c0d98d9d2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/__init__.py index 56e647414e7..4b4eb6c2361 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterGroupingTestService"] +__all__ = ['AutoRestParameterGroupingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py index 9d0d7adca25..f254bbe149a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestParameterGroupingTestService(object): """Test Infrastructure for AutoRest. @@ -44,9 +43,8 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.parameter_grouping = ParameterGroupingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.parameter_grouping = ParameterGroupingOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_configuration.py index 2cf9f087e57..f5d990a79d3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestParameterGroupingTestServiceConfiguration(Configuration): +class AutoRestParameterGroupingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterGroupingTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestParameterGroupingTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestParameterGroupingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparametergroupingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparametergroupingtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/__init__.py index 925eefd8198..43644446d42 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameter_grouping_test_service import AutoRestParameterGroupingTestService - -__all__ = ["AutoRestParameterGroupingTestService"] +__all__ = ['AutoRestParameterGroupingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py index 9eeaa841dd5..f0b310b7a82 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestParameterGroupingTestServiceConfiguration from .operations import ParameterGroupingOperations - class AutoRestParameterGroupingTestService: """Test Infrastructure for AutoRest. @@ -27,18 +26,25 @@ class AutoRestParameterGroupingTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestParameterGroupingTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.parameter_grouping = ParameterGroupingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.parameter_grouping = ParameterGroupingOperations(self._client, self._config, self._serialize, self._deserialize) + - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_configuration.py index 41cfe947cb7..b29d04da057 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestParameterGroupingTestServiceConfiguration(Configuration): +class AutoRestParameterGroupingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterGroupingTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterGroupingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparametergroupingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparametergroupingtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/__init__.py index a0102ecb745..4477c024861 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._parameter_grouping_operations import ParameterGroupingOperations __all__ = [ - "ParameterGroupingOperations", + 'ParameterGroupingOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py index 75a117c2811..26b98c1dec0 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,18 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._parameter_grouping_operations import ( - build_post_multi_param_groups_request, - build_post_optional_request, - build_post_required_request, - build_post_reserved_words_request, - build_post_shared_parameter_group_object_request, -) - -T = TypeVar("T") +from ...operations._parameter_grouping_operations import build_post_multi_param_groups_request, build_post_optional_request, build_post_required_request, build_post_reserved_words_request, build_post_shared_parameter_group_object_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ParameterGroupingOperations: """ParameterGroupingOperations async operations. @@ -73,11 +58,13 @@ async def post_required( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _custom_header = None _query = None @@ -88,7 +75,7 @@ async def post_required( _query = parameter_grouping_post_required_parameters.query _path = parameter_grouping_post_required_parameters.path _body = parameter_grouping_post_required_parameters.body - _json = self._serialize.body(_body, "int") + _json = self._serialize.body(_body, 'int') request = build_post_required_request( path=_path, @@ -96,12 +83,16 @@ async def post_required( json=_json, custom_header=_custom_header, query=_query, - template_url=self.post_required.metadata["url"], + template_url=self.post_required.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,7 +103,8 @@ async def post_required( if cls: return cls(pipeline_response, None, {}) - post_required.metadata = {"url": "/parameterGrouping/postRequired/{path}"} # type: ignore + post_required.metadata = {'url': '/parameterGrouping/postRequired/{path}'} # type: ignore + @distributed_trace_async async def post_optional( @@ -130,9 +122,11 @@ async def post_optional( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _custom_header = None _query = None @@ -143,12 +137,16 @@ async def post_optional( request = build_post_optional_request( custom_header=_custom_header, query=_query, - template_url=self.post_optional.metadata["url"], + template_url=self.post_optional.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,14 +157,13 @@ async def post_optional( if cls: return cls(pipeline_response, None, {}) - post_optional.metadata = {"url": "/parameterGrouping/postOptional"} # type: ignore + post_optional.metadata = {'url': '/parameterGrouping/postOptional'} # type: ignore + @distributed_trace_async async def post_reserved_words( self, - parameter_grouping_post_reserved_words_parameters: Optional[ - "_models.ParameterGroupingPostReservedWordsParameters" - ] = None, + parameter_grouping_post_reserved_words_parameters: Optional["_models.ParameterGroupingPostReservedWordsParameters"] = None, **kwargs: Any ) -> None: """Post a grouped parameters with reserved words. @@ -179,9 +176,11 @@ async def post_reserved_words( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _from_parameter = None _accept_parameter = None @@ -192,12 +191,16 @@ async def post_reserved_words( request = build_post_reserved_words_request( from_parameter=_from_parameter, accept_parameter=_accept_parameter, - template_url=self.post_reserved_words.metadata["url"], + template_url=self.post_reserved_words.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -208,15 +211,14 @@ async def post_reserved_words( if cls: return cls(pipeline_response, None, {}) - post_reserved_words.metadata = {"url": "/parameterGrouping/postReservedWords"} # type: ignore + post_reserved_words.metadata = {'url': '/parameterGrouping/postReservedWords'} # type: ignore + @distributed_trace_async async def post_multi_param_groups( self, first_parameter_group: Optional["_models.FirstParameterGroup"] = None, - parameter_grouping_post_multi_param_groups_second_param_group: Optional[ - "_models.ParameterGroupingPostMultiParamGroupsSecondParamGroup" - ] = None, + parameter_grouping_post_multi_param_groups_second_param_group: Optional["_models.ParameterGroupingPostMultiParamGroupsSecondParamGroup"] = None, **kwargs: Any ) -> None: """Post parameters from multiple different parameter groups. @@ -231,9 +233,11 @@ async def post_multi_param_groups( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _header_one = None _query_one = None @@ -251,12 +255,16 @@ async def post_multi_param_groups( query_one=_query_one, header_two=_header_two, query_two=_query_two, - template_url=self.post_multi_param_groups.metadata["url"], + template_url=self.post_multi_param_groups.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,11 +275,14 @@ async def post_multi_param_groups( if cls: return cls(pipeline_response, None, {}) - post_multi_param_groups.metadata = {"url": "/parameterGrouping/postMultipleParameterGroups"} # type: ignore + post_multi_param_groups.metadata = {'url': '/parameterGrouping/postMultipleParameterGroups'} # type: ignore + @distributed_trace_async async def post_shared_parameter_group_object( - self, first_parameter_group: Optional["_models.FirstParameterGroup"] = None, **kwargs: Any + self, + first_parameter_group: Optional["_models.FirstParameterGroup"] = None, + **kwargs: Any ) -> None: """Post parameters with a shared parameter group object. @@ -282,9 +293,11 @@ async def post_shared_parameter_group_object( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _header_one = None _query_one = None @@ -295,12 +308,16 @@ async def post_shared_parameter_group_object( request = build_post_shared_parameter_group_object_request( header_one=_header_one, query_one=_query_one, - template_url=self.post_shared_parameter_group_object.metadata["url"], + template_url=self.post_shared_parameter_group_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -311,4 +328,5 @@ async def post_shared_parameter_group_object( if cls: return cls(pipeline_response, None, {}) - post_shared_parameter_group_object.metadata = {"url": "/parameterGrouping/sharedParameterGroupObject"} # type: ignore + post_shared_parameter_group_object.metadata = {'url': '/parameterGrouping/sharedParameterGroupObject'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py index b334a961465..ab7afa5fc96 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py @@ -22,10 +22,10 @@ from ._models import ParameterGroupingPostReservedWordsParameters # type: ignore __all__ = [ - "Error", - "FirstParameterGroup", - "ParameterGroupingPostMultiParamGroupsSecondParamGroup", - "ParameterGroupingPostOptionalParameters", - "ParameterGroupingPostRequiredParameters", - "ParameterGroupingPostReservedWordsParameters", + 'Error', + 'FirstParameterGroup', + 'ParameterGroupingPostMultiParamGroupsSecondParamGroup', + 'ParameterGroupingPostOptionalParameters', + 'ParameterGroupingPostRequiredParameters', + 'ParameterGroupingPostReservedWordsParameters', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models.py index ba3f01f6d63..3961cf8f654 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class FirstParameterGroup(msrest.serialization.Model): @@ -46,11 +49,14 @@ class FirstParameterGroup(msrest.serialization.Model): """ _attribute_map = { - "header_one": {"key": "header-one", "type": "str"}, - "query_one": {"key": "query-one", "type": "int"}, + 'header_one': {'key': 'header-one', 'type': 'str'}, + 'query_one': {'key': 'query-one', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword header_one: :paramtype header_one: str @@ -58,8 +64,8 @@ def __init__(self, **kwargs): :paramtype query_one: int """ super(FirstParameterGroup, self).__init__(**kwargs) - self.header_one = kwargs.get("header_one", None) - self.query_one = kwargs.get("query_one", 30) + self.header_one = kwargs.get('header_one', None) + self.query_one = kwargs.get('query_one', 30) class ParameterGroupingPostMultiParamGroupsSecondParamGroup(msrest.serialization.Model): @@ -72,11 +78,14 @@ class ParameterGroupingPostMultiParamGroupsSecondParamGroup(msrest.serialization """ _attribute_map = { - "header_two": {"key": "header-two", "type": "str"}, - "query_two": {"key": "query-two", "type": "int"}, + 'header_two': {'key': 'header-two', 'type': 'str'}, + 'query_two': {'key': 'query-two', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword header_two: :paramtype header_two: str @@ -84,8 +93,8 @@ def __init__(self, **kwargs): :paramtype query_two: int """ super(ParameterGroupingPostMultiParamGroupsSecondParamGroup, self).__init__(**kwargs) - self.header_two = kwargs.get("header_two", None) - self.query_two = kwargs.get("query_two", 30) + self.header_two = kwargs.get('header_two', None) + self.query_two = kwargs.get('query_two', 30) class ParameterGroupingPostOptionalParameters(msrest.serialization.Model): @@ -98,11 +107,14 @@ class ParameterGroupingPostOptionalParameters(msrest.serialization.Model): """ _attribute_map = { - "custom_header": {"key": "customHeader", "type": "str"}, - "query": {"key": "query", "type": "int"}, + 'custom_header': {'key': 'customHeader', 'type': 'str'}, + 'query': {'key': 'query', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword custom_header: :paramtype custom_header: str @@ -110,8 +122,8 @@ def __init__(self, **kwargs): :paramtype query: int """ super(ParameterGroupingPostOptionalParameters, self).__init__(**kwargs) - self.custom_header = kwargs.get("custom_header", None) - self.query = kwargs.get("query", 30) + self.custom_header = kwargs.get('custom_header', None) + self.query = kwargs.get('query', 30) class ParameterGroupingPostRequiredParameters(msrest.serialization.Model): @@ -130,18 +142,21 @@ class ParameterGroupingPostRequiredParameters(msrest.serialization.Model): """ _validation = { - "path": {"required": True}, - "body": {"required": True}, + 'path': {'required': True}, + 'body': {'required': True}, } _attribute_map = { - "custom_header": {"key": "customHeader", "type": "str"}, - "query": {"key": "query", "type": "int"}, - "path": {"key": "path", "type": "str"}, - "body": {"key": "body", "type": "int"}, + 'custom_header': {'key': 'customHeader', 'type': 'str'}, + 'query': {'key': 'query', 'type': 'int'}, + 'path': {'key': 'path', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword custom_header: :paramtype custom_header: str @@ -153,10 +168,10 @@ def __init__(self, **kwargs): :paramtype body: int """ super(ParameterGroupingPostRequiredParameters, self).__init__(**kwargs) - self.custom_header = kwargs.get("custom_header", None) - self.query = kwargs.get("query", 30) - self.path = kwargs["path"] - self.body = kwargs["body"] + self.custom_header = kwargs.get('custom_header', None) + self.query = kwargs.get('query', 30) + self.path = kwargs['path'] + self.body = kwargs['body'] class ParameterGroupingPostReservedWordsParameters(msrest.serialization.Model): @@ -169,11 +184,14 @@ class ParameterGroupingPostReservedWordsParameters(msrest.serialization.Model): """ _attribute_map = { - "from_property": {"key": "from", "type": "str"}, - "accept": {"key": "accept", "type": "str"}, + 'from_property': {'key': 'from', 'type': 'str'}, + 'accept': {'key': 'accept', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword from_property: 'from' is a reserved word. Pass in 'bob' to pass. :paramtype from_property: str @@ -181,5 +199,5 @@ def __init__(self, **kwargs): :paramtype accept: str """ super(ParameterGroupingPostReservedWordsParameters, self).__init__(**kwargs) - self.from_property = kwargs.get("from_property", None) - self.accept = kwargs.get("accept", None) + self.from_property = kwargs.get('from_property', None) + self.accept = kwargs.get('accept', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models_py3.py index a72df800359..8b96d8ae151 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -48,11 +54,17 @@ class FirstParameterGroup(msrest.serialization.Model): """ _attribute_map = { - "header_one": {"key": "header-one", "type": "str"}, - "query_one": {"key": "query-one", "type": "int"}, + 'header_one': {'key': 'header-one', 'type': 'str'}, + 'query_one': {'key': 'query-one', 'type': 'int'}, } - def __init__(self, *, header_one: Optional[str] = None, query_one: Optional[int] = 30, **kwargs): + def __init__( + self, + *, + header_one: Optional[str] = None, + query_one: Optional[int] = 30, + **kwargs + ): """ :keyword header_one: :paramtype header_one: str @@ -74,11 +86,17 @@ class ParameterGroupingPostMultiParamGroupsSecondParamGroup(msrest.serialization """ _attribute_map = { - "header_two": {"key": "header-two", "type": "str"}, - "query_two": {"key": "query-two", "type": "int"}, + 'header_two': {'key': 'header-two', 'type': 'str'}, + 'query_two': {'key': 'query-two', 'type': 'int'}, } - def __init__(self, *, header_two: Optional[str] = None, query_two: Optional[int] = 30, **kwargs): + def __init__( + self, + *, + header_two: Optional[str] = None, + query_two: Optional[int] = 30, + **kwargs + ): """ :keyword header_two: :paramtype header_two: str @@ -100,11 +118,17 @@ class ParameterGroupingPostOptionalParameters(msrest.serialization.Model): """ _attribute_map = { - "custom_header": {"key": "customHeader", "type": "str"}, - "query": {"key": "query", "type": "int"}, + 'custom_header': {'key': 'customHeader', 'type': 'str'}, + 'query': {'key': 'query', 'type': 'int'}, } - def __init__(self, *, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs): + def __init__( + self, + *, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs + ): """ :keyword custom_header: :paramtype custom_header: str @@ -132,19 +156,25 @@ class ParameterGroupingPostRequiredParameters(msrest.serialization.Model): """ _validation = { - "path": {"required": True}, - "body": {"required": True}, + 'path': {'required': True}, + 'body': {'required': True}, } _attribute_map = { - "custom_header": {"key": "customHeader", "type": "str"}, - "query": {"key": "query", "type": "int"}, - "path": {"key": "path", "type": "str"}, - "body": {"key": "body", "type": "int"}, + 'custom_header': {'key': 'customHeader', 'type': 'str'}, + 'query': {'key': 'query', 'type': 'int'}, + 'path': {'key': 'path', 'type': 'str'}, + 'body': {'key': 'body', 'type': 'int'}, } def __init__( - self, *, path: str, body: int, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs + self, + *, + path: str, + body: int, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs ): """ :keyword custom_header: @@ -173,11 +203,17 @@ class ParameterGroupingPostReservedWordsParameters(msrest.serialization.Model): """ _attribute_map = { - "from_property": {"key": "from", "type": "str"}, - "accept": {"key": "accept", "type": "str"}, + 'from_property': {'key': 'from', 'type': 'str'}, + 'accept': {'key': 'accept', 'type': 'str'}, } - def __init__(self, *, from_property: Optional[str] = None, accept: Optional[str] = None, **kwargs): + def __init__( + self, + *, + from_property: Optional[str] = None, + accept: Optional[str] = None, + **kwargs + ): """ :keyword from_property: 'from' is a reserved word. Pass in 'bob' to pass. :paramtype from_property: str diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/__init__.py index a0102ecb745..4477c024861 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/__init__.py @@ -9,5 +9,5 @@ from ._parameter_grouping_operations import ParameterGroupingOperations __all__ = [ - "ParameterGroupingOperations", + 'ParameterGroupingOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py index f119c5063e4..d67e2b8fb46 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -244,11 +236,13 @@ def post_required( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _custom_header = None _query = None @@ -259,7 +253,7 @@ def post_required( _query = parameter_grouping_post_required_parameters.query _path = parameter_grouping_post_required_parameters.path _body = parameter_grouping_post_required_parameters.body - _json = self._serialize.body(_body, "int") + _json = self._serialize.body(_body, 'int') request = build_post_required_request( path=_path, @@ -267,12 +261,16 @@ def post_required( json=_json, custom_header=_custom_header, query=_query, - template_url=self.post_required.metadata["url"], + template_url=self.post_required.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -283,7 +281,8 @@ def post_required( if cls: return cls(pipeline_response, None, {}) - post_required.metadata = {"url": "/parameterGrouping/postRequired/{path}"} # type: ignore + post_required.metadata = {'url': '/parameterGrouping/postRequired/{path}'} # type: ignore + @distributed_trace def post_optional( @@ -302,9 +301,11 @@ def post_optional( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _custom_header = None _query = None @@ -315,12 +316,16 @@ def post_optional( request = build_post_optional_request( custom_header=_custom_header, query=_query, - template_url=self.post_optional.metadata["url"], + template_url=self.post_optional.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -331,7 +336,8 @@ def post_optional( if cls: return cls(pipeline_response, None, {}) - post_optional.metadata = {"url": "/parameterGrouping/postOptional"} # type: ignore + post_optional.metadata = {'url': '/parameterGrouping/postOptional'} # type: ignore + @distributed_trace def post_reserved_words( @@ -350,9 +356,11 @@ def post_reserved_words( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _from_parameter = None _accept_parameter = None @@ -363,12 +371,16 @@ def post_reserved_words( request = build_post_reserved_words_request( from_parameter=_from_parameter, accept_parameter=_accept_parameter, - template_url=self.post_reserved_words.metadata["url"], + template_url=self.post_reserved_words.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -379,7 +391,8 @@ def post_reserved_words( if cls: return cls(pipeline_response, None, {}) - post_reserved_words.metadata = {"url": "/parameterGrouping/postReservedWords"} # type: ignore + post_reserved_words.metadata = {'url': '/parameterGrouping/postReservedWords'} # type: ignore + @distributed_trace def post_multi_param_groups( @@ -401,9 +414,11 @@ def post_multi_param_groups( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _header_one = None _query_one = None @@ -421,12 +436,16 @@ def post_multi_param_groups( query_one=_query_one, header_two=_header_two, query_two=_query_two, - template_url=self.post_multi_param_groups.metadata["url"], + template_url=self.post_multi_param_groups.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -437,7 +456,8 @@ def post_multi_param_groups( if cls: return cls(pipeline_response, None, {}) - post_multi_param_groups.metadata = {"url": "/parameterGrouping/postMultipleParameterGroups"} # type: ignore + post_multi_param_groups.metadata = {'url': '/parameterGrouping/postMultipleParameterGroups'} # type: ignore + @distributed_trace def post_shared_parameter_group_object( @@ -455,9 +475,11 @@ def post_shared_parameter_group_object( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _header_one = None _query_one = None @@ -468,12 +490,16 @@ def post_shared_parameter_group_object( request = build_post_shared_parameter_group_object_request( header_one=_header_one, query_one=_query_one, - template_url=self.post_shared_parameter_group_object.metadata["url"], + template_url=self.post_shared_parameter_group_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -484,4 +510,5 @@ def post_shared_parameter_group_object( if cls: return cls(pipeline_response, None, {}) - post_shared_parameter_group_object.metadata = {"url": "/parameterGrouping/sharedParameterGroupObject"} # type: ignore + post_shared_parameter_group_object.metadata = {'url': '/parameterGrouping/sharedParameterGroupObject'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py index 5b4af33fe8a..999d5456e09 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/__init__.py index f41ac75f784..f93c711020e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestReportServiceForAzure"] +__all__ = ['AutoRestReportServiceForAzure'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py index aae1b24a7b7..ae6ddf87f46 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestReportServiceForAzure(AutoRestReportServiceForAzureOperationsMixin): """Test Infrastructure for AutoRest. @@ -44,6 +43,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_configuration.py index c358d080144..c2935150d7a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestReportServiceForAzureConfiguration(Configuration): +class AutoRestReportServiceForAzureConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportServiceForAzure. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestReportServiceForAzureConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestReportServiceForAzureConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportserviceforazure/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportserviceforazure/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/__init__.py index da79a2dd3bd..13808e726c2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_report_service_for_azure import AutoRestReportServiceForAzure - -__all__ = ["AutoRestReportServiceForAzure"] +__all__ = ['AutoRestReportServiceForAzure'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py index 05f1b7f0e79..c21a00c7901 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestReportServiceForAzureConfiguration from .operations import AutoRestReportServiceForAzureOperationsMixin - class AutoRestReportServiceForAzure(AutoRestReportServiceForAzureOperationsMixin): """Test Infrastructure for AutoRest. @@ -25,7 +24,11 @@ class AutoRestReportServiceForAzure(AutoRestReportServiceForAzureOperationsMixin :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestReportServiceForAzureConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -34,7 +37,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_configuration.py index 0a75f8ad29c..5bb752f3da4 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestReportServiceForAzureConfiguration(Configuration): +class AutoRestReportServiceForAzureConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportServiceForAzure. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceForAzureConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportserviceforazure/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportserviceforazure/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/__init__.py index 8e9ec511926..548915fdd77 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_report_service_for_azure_operations import AutoRestReportServiceForAzureOperationsMixin __all__ = [ - "AutoRestReportServiceForAzureOperationsMixin", + 'AutoRestReportServiceForAzureOperationsMixin', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py index e0b7fba1dd2..c734311689a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,14 +17,17 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._auto_rest_report_service_for_azure_operations import build_get_report_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestReportServiceForAzureOperationsMixin: + @distributed_trace_async - async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + async def get_report( + self, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get test coverage report. :param qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' in @@ -43,18 +39,25 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_report_request( qualifier=qualifier, - template_url=self.get_report.metadata["url"], + template_url=self.get_report.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -62,11 +65,12 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_report.metadata = {"url": "/report/azure"} # type: ignore + get_report.metadata = {'url': '/report/azure'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/__init__.py index 8e9ec511926..548915fdd77 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_report_service_for_azure_operations import AutoRestReportServiceForAzureOperationsMixin __all__ = [ - "AutoRestReportServiceForAzureOperationsMixin", + 'AutoRestReportServiceForAzureOperationsMixin', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py index 8bacca5285d..25d88bb7170 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -65,6 +57,7 @@ def build_get_report_request( # fmt: on class AutoRestReportServiceForAzureOperationsMixin(object): + @distributed_trace def get_report( self, @@ -83,18 +76,25 @@ def get_report( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_report_request( qualifier=qualifier, - template_url=self.get_report.metadata["url"], + template_url=self.get_report.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,11 +102,12 @@ def get_report( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_report.metadata = {"url": "/report/azure"} # type: ignore + get_report.metadata = {'url': '/report/azure'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py index 94333e8e5a3..b8884760fd7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/__init__.py index a556ef949db..9ddba899fc1 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestAzureSpecialParametersTestClient"] +__all__ = ['AutoRestAzureSpecialParametersTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py index 29a56aa13e5..12b56a547f0 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py @@ -14,26 +14,16 @@ from . import models from ._configuration import AutoRestAzureSpecialParametersTestClientConfiguration -from .operations import ( - ApiVersionDefaultOperations, - ApiVersionLocalOperations, - HeaderOperations, - OdataOperations, - SkipUrlEncodingOperations, - SubscriptionInCredentialsOperations, - SubscriptionInMethodOperations, - XMsClientRequestIdOperations, -) +from .operations import ApiVersionDefaultOperations, ApiVersionLocalOperations, HeaderOperations, OdataOperations, SkipUrlEncodingOperations, SubscriptionInCredentialsOperations, SubscriptionInMethodOperations, XMsClientRequestIdOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse - -class AutoRestAzureSpecialParametersTestClient(object): +class AutoRestAzureSpecialParametersTestClient(object): # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar xms_client_request_id: XMsClientRequestIdOperations operations @@ -74,35 +64,22 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) + self._config = AutoRestAzureSpecialParametersTestClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.xms_client_request_id = XMsClientRequestIdOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_credentials = SubscriptionInCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_method = SubscriptionInMethodOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_default = ApiVersionDefaultOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_local = ApiVersionLocalOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.skip_url_encoding = SkipUrlEncodingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.xms_client_request_id = XMsClientRequestIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_credentials = SubscriptionInCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_method = SubscriptionInMethodOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_default = ApiVersionDefaultOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_local = ApiVersionLocalOperations(self._client, self._config, self._serialize, self._deserialize) + self.skip_url_encoding = SkipUrlEncodingOperations(self._client, self._config, self._serialize, self._deserialize) self.odata = OdataOperations(self._client, self._config, self._serialize, self._deserialize) self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_configuration.py index c7f0e210297..eb9f3403955 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): +class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestAzureSpecialParametersTestClient. Note that all parameters used to create this instance are saved as instance @@ -29,9 +29,11 @@ class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + :param subscription_id: The subscription id, which appears in the path, always modeled in + credentials. The value is always '1234-5678-9012-3456'. :type subscription_id: str - :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -43,7 +45,7 @@ def __init__( ): # type: (...) -> None super(AutoRestAzureSpecialParametersTestClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -53,24 +55,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestazurespecialparameterstestclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestazurespecialparameterstestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/__init__.py index 2c807d773e3..71365d65258 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_azure_special_parameters_test_client import AutoRestAzureSpecialParametersTestClient - -__all__ = ["AutoRestAzureSpecialParametersTestClient"] +__all__ = ['AutoRestAzureSpecialParametersTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py index babc555c0b8..ea63d242410 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -15,23 +15,13 @@ from .. import models from ._configuration import AutoRestAzureSpecialParametersTestClientConfiguration -from .operations import ( - ApiVersionDefaultOperations, - ApiVersionLocalOperations, - HeaderOperations, - OdataOperations, - SkipUrlEncodingOperations, - SubscriptionInCredentialsOperations, - SubscriptionInMethodOperations, - XMsClientRequestIdOperations, -) +from .operations import ApiVersionDefaultOperations, ApiVersionLocalOperations, HeaderOperations, OdataOperations, SkipUrlEncodingOperations, SubscriptionInCredentialsOperations, SubscriptionInMethodOperations, XMsClientRequestIdOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential - -class AutoRestAzureSpecialParametersTestClient: +class AutoRestAzureSpecialParametersTestClient: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar xms_client_request_id: XMsClientRequestIdOperations operations @@ -72,36 +62,27 @@ def __init__( base_url: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) + self._config = AutoRestAzureSpecialParametersTestClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.xms_client_request_id = XMsClientRequestIdOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_credentials = SubscriptionInCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_method = SubscriptionInMethodOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_default = ApiVersionDefaultOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_local = ApiVersionLocalOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.skip_url_encoding = SkipUrlEncodingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.xms_client_request_id = XMsClientRequestIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_credentials = SubscriptionInCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_method = SubscriptionInMethodOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_default = ApiVersionDefaultOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_local = ApiVersionLocalOperations(self._client, self._config, self._serialize, self._deserialize) + self.skip_url_encoding = SkipUrlEncodingOperations(self._client, self._config, self._serialize, self._deserialize) self.odata = OdataOperations(self._client, self._config, self._serialize, self._deserialize) self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_configuration.py index 7b171acb8f2..79077a0ef42 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): +class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestAzureSpecialParametersTestClient. Note that all parameters used to create this instance are saved as instance @@ -27,15 +27,22 @@ class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + :param subscription_id: The subscription id, which appears in the path, always modeled in + credentials. The value is always '1234-5678-9012-3456'. :type subscription_id: str - :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: super(AutoRestAzureSpecialParametersTestClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,21 +52,22 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestazurespecialparameterstestclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestazurespecialparameterstestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/__init__.py index 26fbde7b164..e4bc5b5806e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/__init__.py @@ -16,12 +16,12 @@ from ._header_operations import HeaderOperations __all__ = [ - "XMsClientRequestIdOperations", - "SubscriptionInCredentialsOperations", - "SubscriptionInMethodOperations", - "ApiVersionDefaultOperations", - "ApiVersionLocalOperations", - "SkipUrlEncodingOperations", - "OdataOperations", - "HeaderOperations", + 'XMsClientRequestIdOperations', + 'SubscriptionInCredentialsOperations', + 'SubscriptionInMethodOperations', + 'ApiVersionDefaultOperations', + 'ApiVersionLocalOperations', + 'SkipUrlEncodingOperations', + 'OdataOperations', + 'HeaderOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py index 3a443d8cc13..f2216e06806 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,17 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._api_version_default_operations import ( - build_get_method_global_not_provided_valid_request, - build_get_method_global_valid_request, - build_get_path_global_valid_request, - build_get_swagger_global_valid_request, -) - -T = TypeVar("T") +from ...operations._api_version_default_operations import build_get_method_global_not_provided_valid_request, build_get_method_global_valid_request, build_get_path_global_valid_request, build_get_swagger_global_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ApiVersionDefaultOperations: """ApiVersionDefaultOperations async operations. @@ -58,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_method_global_valid(self, **kwargs: Any) -> None: + async def get_method_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :keyword callable cls: A custom type or function that will be passed the direct response @@ -66,20 +55,27 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_method_global_valid_request( api_version=api_version, - template_url=self.get_method_global_valid.metadata["url"], + template_url=self.get_method_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -90,10 +86,14 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_method_global_valid.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview"} # type: ignore + get_method_global_valid.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview'} # type: ignore + @distributed_trace_async - async def get_method_global_not_provided_valid(self, **kwargs: Any) -> None: + async def get_method_global_not_provided_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :keyword callable cls: A custom type or function that will be passed the direct response @@ -101,20 +101,27 @@ async def get_method_global_not_provided_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_method_global_not_provided_valid_request( api_version=api_version, - template_url=self.get_method_global_not_provided_valid.metadata["url"], + template_url=self.get_method_global_not_provided_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -125,10 +132,14 @@ async def get_method_global_not_provided_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_method_global_not_provided_valid.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview"} # type: ignore + get_method_global_not_provided_valid.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview'} # type: ignore + @distributed_trace_async - async def get_path_global_valid(self, **kwargs: Any) -> None: + async def get_path_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :keyword callable cls: A custom type or function that will be passed the direct response @@ -136,20 +147,27 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_path_global_valid_request( api_version=api_version, - template_url=self.get_path_global_valid.metadata["url"], + template_url=self.get_path_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,10 +178,14 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_path_global_valid.metadata = {"url": "/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview"} # type: ignore + get_path_global_valid.metadata = {'url': '/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview'} # type: ignore + @distributed_trace_async - async def get_swagger_global_valid(self, **kwargs: Any) -> None: + async def get_swagger_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :keyword callable cls: A custom type or function that will be passed the direct response @@ -171,20 +193,27 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_swagger_global_valid_request( api_version=api_version, - template_url=self.get_swagger_global_valid.metadata["url"], + template_url=self.get_swagger_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,4 +224,5 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_swagger_global_valid.metadata = {"url": "/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview"} # type: ignore + get_swagger_global_valid.metadata = {'url': '/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py index 07c2d3102fa..b025518691f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,17 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._api_version_local_operations import ( - build_get_method_local_null_request, - build_get_method_local_valid_request, - build_get_path_local_valid_request, - build_get_swagger_local_valid_request, -) - -T = TypeVar("T") +from ...operations._api_version_local_operations import build_get_method_local_null_request, build_get_method_local_valid_request, build_get_path_local_valid_request, build_get_swagger_local_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ApiVersionLocalOperations: """ApiVersionLocalOperations async operations. @@ -58,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_method_local_valid(self, **kwargs: Any) -> None: + async def get_method_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: This should appear as a method parameter, use value '2.0'. The default @@ -69,20 +58,27 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_get_method_local_valid_request( api_version=api_version, - template_url=self.get_method_local_valid.metadata["url"], + template_url=self.get_method_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,10 +89,15 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_method_local_valid.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/local/2.0"} # type: ignore + get_method_local_valid.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/local/2.0'} # type: ignore + @distributed_trace_async - async def get_method_local_null(self, api_version: Optional[str] = None, **kwargs: Any) -> None: + async def get_method_local_null( + self, + api_version: Optional[str] = None, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = null to succeed. :param api_version: This should appear as a method parameter, use value null, this should @@ -107,18 +108,25 @@ async def get_method_local_null(self, api_version: Optional[str] = None, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_local_null_request( api_version=api_version, - template_url=self.get_method_local_null.metadata["url"], + template_url=self.get_method_local_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,10 +137,14 @@ async def get_method_local_null(self, api_version: Optional[str] = None, **kwarg if cls: return cls(pipeline_response, None, {}) - get_method_local_null.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/local/null"} # type: ignore + get_method_local_null.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/local/null'} # type: ignore + @distributed_trace_async - async def get_path_local_valid(self, **kwargs: Any) -> None: + async def get_path_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: This should appear as a method parameter, use value '2.0'. The default @@ -143,20 +155,27 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_get_path_local_valid_request( api_version=api_version, - template_url=self.get_path_local_valid.metadata["url"], + template_url=self.get_path_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -167,10 +186,14 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_path_local_valid.metadata = {"url": "/azurespecials/apiVersion/path/string/none/query/local/2.0"} # type: ignore + get_path_local_valid.metadata = {'url': '/azurespecials/apiVersion/path/string/none/query/local/2.0'} # type: ignore + @distributed_trace_async - async def get_swagger_local_valid(self, **kwargs: Any) -> None: + async def get_swagger_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: The api version, which appears in the query, the value is always '2.0'. @@ -182,20 +205,27 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_get_swagger_local_valid_request( api_version=api_version, - template_url=self.get_swagger_local_valid.metadata["url"], + template_url=self.get_swagger_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -206,4 +236,5 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_swagger_local_valid.metadata = {"url": "/azurespecials/apiVersion/swagger/string/none/query/local/2.0"} # type: ignore + get_swagger_local_valid.metadata = {'url': '/azurespecials/apiVersion/swagger/string/none/query/local/2.0'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py index 620766d309c..880f2a885d6 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,16 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._header_operations import ( - build_custom_named_request_id_head_request, - build_custom_named_request_id_param_grouping_request, - build_custom_named_request_id_request, -) - -T = TypeVar("T") +from ...operations._header_operations import build_custom_named_request_id_head_request, build_custom_named_request_id_param_grouping_request, build_custom_named_request_id_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HeaderOperations: """HeaderOperations async operations. @@ -57,7 +44,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def custom_named_request_id(self, foo_client_request_id: str, **kwargs: Any) -> None: + async def custom_named_request_id( + self, + foo_client_request_id: str, + **kwargs: Any + ) -> None: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. :param foo_client_request_id: The fooRequestId. @@ -67,18 +58,25 @@ async def custom_named_request_id(self, foo_client_request_id: str, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_custom_named_request_id_request( foo_client_request_id=foo_client_request_id, - template_url=self.custom_named_request_id.metadata["url"], + template_url=self.custom_named_request_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -87,12 +85,14 @@ async def custom_named_request_id(self, foo_client_request_id: str, **kwargs: An raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) - custom_named_request_id.metadata = {"url": "/azurespecials/customNamedRequestId"} # type: ignore + custom_named_request_id.metadata = {'url': '/azurespecials/customNamedRequestId'} # type: ignore + @distributed_trace_async async def custom_named_request_id_param_grouping( @@ -111,9 +111,11 @@ async def custom_named_request_id_param_grouping( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _foo_client_request_id = None if header_custom_named_request_id_param_grouping_parameters is not None: @@ -121,12 +123,16 @@ async def custom_named_request_id_param_grouping( request = build_custom_named_request_id_param_grouping_request( foo_client_request_id=_foo_client_request_id, - template_url=self.custom_named_request_id_param_grouping.metadata["url"], + template_url=self.custom_named_request_id_param_grouping.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -135,15 +141,21 @@ async def custom_named_request_id_param_grouping( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) - custom_named_request_id_param_grouping.metadata = {"url": "/azurespecials/customNamedRequestIdParamGrouping"} # type: ignore + custom_named_request_id_param_grouping.metadata = {'url': '/azurespecials/customNamedRequestIdParamGrouping'} # type: ignore + @distributed_trace_async - async def custom_named_request_id_head(self, foo_client_request_id: str, **kwargs: Any) -> bool: + async def custom_named_request_id_head( + self, + foo_client_request_id: str, + **kwargs: Any + ) -> bool: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. :param foo_client_request_id: The fooRequestId. @@ -153,18 +165,25 @@ async def custom_named_request_id_head(self, foo_client_request_id: str, **kwarg :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_custom_named_request_id_head_request( foo_client_request_id=foo_client_request_id, - template_url=self.custom_named_request_id_head.metadata["url"], + template_url=self.custom_named_request_id_head.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -174,10 +193,12 @@ async def custom_named_request_id_head(self, foo_client_request_id: str, **kwarg response_headers = {} if response.status_code == 200: - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - custom_named_request_id_head.metadata = {"url": "/azurespecials/customNamedRequestIdHead"} # type: ignore + custom_named_request_id_head.metadata = {'url': '/azurespecials/customNamedRequestIdHead'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py index 7a6a20af769..1db4ae68184 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -25,11 +18,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._odata_operations import build_get_with_filter_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class OdataOperations: """OdataOperations async operations. @@ -54,7 +45,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: @distributed_trace_async async def get_with_filter( - self, filter: Optional[str] = None, top: Optional[int] = None, orderby: Optional[str] = None, **kwargs: Any + self, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any ) -> None: """Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. @@ -69,20 +64,27 @@ async def get_with_filter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_with_filter_request( filter=filter, top=top, orderby=orderby, - template_url=self.get_with_filter.metadata["url"], + template_url=self.get_with_filter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,4 +95,5 @@ async def get_with_filter( if cls: return cls(pipeline_response, None, {}) - get_with_filter.metadata = {"url": "/azurespecials/odata/filter"} # type: ignore + get_with_filter.metadata = {'url': '/azurespecials/odata/filter'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py index 6e8e312111c..fe019f70e5f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,20 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._skip_url_encoding_operations import ( - build_get_method_path_valid_request, - build_get_method_query_null_request, - build_get_method_query_valid_request, - build_get_path_query_valid_request, - build_get_path_valid_request, - build_get_swagger_path_valid_request, - build_get_swagger_query_valid_request, -) - -T = TypeVar("T") +from ...operations._skip_url_encoding_operations import build_get_method_path_valid_request, build_get_method_query_null_request, build_get_method_query_valid_request, build_get_path_query_valid_request, build_get_path_valid_request, build_get_swagger_path_valid_request, build_get_swagger_query_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class SkipUrlEncodingOperations: """SkipUrlEncodingOperations async operations. @@ -61,7 +44,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: + async def get_method_path_valid( + self, + unencoded_path_param: str, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. @@ -71,18 +58,25 @@ async def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_path_valid_request( unencoded_path_param=unencoded_path_param, - template_url=self.get_method_path_valid.metadata["url"], + template_url=self.get_method_path_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,10 +87,15 @@ async def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - get_method_path_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}"} # type: ignore + get_method_path_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}'} # type: ignore + @distributed_trace_async - async def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: + async def get_path_valid( + self, + unencoded_path_param: str, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. @@ -106,18 +105,25 @@ async def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_path_valid_request( unencoded_path_param=unencoded_path_param, - template_url=self.get_path_valid.metadata["url"], + template_url=self.get_path_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,10 +134,14 @@ async def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - get_path_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}"} # type: ignore + get_path_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}'} # type: ignore + @distributed_trace_async - async def get_swagger_path_valid(self, **kwargs: Any) -> None: + async def get_swagger_path_valid( + self, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :keyword unencoded_path_param: An unencoded path parameter with value 'path1/path2/path3'. The @@ -143,20 +153,27 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - unencoded_path_param = kwargs.pop("unencoded_path_param", "path1/path2/path3") # type: str + unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str + request = build_get_swagger_path_valid_request( unencoded_path_param=unencoded_path_param, - template_url=self.get_swagger_path_valid.metadata["url"], + template_url=self.get_swagger_path_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -167,10 +184,15 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_swagger_path_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}"} # type: ignore + get_swagger_path_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}'} # type: ignore + @distributed_trace_async - async def get_method_query_valid(self, q1: str, **kwargs: Any) -> None: + async def get_method_query_valid( + self, + q1: str, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :param q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. @@ -180,18 +202,25 @@ async def get_method_query_valid(self, q1: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_query_valid_request( q1=q1, - template_url=self.get_method_query_valid.metadata["url"], + template_url=self.get_method_query_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,10 +231,15 @@ async def get_method_query_valid(self, q1: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_method_query_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/method/query/valid"} # type: ignore + get_method_query_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/method/query/valid'} # type: ignore + @distributed_trace_async - async def get_method_query_null(self, q1: Optional[str] = None, **kwargs: Any) -> None: + async def get_method_query_null( + self, + q1: Optional[str] = None, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value null. :param q1: Unencoded query parameter with value null. @@ -215,18 +249,25 @@ async def get_method_query_null(self, q1: Optional[str] = None, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_query_null_request( q1=q1, - template_url=self.get_method_query_null.metadata["url"], + template_url=self.get_method_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -237,10 +278,15 @@ async def get_method_query_null(self, q1: Optional[str] = None, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - get_method_query_null.metadata = {"url": "/azurespecials/skipUrlEncoding/method/query/null"} # type: ignore + get_method_query_null.metadata = {'url': '/azurespecials/skipUrlEncoding/method/query/null'} # type: ignore + @distributed_trace_async - async def get_path_query_valid(self, q1: str, **kwargs: Any) -> None: + async def get_path_query_valid( + self, + q1: str, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :param q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. @@ -250,18 +296,25 @@ async def get_path_query_valid(self, q1: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_path_query_valid_request( q1=q1, - template_url=self.get_path_query_valid.metadata["url"], + template_url=self.get_path_query_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,10 +325,14 @@ async def get_path_query_valid(self, q1: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_path_query_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/path/query/valid"} # type: ignore + get_path_query_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/path/query/valid'} # type: ignore + @distributed_trace_async - async def get_swagger_query_valid(self, **kwargs: Any) -> None: + async def get_swagger_query_valid( + self, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :keyword q1: An unencoded query parameter with value 'value1&q2=value2&q3=value3'. The default @@ -287,20 +344,27 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - q1 = kwargs.pop("q1", "value1&q2=value2&q3=value3") # type: str + q1 = kwargs.pop('q1', "value1&q2=value2&q3=value3") # type: str + request = build_get_swagger_query_valid_request( q1=q1, - template_url=self.get_swagger_query_valid.metadata["url"], + template_url=self.get_swagger_query_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -311,4 +375,5 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_swagger_query_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/swagger/query/valid"} # type: ignore + get_swagger_query_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/swagger/query/valid'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py index 9706ac28e7b..e80e92e120d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,18 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscription_in_credentials_operations import ( - build_post_method_global_not_provided_valid_request, - build_post_method_global_null_request, - build_post_method_global_valid_request, - build_post_path_global_valid_request, - build_post_swagger_global_valid_request, -) - -T = TypeVar("T") +from ...operations._subscription_in_credentials_operations import build_post_method_global_not_provided_valid_request, build_post_method_global_null_request, build_post_method_global_valid_request, build_post_path_global_valid_request, build_post_swagger_global_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class SubscriptionInCredentialsOperations: """SubscriptionInCredentialsOperations async operations. @@ -59,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def post_method_global_valid(self, **kwargs: Any) -> None: + async def post_method_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -68,18 +56,25 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_global_valid_request( subscription_id=self._config.subscription_id, - template_url=self.post_method_global_valid.metadata["url"], + template_url=self.post_method_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -90,10 +85,14 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - post_method_global_valid.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_method_global_valid.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace_async - async def post_method_global_null(self, **kwargs: Any) -> None: + async def post_method_global_null( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. @@ -102,18 +101,25 @@ async def post_method_global_null(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_global_null_request( subscription_id=self._config.subscription_id, - template_url=self.post_method_global_null.metadata["url"], + template_url=self.post_method_global_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,10 +130,14 @@ async def post_method_global_null(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - post_method_global_null.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}"} # type: ignore + post_method_global_null.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}'} # type: ignore + @distributed_trace_async - async def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: + async def post_method_global_not_provided_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -136,21 +146,28 @@ async def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_post_method_global_not_provided_valid_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.post_method_global_not_provided_valid.metadata["url"], + template_url=self.post_method_global_not_provided_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,10 +178,14 @@ async def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - post_method_global_not_provided_valid.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_method_global_not_provided_valid.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace_async - async def post_path_global_valid(self, **kwargs: Any) -> None: + async def post_path_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -173,18 +194,25 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_path_global_valid_request( subscription_id=self._config.subscription_id, - template_url=self.post_path_global_valid.metadata["url"], + template_url=self.post_path_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,10 +223,14 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - post_path_global_valid.metadata = {"url": "/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_path_global_valid.metadata = {'url': '/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace_async - async def post_swagger_global_valid(self, **kwargs: Any) -> None: + async def post_swagger_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -207,18 +239,25 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_swagger_global_valid_request( subscription_id=self._config.subscription_id, - template_url=self.post_swagger_global_valid.metadata["url"], + template_url=self.post_swagger_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -229,4 +268,5 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - post_swagger_global_valid.metadata = {"url": "/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_swagger_global_valid.metadata = {'url': '/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py index ffaf8cc4fad..cb0e1b0ee5d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,17 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._subscription_in_method_operations import ( - build_post_method_local_null_request, - build_post_method_local_valid_request, - build_post_path_local_valid_request, - build_post_swagger_local_valid_request, -) - -T = TypeVar("T") +from ...operations._subscription_in_method_operations import build_post_method_local_null_request, build_post_method_local_valid_request, build_post_path_local_valid_request, build_post_swagger_local_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class SubscriptionInMethodOperations: """SubscriptionInMethodOperations async operations. @@ -58,7 +44,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + async def post_method_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -70,18 +60,25 @@ async def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_local_valid_request( subscription_id=subscription_id, - template_url=self.post_method_local_valid.metadata["url"], + template_url=self.post_method_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,10 +89,15 @@ async def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post_method_local_valid.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_method_local_valid.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace_async - async def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> None: + async def post_method_local_null( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. @@ -107,18 +109,25 @@ async def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_local_null_request( subscription_id=subscription_id, - template_url=self.post_method_local_null.metadata["url"], + template_url=self.post_method_local_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,10 +138,15 @@ async def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - post_method_local_null.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}"} # type: ignore + post_method_local_null.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}'} # type: ignore + @distributed_trace_async - async def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + async def post_path_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -143,18 +157,25 @@ async def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_path_local_valid_request( subscription_id=subscription_id, - template_url=self.post_path_local_valid.metadata["url"], + template_url=self.post_path_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -165,10 +186,15 @@ async def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - post_path_local_valid.metadata = {"url": "/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_path_local_valid.metadata = {'url': '/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace_async - async def post_swagger_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + async def post_swagger_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -180,18 +206,25 @@ async def post_swagger_local_valid(self, subscription_id: str, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_swagger_local_valid_request( subscription_id=subscription_id, - template_url=self.post_swagger_local_valid.metadata["url"], + template_url=self.post_swagger_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,4 +235,5 @@ async def post_swagger_local_valid(self, subscription_id: str, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post_swagger_local_valid.metadata = {"url": "/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_swagger_local_valid.metadata = {'url': '/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py index 5174ddc0bd0..80cf216c4b6 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -25,11 +18,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._xms_client_request_id_operations import build_get_request, build_param_get_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class XMsClientRequestIdOperations: """XMsClientRequestIdOperations async operations. @@ -53,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get(self, **kwargs: Any) -> None: + async def get( + self, + **kwargs: Any + ) -> None: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -62,17 +56,24 @@ async def get(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -82,10 +83,15 @@ async def get(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/azurespecials/overwrite/x-ms-client-request-id/method/"} # type: ignore + get.metadata = {'url': '/azurespecials/overwrite/x-ms-client-request-id/method/'} # type: ignore + @distributed_trace_async - async def param_get(self, x_ms_client_request_id: str, **kwargs: Any) -> None: + async def param_get( + self, + x_ms_client_request_id: str, + **kwargs: Any + ) -> None: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -97,18 +103,25 @@ async def param_get(self, x_ms_client_request_id: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_get_request( x_ms_client_request_id=x_ms_client_request_id, - template_url=self.param_get.metadata["url"], + template_url=self.param_get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -119,4 +132,5 @@ async def param_get(self, x_ms_client_request_id: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - param_get.metadata = {"url": "/azurespecials/overwrite/x-ms-client-request-id/via-param/method/"} # type: ignore + param_get.metadata = {'url': '/azurespecials/overwrite/x-ms-client-request-id/via-param/method/'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py index e405d6b9ae4..e721a3037cd 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py @@ -16,7 +16,7 @@ from ._models import OdataFilter # type: ignore __all__ = [ - "Error", - "HeaderCustomNamedRequestIdParamGroupingParameters", - "OdataFilter", + 'Error', + 'HeaderCustomNamedRequestIdParamGroupingParameters', + 'OdataFilter', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py index bdb7b65a999..29fdad67989 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models.py @@ -26,18 +26,21 @@ class Error(msrest.serialization.Model): """ _validation = { - "constant_id": {"required": True, "constant": True}, + 'constant_id': {'required': True, 'constant': True}, } _attribute_map = { - "status": {"key": "status", "type": "int"}, - "constant_id": {"key": "constantId", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'constant_id': {'key': 'constantId', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } constant_id = 1 - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -45,8 +48,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class HeaderCustomNamedRequestIdParamGroupingParameters(msrest.serialization.Model): @@ -59,20 +62,23 @@ class HeaderCustomNamedRequestIdParamGroupingParameters(msrest.serialization.Mod """ _validation = { - "foo_client_request_id": {"required": True}, + 'foo_client_request_id': {'required': True}, } _attribute_map = { - "foo_client_request_id": {"key": "foo-client-request-id", "type": "str"}, + 'foo_client_request_id': {'key': 'foo-client-request-id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword foo_client_request_id: Required. The fooRequestId. :paramtype foo_client_request_id: str """ super(HeaderCustomNamedRequestIdParamGroupingParameters, self).__init__(**kwargs) - self.foo_client_request_id = kwargs["foo_client_request_id"] + self.foo_client_request_id = kwargs['foo_client_request_id'] class OdataFilter(msrest.serialization.Model): @@ -85,11 +91,14 @@ class OdataFilter(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -97,5 +106,5 @@ def __init__(self, **kwargs): :paramtype name: str """ super(OdataFilter, self).__init__(**kwargs) - self.id = kwargs.get("id", None) - self.name = kwargs.get("name", None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py index 8b6cc1b52ee..18a37dff046 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_models_py3.py @@ -28,18 +28,24 @@ class Error(msrest.serialization.Model): """ _validation = { - "constant_id": {"required": True, "constant": True}, + 'constant_id': {'required': True, 'constant': True}, } _attribute_map = { - "status": {"key": "status", "type": "int"}, - "constant_id": {"key": "constantId", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'constant_id': {'key': 'constantId', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } constant_id = 1 - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -61,14 +67,19 @@ class HeaderCustomNamedRequestIdParamGroupingParameters(msrest.serialization.Mod """ _validation = { - "foo_client_request_id": {"required": True}, + 'foo_client_request_id': {'required': True}, } _attribute_map = { - "foo_client_request_id": {"key": "foo-client-request-id", "type": "str"}, + 'foo_client_request_id': {'key': 'foo-client-request-id', 'type': 'str'}, } - def __init__(self, *, foo_client_request_id: str, **kwargs): + def __init__( + self, + *, + foo_client_request_id: str, + **kwargs + ): """ :keyword foo_client_request_id: Required. The fooRequestId. :paramtype foo_client_request_id: str @@ -87,11 +98,17 @@ class OdataFilter(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, id: Optional[int] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + **kwargs + ): """ :keyword id: :paramtype id: int diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/__init__.py index 26fbde7b164..e4bc5b5806e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/__init__.py @@ -16,12 +16,12 @@ from ._header_operations import HeaderOperations __all__ = [ - "XMsClientRequestIdOperations", - "SubscriptionInCredentialsOperations", - "SubscriptionInMethodOperations", - "ApiVersionDefaultOperations", - "ApiVersionLocalOperations", - "SkipUrlEncodingOperations", - "OdataOperations", - "HeaderOperations", + 'XMsClientRequestIdOperations', + 'SubscriptionInCredentialsOperations', + 'SubscriptionInMethodOperations', + 'ApiVersionDefaultOperations', + 'ApiVersionLocalOperations', + 'SkipUrlEncodingOperations', + 'OdataOperations', + 'HeaderOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py index 1163bd46364..3352e941206 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -71,7 +63,7 @@ def build_get_method_global_not_provided_valid_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview') + url = kwargs.pop("template_url", '/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview') # pylint: disable=line-too-long # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] @@ -168,7 +160,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_method_global_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """GET method with api-version modeled in global settings. @@ -178,20 +171,27 @@ def get_method_global_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_method_global_valid_request( api_version=api_version, - template_url=self.get_method_global_valid.metadata["url"], + template_url=self.get_method_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,11 +202,13 @@ def get_method_global_valid( if cls: return cls(pipeline_response, None, {}) - get_method_global_valid.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview"} # type: ignore + get_method_global_valid.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview'} # type: ignore + @distributed_trace def get_method_global_not_provided_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """GET method with api-version modeled in global settings. @@ -216,20 +218,27 @@ def get_method_global_not_provided_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_method_global_not_provided_valid_request( api_version=api_version, - template_url=self.get_method_global_not_provided_valid.metadata["url"], + template_url=self.get_method_global_not_provided_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -240,11 +249,13 @@ def get_method_global_not_provided_valid( if cls: return cls(pipeline_response, None, {}) - get_method_global_not_provided_valid.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview"} # type: ignore + get_method_global_not_provided_valid.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview'} # type: ignore + @distributed_trace def get_path_global_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """GET method with api-version modeled in global settings. @@ -254,20 +265,27 @@ def get_path_global_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_path_global_valid_request( api_version=api_version, - template_url=self.get_path_global_valid.metadata["url"], + template_url=self.get_path_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -278,11 +296,13 @@ def get_path_global_valid( if cls: return cls(pipeline_response, None, {}) - get_path_global_valid.metadata = {"url": "/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview"} # type: ignore + get_path_global_valid.metadata = {'url': '/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview'} # type: ignore + @distributed_trace def get_swagger_global_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """GET method with api-version modeled in global settings. @@ -292,20 +312,27 @@ def get_swagger_global_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_get_swagger_global_valid_request( api_version=api_version, - template_url=self.get_swagger_global_valid.metadata["url"], + template_url=self.get_swagger_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -316,4 +343,5 @@ def get_swagger_global_valid( if cls: return cls(pipeline_response, None, {}) - get_swagger_global_valid.metadata = {"url": "/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview"} # type: ignore + get_swagger_global_valid.metadata = {'url': '/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py index fae72678d01..552d9c57d92 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -169,7 +161,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_method_local_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. @@ -182,20 +175,27 @@ def get_method_local_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_get_method_local_valid_request( api_version=api_version, - template_url=self.get_method_local_valid.metadata["url"], + template_url=self.get_method_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -206,7 +206,8 @@ def get_method_local_valid( if cls: return cls(pipeline_response, None, {}) - get_method_local_valid.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/local/2.0"} # type: ignore + get_method_local_valid.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/local/2.0'} # type: ignore + @distributed_trace def get_method_local_null( @@ -225,18 +226,25 @@ def get_method_local_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_local_null_request( api_version=api_version, - template_url=self.get_method_local_null.metadata["url"], + template_url=self.get_method_local_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,11 +255,13 @@ def get_method_local_null( if cls: return cls(pipeline_response, None, {}) - get_method_local_null.metadata = {"url": "/azurespecials/apiVersion/method/string/none/query/local/null"} # type: ignore + get_method_local_null.metadata = {'url': '/azurespecials/apiVersion/method/string/none/query/local/null'} # type: ignore + @distributed_trace def get_path_local_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. @@ -264,20 +274,27 @@ def get_path_local_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_get_path_local_valid_request( api_version=api_version, - template_url=self.get_path_local_valid.metadata["url"], + template_url=self.get_path_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -288,11 +305,13 @@ def get_path_local_valid( if cls: return cls(pipeline_response, None, {}) - get_path_local_valid.metadata = {"url": "/azurespecials/apiVersion/path/string/none/query/local/2.0"} # type: ignore + get_path_local_valid.metadata = {'url': '/azurespecials/apiVersion/path/string/none/query/local/2.0'} # type: ignore + @distributed_trace def get_swagger_local_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. @@ -306,20 +325,27 @@ def get_swagger_local_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_get_swagger_local_valid_request( api_version=api_version, - template_url=self.get_swagger_local_valid.metadata["url"], + template_url=self.get_swagger_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -330,4 +356,5 @@ def get_swagger_local_valid( if cls: return cls(pipeline_response, None, {}) - get_swagger_local_valid.metadata = {"url": "/azurespecials/apiVersion/swagger/string/none/query/local/2.0"} # type: ignore + get_swagger_local_valid.metadata = {'url': '/azurespecials/apiVersion/swagger/string/none/query/local/2.0'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py index 650ac5b5ebc..a9df0235ef5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -143,18 +135,25 @@ def custom_named_request_id( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_custom_named_request_id_request( foo_client_request_id=foo_client_request_id, - template_url=self.custom_named_request_id.metadata["url"], + template_url=self.custom_named_request_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,12 +162,14 @@ def custom_named_request_id( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) - custom_named_request_id.metadata = {"url": "/azurespecials/customNamedRequestId"} # type: ignore + custom_named_request_id.metadata = {'url': '/azurespecials/customNamedRequestId'} # type: ignore + @distributed_trace def custom_named_request_id_param_grouping( @@ -188,9 +189,11 @@ def custom_named_request_id_param_grouping( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _foo_client_request_id = None if header_custom_named_request_id_param_grouping_parameters is not None: @@ -198,12 +201,16 @@ def custom_named_request_id_param_grouping( request = build_custom_named_request_id_param_grouping_request( foo_client_request_id=_foo_client_request_id, - template_url=self.custom_named_request_id_param_grouping.metadata["url"], + template_url=self.custom_named_request_id_param_grouping.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -212,12 +219,14 @@ def custom_named_request_id_param_grouping( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) - custom_named_request_id_param_grouping.metadata = {"url": "/azurespecials/customNamedRequestIdParamGrouping"} # type: ignore + custom_named_request_id_param_grouping.metadata = {'url': '/azurespecials/customNamedRequestIdParamGrouping'} # type: ignore + @distributed_trace def custom_named_request_id_head( @@ -235,18 +244,25 @@ def custom_named_request_id_head( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_custom_named_request_id_head_request( foo_client_request_id=foo_client_request_id, - template_url=self.custom_named_request_id_head.metadata["url"], + template_url=self.custom_named_request_id_head.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -256,10 +272,12 @@ def custom_named_request_id_head( response_headers = {} if response.status_code == 200: - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 - custom_named_request_id_head.metadata = {"url": "/azurespecials/customNamedRequestIdHead"} # type: ignore + custom_named_request_id_head.metadata = {'url': '/azurespecials/customNamedRequestIdHead'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py index a4a847619f0..e3113f958c9 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -114,20 +106,27 @@ def get_with_filter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_with_filter_request( filter=filter, top=top, orderby=orderby, - template_url=self.get_with_filter.metadata["url"], + template_url=self.get_with_filter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -138,4 +137,5 @@ def get_with_filter( if cls: return cls(pipeline_response, None, {}) - get_with_filter.metadata = {"url": "/azurespecials/odata/filter"} # type: ignore + get_with_filter.metadata = {'url': '/azurespecials/odata/filter'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py index b1b9a36e280..f5785996e86 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -262,18 +254,25 @@ def get_method_path_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_path_valid_request( unencoded_path_param=unencoded_path_param, - template_url=self.get_method_path_valid.metadata["url"], + template_url=self.get_method_path_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -284,7 +283,8 @@ def get_method_path_valid( if cls: return cls(pipeline_response, None, {}) - get_method_path_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}"} # type: ignore + get_method_path_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}'} # type: ignore + @distributed_trace def get_path_valid( @@ -302,18 +302,25 @@ def get_path_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_path_valid_request( unencoded_path_param=unencoded_path_param, - template_url=self.get_path_valid.metadata["url"], + template_url=self.get_path_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -324,11 +331,13 @@ def get_path_valid( if cls: return cls(pipeline_response, None, {}) - get_path_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}"} # type: ignore + get_path_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}'} # type: ignore + @distributed_trace def get_swagger_path_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get method with unencoded path parameter with value 'path1/path2/path3'. @@ -342,20 +351,27 @@ def get_swagger_path_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - unencoded_path_param = kwargs.pop("unencoded_path_param", "path1/path2/path3") # type: str + unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str + request = build_get_swagger_path_valid_request( unencoded_path_param=unencoded_path_param, - template_url=self.get_swagger_path_valid.metadata["url"], + template_url=self.get_swagger_path_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -366,7 +382,8 @@ def get_swagger_path_valid( if cls: return cls(pipeline_response, None, {}) - get_swagger_path_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}"} # type: ignore + get_swagger_path_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}'} # type: ignore + @distributed_trace def get_method_query_valid( @@ -384,18 +401,25 @@ def get_method_query_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_query_valid_request( q1=q1, - template_url=self.get_method_query_valid.metadata["url"], + template_url=self.get_method_query_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -406,7 +430,8 @@ def get_method_query_valid( if cls: return cls(pipeline_response, None, {}) - get_method_query_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/method/query/valid"} # type: ignore + get_method_query_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/method/query/valid'} # type: ignore + @distributed_trace def get_method_query_null( @@ -424,18 +449,25 @@ def get_method_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_method_query_null_request( q1=q1, - template_url=self.get_method_query_null.metadata["url"], + template_url=self.get_method_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -446,7 +478,8 @@ def get_method_query_null( if cls: return cls(pipeline_response, None, {}) - get_method_query_null.metadata = {"url": "/azurespecials/skipUrlEncoding/method/query/null"} # type: ignore + get_method_query_null.metadata = {'url': '/azurespecials/skipUrlEncoding/method/query/null'} # type: ignore + @distributed_trace def get_path_query_valid( @@ -464,18 +497,25 @@ def get_path_query_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_path_query_valid_request( q1=q1, - template_url=self.get_path_query_valid.metadata["url"], + template_url=self.get_path_query_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -486,11 +526,13 @@ def get_path_query_valid( if cls: return cls(pipeline_response, None, {}) - get_path_query_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/path/query/valid"} # type: ignore + get_path_query_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/path/query/valid'} # type: ignore + @distributed_trace def get_swagger_query_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. @@ -504,20 +546,27 @@ def get_swagger_query_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - q1 = kwargs.pop("q1", "value1&q2=value2&q3=value3") # type: str + q1 = kwargs.pop('q1', "value1&q2=value2&q3=value3") # type: str + request = build_get_swagger_query_valid_request( q1=q1, - template_url=self.get_swagger_query_valid.metadata["url"], + template_url=self.get_swagger_query_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -528,4 +577,5 @@ def get_swagger_query_valid( if cls: return cls(pipeline_response, None, {}) - get_swagger_query_valid.metadata = {"url": "/azurespecials/skipUrlEncoding/swagger/query/valid"} # type: ignore + get_swagger_query_valid.metadata = {'url': '/azurespecials/skipUrlEncoding/swagger/query/valid'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py index f0aa0ced3bf..6d339581bcd 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +35,7 @@ def build_post_method_global_valid_request( # type: (...) -> HttpRequest accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}') + url = kwargs.pop("template_url", '/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}') # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } @@ -97,7 +89,7 @@ def build_post_method_global_not_provided_valid_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}') + url = kwargs.pop("template_url", '/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}') # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } @@ -128,7 +120,7 @@ def build_post_path_global_valid_request( # type: (...) -> HttpRequest accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}') + url = kwargs.pop("template_url", '/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}') # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } @@ -154,7 +146,7 @@ def build_post_swagger_global_valid_request( # type: (...) -> HttpRequest accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}') + url = kwargs.pop("template_url", '/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}') # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } @@ -197,7 +189,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def post_method_global_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to @@ -208,18 +201,25 @@ def post_method_global_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_global_valid_request( subscription_id=self._config.subscription_id, - template_url=self.post_method_global_valid.metadata["url"], + template_url=self.post_method_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,11 +230,13 @@ def post_method_global_valid( if cls: return cls(pipeline_response, None, {}) - post_method_global_valid.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_method_global_valid.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace def post_method_global_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to @@ -245,18 +247,25 @@ def post_method_global_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_global_null_request( subscription_id=self._config.subscription_id, - template_url=self.post_method_global_null.metadata["url"], + template_url=self.post_method_global_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,11 +276,13 @@ def post_method_global_null( if cls: return cls(pipeline_response, None, {}) - post_method_global_null.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}"} # type: ignore + post_method_global_null.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}'} # type: ignore + @distributed_trace def post_method_global_not_provided_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to @@ -282,21 +293,28 @@ def post_method_global_not_provided_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_post_method_global_not_provided_valid_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.post_method_global_not_provided_valid.metadata["url"], + template_url=self.post_method_global_not_provided_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -307,11 +325,13 @@ def post_method_global_not_provided_valid( if cls: return cls(pipeline_response, None, {}) - post_method_global_not_provided_valid.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_method_global_not_provided_valid.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace def post_path_global_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to @@ -322,18 +342,25 @@ def post_path_global_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_path_global_valid_request( subscription_id=self._config.subscription_id, - template_url=self.post_path_global_valid.metadata["url"], + template_url=self.post_path_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,11 +371,13 @@ def post_path_global_valid( if cls: return cls(pipeline_response, None, {}) - post_path_global_valid.metadata = {"url": "/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_path_global_valid.metadata = {'url': '/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace def post_swagger_global_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to @@ -359,18 +388,25 @@ def post_swagger_global_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_swagger_global_valid_request( subscription_id=self._config.subscription_id, - template_url=self.post_swagger_global_valid.metadata["url"], + template_url=self.post_swagger_global_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -381,4 +417,5 @@ def post_swagger_global_valid( if cls: return cls(pipeline_response, None, {}) - post_swagger_global_valid.metadata = {"url": "/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_swagger_global_valid.metadata = {'url': '/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py index 681af1166d8..c301a4ca90e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -43,7 +35,7 @@ def build_post_method_local_valid_request( # type: (...) -> HttpRequest accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}') + url = kwargs.pop("template_url", '/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}') # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } @@ -95,7 +87,7 @@ def build_post_path_local_valid_request( # type: (...) -> HttpRequest accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}') + url = kwargs.pop("template_url", '/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}') # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } @@ -121,7 +113,7 @@ def build_post_swagger_local_valid_request( # type: (...) -> HttpRequest accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}') + url = kwargs.pop("template_url", '/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}') # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } @@ -180,18 +172,25 @@ def post_method_local_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_local_valid_request( subscription_id=subscription_id, - template_url=self.post_method_local_valid.metadata["url"], + template_url=self.post_method_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,7 +201,8 @@ def post_method_local_valid( if cls: return cls(pipeline_response, None, {}) - post_method_local_valid.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_method_local_valid.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace def post_method_local_null( @@ -222,18 +222,25 @@ def post_method_local_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_method_local_null_request( subscription_id=subscription_id, - template_url=self.post_method_local_null.metadata["url"], + template_url=self.post_method_local_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -244,7 +251,8 @@ def post_method_local_null( if cls: return cls(pipeline_response, None, {}) - post_method_local_null.metadata = {"url": "/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}"} # type: ignore + post_method_local_null.metadata = {'url': '/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}'} # type: ignore + @distributed_trace def post_path_local_valid( @@ -263,18 +271,25 @@ def post_path_local_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_path_local_valid_request( subscription_id=subscription_id, - template_url=self.post_path_local_valid.metadata["url"], + template_url=self.post_path_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -285,7 +300,8 @@ def post_path_local_valid( if cls: return cls(pipeline_response, None, {}) - post_path_local_valid.metadata = {"url": "/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_path_local_valid.metadata = {'url': '/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + @distributed_trace def post_swagger_local_valid( @@ -305,18 +321,25 @@ def post_swagger_local_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_swagger_local_valid_request( subscription_id=subscription_id, - template_url=self.post_swagger_local_valid.metadata["url"], + template_url=self.post_swagger_local_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,4 +350,5 @@ def post_swagger_local_valid( if cls: return cls(pipeline_response, None, {}) - post_swagger_local_valid.metadata = {"url": "/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}"} # type: ignore + post_swagger_local_valid.metadata = {'url': '/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py index dbc05f10c50..4894d52ece2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -97,7 +89,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get method that overwrites x-ms-client-request header with value @@ -108,17 +101,24 @@ def get( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,7 +128,8 @@ def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/azurespecials/overwrite/x-ms-client-request-id/method/"} # type: ignore + get.metadata = {'url': '/azurespecials/overwrite/x-ms-client-request-id/method/'} # type: ignore + @distributed_trace def param_get( @@ -148,18 +149,25 @@ def param_get( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_get_request( x_ms_client_request_id=x_ms_client_request_id, - template_url=self.param_get.metadata["url"], + template_url=self.param_get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -170,4 +178,5 @@ def param_get( if cls: return cls(pipeline_response, None, {}) - param_get.metadata = {"url": "/azurespecials/overwrite/x-ms-client-request-id/via-param/method/"} # type: ignore + param_get.metadata = {'url': '/azurespecials/overwrite/x-ms-client-request-id/via-param/method/'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py index 4bf95843e93..2b423533987 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py index bcd7bcd9fec..6ef996852a7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py index 55f40f4a580..d54ee24b218 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py @@ -22,7 +22,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class AutoRestParameterizedHostTestClient(object): """Test Infrastructure for AutoRest. @@ -38,7 +37,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - _base_url = "http://{accountName}{host}" + _base_url = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -47,6 +46,7 @@ def __init__( self._deserialize = Deserializer(client_models) self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest @@ -72,7 +72,7 @@ def _send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py index 164a6df014a..fd19d981016 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -39,19 +39,20 @@ def __init__( raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py index 0fe5782d645..3b422c27c1d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient - -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py index ef6c57e3ffc..6b67d681d6c 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py @@ -17,7 +17,6 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -27,8 +26,12 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _base_url = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _base_url = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer(client_models) self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -57,7 +65,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py index cf7cbb01aaf..789b6e8a4d7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py index a7ad56ef36b..2f0d3b169c3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._paths_operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py index 14c724b05ec..b82aaf5c107 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._paths_operations import build_get_empty_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathsOperations: """PathsOperations async operations. @@ -52,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_empty(self, account_name: str, **kwargs: Any) -> None: + async def get_empty( + self, + account_name: str, + **kwargs: Any + ) -> None: """Get a 200 to test a valid base uri. :param account_name: Account Name. @@ -62,21 +57,28 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -87,4 +89,5 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_empty.metadata = {"url": "/customuri"} # type: ignore + get_empty.metadata = {'url': '/customuri'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py index a7ad56ef36b..2f0d3b169c3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py @@ -9,5 +9,5 @@ from ._paths_operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py index 05f2bebe9bf..7e3ea2bf54f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -93,21 +85,28 @@ def get_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,4 +117,5 @@ def get_empty( if cls: return cls(pipeline_response, None, {}) - get_empty.metadata = {"url": "/customuri"} # type: ignore + get_empty.metadata = {'url': '/customuri'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index c250c733c08..63bc16d691a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py index c7f066723a8..7ccca7d36f8 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_configuration.py index 94afe8e1aeb..1b42c417c2e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class AutoRestPagingTestServiceConfiguration(Configuration): +class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestPagingTestService. Note that all parameters used to create this instance are saved as instance diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py index fdc8a6b5375..c7f119acfb7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_configuration.py index 7fc60100893..56642917d39 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestPagingTestServiceConfiguration(Configuration): +class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestPagingTestService. Note that all parameters used to create this instance are saved as instance diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py index 3297f3a9504..a0108397a87 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -95,7 +94,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,7 +159,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -218,7 +225,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,7 +291,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -364,7 +379,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -439,7 +458,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -523,7 +546,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,7 +640,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -675,7 +706,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -737,7 +772,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -798,7 +837,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -859,7 +902,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -920,7 +967,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -992,7 +1043,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1071,7 +1126,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1113,7 +1172,11 @@ async def _get_multiple_pages_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1209,7 +1272,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1219,7 +1286,7 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1239,8 +1306,7 @@ def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return await get_next(next_link) + return await get_next(next_link) return AsyncItemPaged( internal_get_next, extract_data @@ -1256,8 +1322,7 @@ async def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncCustomPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncCustomPoller(self._client, raw_result, get_long_running_output, polling_method) begin_get_multiple_pages_lro.metadata = {'url': '/paging/multiple/lro'} # type: ignore @@ -1311,7 +1376,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py index 553e2a9e4f8..969a0eeffab 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -26,7 +25,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -621,7 +620,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -683,7 +686,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -745,7 +752,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -808,7 +819,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -893,7 +908,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -969,7 +988,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1054,7 +1077,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1145,7 +1172,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1208,7 +1239,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1271,7 +1306,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1333,7 +1372,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1395,7 +1438,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1457,7 +1504,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1530,7 +1581,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1610,7 +1665,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1653,7 +1712,11 @@ def _get_multiple_pages_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1750,7 +1813,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1760,7 +1827,7 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1780,8 +1847,7 @@ def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) return ItemPaged( internal_get_next, extract_data @@ -1797,8 +1863,7 @@ def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return CustomPoller(self._client, raw_result, get_long_running_output, polling_method) + return CustomPoller(self._client, raw_result, get_long_running_output, polling_method) begin_get_multiple_pages_lro.metadata = {'url': '/paging/multiple/lro'} # type: ignore @@ -1853,7 +1918,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/__init__.py index 7ce1af93032..cd76db4da70 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestPagingClient"] +__all__ = ['AutoRestParameterizedHostTestPagingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py index 5d4f04b8bc4..0d3d63f6abb 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py @@ -22,7 +22,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class AutoRestParameterizedHostTestPagingClient(object): """Test Infrastructure for AutoRest. @@ -38,7 +37,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - _base_url = "http://{accountName}{host}" + _base_url = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestPagingClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -48,6 +47,7 @@ def __init__( self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest @@ -73,7 +73,7 @@ def _send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_configuration.py index 398bc62fc82..dfa857c9279 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): +class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestPagingClient. Note that all parameters used to create this instance are saved as instance @@ -39,19 +39,20 @@ def __init__( raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestpagingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestpagingclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/__init__.py index fa406e9634b..d6de8164bf5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_paging_client import AutoRestParameterizedHostTestPagingClient - -__all__ = ["AutoRestParameterizedHostTestPagingClient"] +__all__ = ['AutoRestParameterizedHostTestPagingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py index 5747a4f798c..206a1b8e041 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py @@ -17,7 +17,6 @@ from ._configuration import AutoRestParameterizedHostTestPagingClientConfiguration from .operations import PagingOperations - class AutoRestParameterizedHostTestPagingClient: """Test Infrastructure for AutoRest. @@ -27,8 +26,12 @@ class AutoRestParameterizedHostTestPagingClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _base_url = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _base_url = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestPagingClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -38,7 +41,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -58,7 +66,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_configuration.py index 6e56dacdfc7..bb844c63f9e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): +class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestPagingClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestPagingClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestpagingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestpagingclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/__init__.py index 8e128dd3d8e..9a5b2005928 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._paging_operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py index 23e564fc4e7..165d72e7cbb 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,36 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models from ..._vendor import _convert_request -from ...operations._paging_operations import ( - build_get_pages_partial_url_operation_next_request, - build_get_pages_partial_url_operation_request, - build_get_pages_partial_url_request, -) - -T = TypeVar("T") +from ...operations._paging_operations import build_get_pages_partial_url_operation_next_request, build_get_pages_partial_url_operation_request, build_get_pages_partial_url_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PagingOperations: """PagingOperations async operations. @@ -58,7 +44,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace - def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_pages_partial_url( + self, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that combines custom url, paging and partial URL and expect to concat after host. @@ -69,38 +59,39 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterab :rtype: ~azure.core.async_paging.AsyncItemPaged[~custombaseurlpaging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_pages_partial_url_request( - template_url=self.get_pages_partial_url.metadata["url"], + template_url=self.get_pages_partial_url.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - + request = build_get_pages_partial_url_request( template_url=next_link, ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.method = "GET" return request @@ -115,7 +106,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,13 +119,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_pages_partial_url.metadata = {"url": "/paging/customurl/partialnextlink"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_pages_partial_url.metadata = {'url': '/paging/customurl/partialnextlink'} # type: ignore @distributed_trace def get_pages_partial_url_operation( - self, account_name: str, **kwargs: Any + self, + account_name: str, + **kwargs: Any ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that combines custom url, paging and partial URL with next operation. @@ -141,33 +140,34 @@ def get_pages_partial_url_operation( :rtype: ~azure.core.async_paging.AsyncItemPaged[~custombaseurlpaging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_pages_partial_url_operation_request( - template_url=self.get_pages_partial_url_operation.metadata["url"], + template_url=self.get_pages_partial_url_operation.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - + request = build_get_pages_partial_url_operation_next_request( next_link=next_link, - template_url="/paging/customurl/{nextLink}", + template_url='/paging/customurl/{nextLink}', ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) @@ -183,7 +183,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -192,6 +196,8 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_pages_partial_url_operation.metadata = {"url": "/paging/customurl/partialnextlinkop"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_pages_partial_url_operation.metadata = {'url': '/paging/customurl/partialnextlinkop'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py index c80c57072f9..71b6a02cf35 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py @@ -18,8 +18,8 @@ from ._models import ProductResult # type: ignore __all__ = [ - "Error", - "Product", - "ProductProperties", - "ProductResult", + 'Error', + 'Product', + 'ProductProperties', + 'ProductResult', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models.py index 090db82538d..fc48a7d21c7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models.py @@ -19,11 +19,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -31,8 +34,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class Product(msrest.serialization.Model): @@ -43,16 +46,19 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "properties": {"key": "properties", "type": "ProductProperties"}, + 'properties': {'key': 'properties', 'type': 'ProductProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword properties: :paramtype properties: ~custombaseurlpaging.models.ProductProperties """ super(Product, self).__init__(**kwargs) - self.properties = kwargs.get("properties", None) + self.properties = kwargs.get('properties', None) class ProductProperties(msrest.serialization.Model): @@ -65,11 +71,14 @@ class ProductProperties(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -77,8 +86,8 @@ def __init__(self, **kwargs): :paramtype name: str """ super(ProductProperties, self).__init__(**kwargs) - self.id = kwargs.get("id", None) - self.name = kwargs.get("name", None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) class ProductResult(msrest.serialization.Model): @@ -91,11 +100,14 @@ class ProductResult(msrest.serialization.Model): """ _attribute_map = { - "values": {"key": "values", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'values': {'key': 'values', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword values: :paramtype values: list[~custombaseurlpaging.models.Product] @@ -103,5 +115,5 @@ def __init__(self, **kwargs): :paramtype next_link: str """ super(ProductResult, self).__init__(**kwargs) - self.values = kwargs.get("values", None) - self.next_link = kwargs.get("next_link", None) + self.values = kwargs.get('values', None) + self.next_link = kwargs.get('next_link', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models_py3.py index 1b1807c880b..66122f57051 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_models_py3.py @@ -21,11 +21,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -45,10 +51,15 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "properties": {"key": "properties", "type": "ProductProperties"}, + 'properties': {'key': 'properties', 'type': 'ProductProperties'}, } - def __init__(self, *, properties: Optional["ProductProperties"] = None, **kwargs): + def __init__( + self, + *, + properties: Optional["ProductProperties"] = None, + **kwargs + ): """ :keyword properties: :paramtype properties: ~custombaseurlpaging.models.ProductProperties @@ -67,11 +78,17 @@ class ProductProperties(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, id: Optional[int] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -93,11 +110,17 @@ class ProductResult(msrest.serialization.Model): """ _attribute_map = { - "values": {"key": "values", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'values': {'key': 'values', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, values: Optional[List["Product"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + values: Optional[List["Product"]] = None, + next_link: Optional[str] = None, + **kwargs + ): """ :keyword values: :paramtype values: list[~custombaseurlpaging.models.Product] diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/__init__.py index 8e128dd3d8e..9a5b2005928 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/__init__.py @@ -9,5 +9,5 @@ from ._paging_operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py index abf6d27f657..0e60c4d3b2c 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -142,38 +134,39 @@ def get_pages_partial_url( :rtype: ~azure.core.paging.ItemPaged[~custombaseurlpaging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_pages_partial_url_request( - template_url=self.get_pages_partial_url.metadata["url"], + template_url=self.get_pages_partial_url.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - + request = build_get_pages_partial_url_request( template_url=next_link, ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.method = "GET" return request @@ -188,7 +181,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -197,9 +194,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_pages_partial_url.metadata = {"url": "/paging/customurl/partialnextlink"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_pages_partial_url.metadata = {'url': '/paging/customurl/partialnextlink'} # type: ignore @distributed_trace def get_pages_partial_url_operation( @@ -217,33 +216,34 @@ def get_pages_partial_url_operation( :rtype: ~azure.core.paging.ItemPaged[~custombaseurlpaging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_pages_partial_url_operation_request( - template_url=self.get_pages_partial_url_operation.metadata["url"], + template_url=self.get_pages_partial_url_operation.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - + request = build_get_pages_partial_url_operation_next_request( next_link=next_link, - template_url="/paging/customurl/{nextLink}", + template_url='/paging/customurl/{nextLink}', ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) @@ -259,7 +259,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,6 +272,8 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_pages_partial_url_operation.metadata = {"url": "/paging/customurl/partialnextlinkop"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_pages_partial_url_operation.metadata = {'url': '/paging/customurl/partialnextlinkop'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py index 8dd0ffbcbef..647deb3a8e6 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/__init__.py index 2a478ab434d..821fa23f191 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py index d38d3571914..21e2f7b4ebe 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py @@ -17,12 +17,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse - class AutoRestHeadTestService(object): """Test Infrastructure for AutoRest. @@ -50,6 +49,7 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/_configuration.py index bcd7be90add..90865b2a8a5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance @@ -42,24 +42,23 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/__init__.py index 6c3806fafee..c8c7dee1857 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_head_test_service import AutoRestHeadTestService - -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py index 0da13b90d7c..1860efcb607 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestHeadTestService: """Test Infrastructure for AutoRest. @@ -35,7 +34,10 @@ class AutoRestHeadTestService: """ def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + base_url: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -46,7 +48,12 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_configuration.py index 39324636276..2d2fa5415ae 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance @@ -29,27 +29,32 @@ class AutoRestHeadTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/__init__.py index 58d4a9d9543..ab55c6fdc9f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._http_success_operations import HttpSuccessOperations __all__ = [ - "HttpSuccessOperations", + 'HttpSuccessOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py index 26624cdc979..614687053ae 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpSuccessOperations: """HttpSuccessOperations async operations. @@ -48,7 +39,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head200(self, **kwargs: Any) -> bool: + async def head200( + self, + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -56,17 +50,24 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -77,10 +78,14 @@ async def head200(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def head204(self, **kwargs: Any) -> bool: + async def head204( + self, + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -88,17 +93,24 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -109,10 +121,14 @@ async def head204(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def head404(self, **kwargs: Any) -> bool: + async def head404( + self, + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -120,17 +136,24 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -141,4 +164,5 @@ async def head404(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/__init__.py index 58d4a9d9543..ab55c6fdc9f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/__init__.py @@ -9,5 +9,5 @@ from ._http_success_operations import HttpSuccessOperations __all__ = [ - "HttpSuccessOperations", + 'HttpSuccessOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py index b3721f84520..20ac9f413f2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -98,7 +90,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 200 status code if successful. @@ -108,17 +101,24 @@ def head200( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -129,11 +129,13 @@ def head200( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def head204( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 204 status code if successful. @@ -143,17 +145,24 @@ def head204( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -164,11 +173,13 @@ def head204( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def head404( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 404 status code if successful. @@ -178,17 +189,24 @@ def head404( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -199,4 +217,5 @@ def head404( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py b/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py index 131cedf730b..cd62e3d4daa 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/__init__.py index 6064aa40bfd..407776c5bac 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHeadExceptionTestService"] +__all__ = ['AutoRestHeadExceptionTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py index c9ffd741209..f098b64762d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py @@ -17,12 +17,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse - class AutoRestHeadExceptionTestService(object): """Test Infrastructure for AutoRest. @@ -50,6 +49,7 @@ def __init__( self._serialize.client_side_validation = False self.head_exception = HeadExceptionOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_configuration.py index b741cfdb349..b14312f9b59 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class AutoRestHeadExceptionTestServiceConfiguration(Configuration): +class AutoRestHeadExceptionTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadExceptionTestService. Note that all parameters used to create this instance are saved as instance @@ -42,24 +42,23 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadexceptiontestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadexceptiontestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/__init__.py index 828b2a86e01..7a28607d182 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_head_exception_test_service import AutoRestHeadExceptionTestService - -__all__ = ["AutoRestHeadExceptionTestService"] +__all__ = ['AutoRestHeadExceptionTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py index a9d744e67ac..a92d0293925 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestHeadExceptionTestService: """Test Infrastructure for AutoRest. @@ -35,7 +34,10 @@ class AutoRestHeadExceptionTestService: """ def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + base_url: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestHeadExceptionTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -46,7 +48,12 @@ def __init__( self._serialize.client_side_validation = False self.head_exception = HeadExceptionOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_configuration.py index ec5596c8202..b21528dab5f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestHeadExceptionTestServiceConfiguration(Configuration): +class AutoRestHeadExceptionTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadExceptionTestService. Note that all parameters used to create this instance are saved as instance @@ -29,27 +29,32 @@ class AutoRestHeadExceptionTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadExceptionTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadexceptiontestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadexceptiontestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/__init__.py index afa3dfba35b..1935f5267e4 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._head_exception_operations import HeadExceptionOperations __all__ = [ - "HeadExceptionOperations", + 'HeadExceptionOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py index 3e53419d50a..00bcb7db2a4 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ..._vendor import _convert_request from ...operations._head_exception_operations import build_head200_request, build_head204_request, build_head404_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HeadExceptionOperations: """HeadExceptionOperations async operations. @@ -48,7 +39,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head200(self, **kwargs: Any) -> bool: + async def head200( + self, + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -56,17 +50,24 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -77,10 +78,14 @@ async def head200(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def head204(self, **kwargs: Any) -> bool: + async def head204( + self, + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -88,17 +93,24 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -109,10 +121,14 @@ async def head204(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def head404(self, **kwargs: Any) -> bool: + async def head404( + self, + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -120,17 +136,24 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -141,4 +164,5 @@ async def head404(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/__init__.py index afa3dfba35b..1935f5267e4 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/__init__.py @@ -9,5 +9,5 @@ from ._head_exception_operations import HeadExceptionOperations __all__ = [ - "HeadExceptionOperations", + 'HeadExceptionOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py index af8a18fc957..7be017d45c5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -98,7 +90,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 200 status code if successful. @@ -108,17 +101,24 @@ def head200( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,11 +129,13 @@ def head200( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def head204( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 204 status code if successful. @@ -143,17 +145,24 @@ def head204( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -164,11 +173,13 @@ def head204( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def head404( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 404 status code if successful. @@ -178,17 +189,24 @@ def head404( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -199,4 +217,5 @@ def head404( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py index 70236538118..5914b6853f9 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/__init__.py index 2a478ab434d..821fa23f191 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py index 8060d160646..71fef2c0b7e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py @@ -17,12 +17,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse - class AutoRestHeadTestService(object): """Test Infrastructure for AutoRest. @@ -50,6 +49,7 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_configuration.py index e8c3ad914f3..ca505a8938b 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import AzureKeyCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance @@ -42,21 +42,22 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, "Authorization", **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/__init__.py index 6c3806fafee..c8c7dee1857 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_head_test_service import AutoRestHeadTestService - -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py index c659000aef4..d2cbec43daf 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.credentials import AzureKeyCredential from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,7 +21,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestHeadTestService: """Test Infrastructure for AutoRest. @@ -33,7 +32,12 @@ class AutoRestHeadTestService: :type base_url: str """ - def __init__(self, credential: AzureKeyCredential, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + credential: AzureKeyCredential, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -43,7 +47,12 @@ def __init__(self, credential: AzureKeyCredential, base_url: str = "http://local self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_configuration.py index 1dc96b9adbb..6848942e8d0 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_configuration.py @@ -16,7 +16,7 @@ from .._version import VERSION -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,31 @@ class AutoRestHeadTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials.AzureKeyCredential """ - def __init__(self, credential: AzureKeyCredential, **kwargs: Any) -> None: + def __init__( + self, + credential: AzureKeyCredential, + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, "Authorization", **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/__init__.py index 58d4a9d9543..ab55c6fdc9f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._http_success_operations import HttpSuccessOperations __all__ = [ - "HttpSuccessOperations", + 'HttpSuccessOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py index 26624cdc979..614687053ae 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpSuccessOperations: """HttpSuccessOperations async operations. @@ -48,7 +39,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head200(self, **kwargs: Any) -> bool: + async def head200( + self, + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -56,17 +50,24 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -77,10 +78,14 @@ async def head200(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def head204(self, **kwargs: Any) -> bool: + async def head204( + self, + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -88,17 +93,24 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -109,10 +121,14 @@ async def head204(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def head404(self, **kwargs: Any) -> bool: + async def head404( + self, + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -120,17 +136,24 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -141,4 +164,5 @@ async def head404(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/__init__.py index 58d4a9d9543..ab55c6fdc9f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/__init__.py @@ -9,5 +9,5 @@ from ._http_success_operations import HttpSuccessOperations __all__ = [ - "HttpSuccessOperations", + 'HttpSuccessOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py index b3721f84520..20ac9f413f2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -98,7 +90,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 200 status code if successful. @@ -108,17 +101,24 @@ def head200( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 404]: @@ -129,11 +129,13 @@ def head200( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def head204( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 204 status code if successful. @@ -143,17 +145,24 @@ def head204( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -164,11 +173,13 @@ def head204( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def head404( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 404 status code if successful. @@ -178,17 +189,24 @@ def head404( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -199,4 +217,5 @@ def head404( return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py index 131cedf730b..cd62e3d4daa 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/__init__.py index 7ece5ec6c91..fa45fce0e43 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestLongRunningOperationTestService"] +__all__ = ['AutoRestLongRunningOperationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py index bb96b36e2aa..351244bead5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py @@ -18,12 +18,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse - class AutoRestLongRunningOperationTestService(object): """Long-running Operation for AutoRest. @@ -60,9 +59,8 @@ def __init__( self.lros = LROsOperations(self._client, self._config, self._serialize, self._deserialize) self.lro_retrys = LRORetrysOperations(self._client, self._config, self._serialize, self._deserialize) self.lrosads = LROSADsOperations(self._client, self._config, self._serialize, self._deserialize) - self.lr_os_custom_header = LROsCustomHeaderOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.lr_os_custom_header = LROsCustomHeaderOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_configuration.py index 477e4e43927..2936c7889b4 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): +class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestLongRunningOperationTestService. Note that all parameters used to create this instance are saved as instance @@ -42,24 +42,23 @@ def __init__( raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestlongrunningoperationtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestlongrunningoperationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/__init__.py index 059561b117f..662ae8ef026 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_long_running_operation_test_service import AutoRestLongRunningOperationTestService - -__all__ = ["AutoRestLongRunningOperationTestService"] +__all__ = ['AutoRestLongRunningOperationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py index b8a74c73c1f..3631ce121aa 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential - class AutoRestLongRunningOperationTestService: """Long-running Operation for AutoRest. @@ -42,7 +41,10 @@ class AutoRestLongRunningOperationTestService: """ def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + base_url: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestLongRunningOperationTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -54,11 +56,14 @@ def __init__( self.lros = LROsOperations(self._client, self._config, self._serialize, self._deserialize) self.lro_retrys = LRORetrysOperations(self._client, self._config, self._serialize, self._deserialize) self.lrosads = LROSADsOperations(self._client, self._config, self._serialize, self._deserialize) - self.lr_os_custom_header = LROsCustomHeaderOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.lr_os_custom_header = LROsCustomHeaderOperations(self._client, self._config, self._serialize, self._deserialize) + - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_configuration.py index 1fc0cf77ca3..d4d5e011886 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): +class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestLongRunningOperationTestService. Note that all parameters used to create this instance are saved as instance @@ -29,27 +29,32 @@ class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestLongRunningOperationTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestlongrunningoperationtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestlongrunningoperationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/__init__.py index 234d447ace7..6e8646cae89 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/__init__.py @@ -12,8 +12,8 @@ from ._lr_os_custom_header_operations import LROsCustomHeaderOperations __all__ = [ - "LROsOperations", - "LRORetrysOperations", - "LROSADsOperations", - "LROsCustomHeaderOperations", + 'LROsOperations', + 'LRORetrysOperations', + 'LROSADsOperations', + 'LROsCustomHeaderOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py index 240304f465d..57d66c03e23 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -26,17 +19,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._lr_os_custom_header_operations import ( - build_post202_retry200_request_initial, - build_post_async_retry_succeeded_request_initial, - build_put201_creating_succeeded200_request_initial, - build_put_async_retry_succeeded_request_initial, -) - -T = TypeVar("T") +from ...operations._lr_os_custom_header_operations import build_post202_retry200_request_initial, build_post_async_retry_succeeded_request_initial, build_put201_creating_succeeded200_request_initial, build_put_async_retry_succeeded_request_initial +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class LROsCustomHeaderOperations: """LROsCustomHeaderOperations async operations. @@ -60,28 +46,36 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config async def _put_async_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,24 +83,25 @@ async def _put_async_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_retry_succeeded_initial.metadata = {"url": "/lro/customheader/putasync/retry/succeeded"} # type: ignore + _put_async_retry_succeeded_initial.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore + @distributed_trace_async async def begin_put_async_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an @@ -128,72 +123,81 @@ async def begin_put_async_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_retry_succeeded.metadata = {"url": "/lro/customheader/putasync/retry/succeeded"} # type: ignore + begin_put_async_retry_succeeded.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore async def _put201_creating_succeeded200_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_succeeded200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_succeeded200_initial.metadata["url"], + template_url=self._put201_creating_succeeded200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -201,21 +205,24 @@ async def _put201_creating_succeeded200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_succeeded200_initial.metadata = {"url": "/lro/customheader/put/201/creating/succeeded/200"} # type: ignore + _put201_creating_succeeded200_initial.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore + @distributed_trace_async async def begin_put201_creating_succeeded200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an @@ -237,63 +244,76 @@ async def begin_put201_creating_succeeded200( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_succeeded200.metadata = {"url": "/lro/customheader/put/201/creating/succeeded/200"} # type: ignore + begin_put201_creating_succeeded200.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore - async def _post202_retry200_initial(self, product: Optional["_models.Product"] = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post202_retry200_initial( + self, + product: Optional["_models.Product"] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry200_initial.metadata["url"], + template_url=self._post202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -301,17 +321,21 @@ async def _post202_retry200_initial(self, product: Optional["_models.Product"] = raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry200_initial.metadata = {"url": "/lro/customheader/post/202/retry/200"} # type: ignore + _post202_retry200_initial.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore + @distributed_trace_async async def begin_post202_retry200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with @@ -331,62 +355,73 @@ async def begin_post202_retry200( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry200.metadata = {"url": "/lro/customheader/post/202/retry/200"} # type: ignore + begin_post202_retry200.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore async def _post_async_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -394,20 +429,22 @@ async def _post_async_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_retry_succeeded_initial.metadata = {"url": "/lro/customheader/postasync/retry/succeeded"} # type: ignore + _post_async_retry_succeeded_initial.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore + @distributed_trace_async async def begin_post_async_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an @@ -428,35 +465,38 @@ async def begin_post_async_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retry_succeeded.metadata = {"url": "/lro/customheader/postasync/retry/succeeded"} # type: ignore + begin_post_async_retry_succeeded.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py index 72b4b1f5445..f9cfcba9ee7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -26,20 +19,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._lro_retrys_operations import ( - build_delete202_retry200_request_initial, - build_delete_async_relative_retry_succeeded_request_initial, - build_delete_provisioning202_accepted200_succeeded_request_initial, - build_post202_retry200_request_initial, - build_post_async_relative_retry_succeeded_request_initial, - build_put201_creating_succeeded200_request_initial, - build_put_async_relative_retry_succeeded_request_initial, -) - -T = TypeVar("T") +from ...operations._lro_retrys_operations import build_delete202_retry200_request_initial, build_delete_async_relative_retry_succeeded_request_initial, build_delete_provisioning202_accepted200_succeeded_request_initial, build_post202_retry200_request_initial, build_post_async_relative_retry_succeeded_request_initial, build_put201_creating_succeeded200_request_initial, build_put_async_relative_retry_succeeded_request_initial +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class LRORetrysOperations: """LRORetrysOperations async operations. @@ -63,28 +46,36 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config async def _put201_creating_succeeded200_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_succeeded200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_succeeded200_initial.metadata["url"], + template_url=self._put201_creating_succeeded200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -92,21 +83,24 @@ async def _put201_creating_succeeded200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_succeeded200_initial.metadata = {"url": "/lro/retryerror/put/201/creating/succeeded/200"} # type: ignore + _put201_creating_succeeded200_initial.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore + @distributed_trace_async async def begin_put201_creating_succeeded200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -127,65 +121,76 @@ async def begin_put201_creating_succeeded200( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_succeeded200.metadata = {"url": "/lro/retryerror/put/201/creating/succeeded/200"} # type: ignore + begin_put201_creating_succeeded200.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore async def _put_async_relative_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_relative_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -193,24 +198,25 @@ async def _put_async_relative_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_succeeded_initial.metadata = {"url": "/lro/retryerror/putasync/retry/succeeded"} # type: ignore + _put_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore + @distributed_trace_async async def begin_put_async_relative_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -231,61 +237,72 @@ async def begin_put_async_relative_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/putasync/retry/succeeded"} # type: ignore + begin_put_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore - async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_provisioning202_accepted200_succeeded_initial( + self, + **kwargs: Any + ) -> "_models.Product": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_accepted200_succeeded_request_initial( - template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata["url"], + template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -294,24 +311,26 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_accepted200_succeeded_initial.metadata = {"url": "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + _delete_provisioning202_accepted200_succeeded_initial.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore + @distributed_trace_async async def begin_delete_provisioning202_accepted200_succeeded( - self, **kwargs: Any + self, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll @@ -330,53 +349,64 @@ async def begin_delete_provisioning202_accepted200_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_accepted200_succeeded.metadata = {"url": "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore - async def _delete202_retry200_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete202_retry200_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_retry200_request_initial( - template_url=self._delete202_retry200_initial.metadata["url"], + template_url=self._delete202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -384,16 +414,21 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete202_retry200_initial.metadata = {"url": "/lro/retryerror/delete/202/retry/200"} # type: ignore + _delete202_retry200_initial.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore + @distributed_trace_async - async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete202_retry200( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -409,48 +444,61 @@ async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[None]: :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_retry200.metadata = {"url": "/lro/retryerror/delete/202/retry/200"} # type: ignore + begin_delete202_retry200.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore - async def _delete_async_relative_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_relative_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_succeeded_request_initial( - template_url=self._delete_async_relative_retry_succeeded_initial.metadata["url"], + template_url=self._delete_async_relative_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -458,19 +506,22 @@ async def _delete_async_relative_retry_succeeded_initial(self, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_succeeded_initial.metadata = {"url": "/lro/retryerror/deleteasync/retry/succeeded"} # type: ignore + _delete_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore + @distributed_trace_async - async def begin_delete_async_relative_retry_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -486,57 +537,70 @@ async def begin_delete_async_relative_retry_succeeded(self, **kwargs: Any) -> As :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/deleteasync/retry/succeeded"} # type: ignore + begin_delete_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore - async def _post202_retry200_initial(self, product: Optional["_models.Product"] = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post202_retry200_initial( + self, + product: Optional["_models.Product"] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry200_initial.metadata["url"], + template_url=self._post202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -544,17 +608,21 @@ async def _post202_retry200_initial(self, product: Optional["_models.Product"] = raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry200_initial.metadata = {"url": "/lro/retryerror/post/202/retry/200"} # type: ignore + _post202_retry200_initial.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore + @distributed_trace_async async def begin_post202_retry200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -573,62 +641,73 @@ async def begin_post202_retry200( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry200.metadata = {"url": "/lro/retryerror/post/202/retry/200"} # type: ignore + begin_post202_retry200.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore async def _post_async_relative_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_relative_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -636,20 +715,22 @@ async def _post_async_relative_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_succeeded_initial.metadata = {"url": "/lro/retryerror/postasync/retry/succeeded"} # type: ignore + _post_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore + @distributed_trace_async async def begin_post_async_relative_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -669,35 +750,38 @@ async def begin_post_async_relative_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/postasync/retry/succeeded"} # type: ignore + begin_post_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py index dfcccd521bd..b716bdea202 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -26,58 +19,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._lros_operations import ( - build_delete202_no_retry204_request_initial, - build_delete202_retry200_request_initial, - build_delete204_succeeded_request_initial, - build_delete_async_no_header_in_retry_request_initial, - build_delete_async_no_retry_succeeded_request_initial, - build_delete_async_retry_failed_request_initial, - build_delete_async_retry_succeeded_request_initial, - build_delete_async_retrycanceled_request_initial, - build_delete_no_header_in_retry_request_initial, - build_delete_provisioning202_accepted200_succeeded_request_initial, - build_delete_provisioning202_deleting_failed200_request_initial, - build_delete_provisioning202_deletingcanceled200_request_initial, - build_patch200_succeeded_ignore_headers_request_initial, - build_patch201_retry_with_async_header_request_initial, - build_patch202_retry_with_async_and_location_header_request_initial, - build_post200_with_payload_request_initial, - build_post202_list_request_initial, - build_post202_no_retry204_request_initial, - build_post202_retry200_request_initial, - build_post_async_no_retry_succeeded_request_initial, - build_post_async_retry_failed_request_initial, - build_post_async_retry_succeeded_request_initial, - build_post_async_retrycanceled_request_initial, - build_post_double_headers_final_azure_header_get_default_request_initial, - build_post_double_headers_final_azure_header_get_request_initial, - build_post_double_headers_final_location_get_request_initial, - build_put200_acceptedcanceled200_request_initial, - build_put200_succeeded_no_state_request_initial, - build_put200_succeeded_request_initial, - build_put200_updating_succeeded204_request_initial, - build_put201_creating_failed200_request_initial, - build_put201_creating_succeeded200_request_initial, - build_put201_succeeded_request_initial, - build_put202_retry200_request_initial, - build_put_async_no_header_in_retry_request_initial, - build_put_async_no_retry_succeeded_request_initial, - build_put_async_no_retrycanceled_request_initial, - build_put_async_non_resource_request_initial, - build_put_async_retry_failed_request_initial, - build_put_async_retry_succeeded_request_initial, - build_put_async_sub_resource_request_initial, - build_put_no_header_in_retry_request_initial, - build_put_non_resource_request_initial, - build_put_sub_resource_request_initial, -) - -T = TypeVar("T") +from ...operations._lros_operations import build_delete202_no_retry204_request_initial, build_delete202_retry200_request_initial, build_delete204_succeeded_request_initial, build_delete_async_no_header_in_retry_request_initial, build_delete_async_no_retry_succeeded_request_initial, build_delete_async_retry_failed_request_initial, build_delete_async_retry_succeeded_request_initial, build_delete_async_retrycanceled_request_initial, build_delete_no_header_in_retry_request_initial, build_delete_provisioning202_accepted200_succeeded_request_initial, build_delete_provisioning202_deleting_failed200_request_initial, build_delete_provisioning202_deletingcanceled200_request_initial, build_patch200_succeeded_ignore_headers_request_initial, build_patch201_retry_with_async_header_request_initial, build_patch202_retry_with_async_and_location_header_request_initial, build_post200_with_payload_request_initial, build_post202_list_request_initial, build_post202_no_retry204_request_initial, build_post202_retry200_request_initial, build_post_async_no_retry_succeeded_request_initial, build_post_async_retry_failed_request_initial, build_post_async_retry_succeeded_request_initial, build_post_async_retrycanceled_request_initial, build_post_double_headers_final_azure_header_get_default_request_initial, build_post_double_headers_final_azure_header_get_request_initial, build_post_double_headers_final_location_get_request_initial, build_put200_acceptedcanceled200_request_initial, build_put200_succeeded_no_state_request_initial, build_put200_succeeded_request_initial, build_put200_updating_succeeded204_request_initial, build_put201_creating_failed200_request_initial, build_put201_creating_succeeded200_request_initial, build_put201_succeeded_request_initial, build_put202_retry200_request_initial, build_put_async_no_header_in_retry_request_initial, build_put_async_no_retry_succeeded_request_initial, build_put_async_no_retrycanceled_request_initial, build_put_async_non_resource_request_initial, build_put_async_retry_failed_request_initial, build_put_async_retry_succeeded_request_initial, build_put_async_sub_resource_request_initial, build_put_no_header_in_retry_request_initial, build_put_non_resource_request_initial, build_put_sub_resource_request_initial +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class LROsOperations: +class LROsOperations: # pylint: disable=too-many-public-methods """LROsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -100,28 +46,36 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config async def _put200_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> Optional["_models.Product"]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put200_succeeded_initial.metadata["url"], + template_url=self._put200_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -130,18 +84,21 @@ async def _put200_succeeded_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_succeeded_initial.metadata = {"url": "/lro/put/200/succeeded"} # type: ignore + _put200_succeeded_initial.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore + @distributed_trace_async async def begin_put200_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -161,65 +118,76 @@ async def begin_put200_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_succeeded.metadata = {"url": "/lro/put/200/succeeded"} # type: ignore + begin_put200_succeeded.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore async def _patch200_succeeded_ignore_headers_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_patch200_succeeded_ignore_headers_request_initial( content_type=content_type, json=_json, - template_url=self._patch200_succeeded_ignore_headers_initial.metadata["url"], + template_url=self._patch200_succeeded_ignore_headers_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,22 +195,23 @@ async def _patch200_succeeded_ignore_headers_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _patch200_succeeded_ignore_headers_initial.metadata = {"url": "/lro/patch/200/succeeded/ignoreheaders"} # type: ignore + _patch200_succeeded_ignore_headers_initial.metadata = {'url': '/lro/patch/200/succeeded/ignoreheaders'} # type: ignore + @distributed_trace_async async def begin_patch200_succeeded_ignore_headers( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -262,70 +231,79 @@ async def begin_patch200_succeeded_ignore_headers( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._patch200_succeeded_ignore_headers_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch200_succeeded_ignore_headers.metadata = {"url": "/lro/patch/200/succeeded/ignoreheaders"} # type: ignore + begin_patch200_succeeded_ignore_headers.metadata = {'url': '/lro/patch/200/succeeded/ignoreheaders'} # type: ignore async def _patch201_retry_with_async_header_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_patch201_retry_with_async_header_request_initial( content_type=content_type, json=_json, - template_url=self._patch201_retry_with_async_header_initial.metadata["url"], + template_url=self._patch201_retry_with_async_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -334,25 +312,26 @@ async def _patch201_retry_with_async_header_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _patch201_retry_with_async_header_initial.metadata = {"url": "/lro/patch/201/retry/onlyAsyncHeader"} # type: ignore + _patch201_retry_with_async_header_initial.metadata = {'url': '/lro/patch/201/retry/onlyAsyncHeader'} # type: ignore + @distributed_trace_async async def begin_patch201_retry_with_async_header( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running patch request, service returns a 201 to the initial request with async header. @@ -371,67 +350,76 @@ async def begin_patch201_retry_with_async_header( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._patch201_retry_with_async_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling( - lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs - ) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch201_retry_with_async_header.metadata = {"url": "/lro/patch/201/retry/onlyAsyncHeader"} # type: ignore + begin_patch201_retry_with_async_header.metadata = {'url': '/lro/patch/201/retry/onlyAsyncHeader'} # type: ignore async def _patch202_retry_with_async_and_location_header_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_patch202_retry_with_async_and_location_header_request_initial( content_type=content_type, json=_json, - template_url=self._patch202_retry_with_async_and_location_header_initial.metadata["url"], + template_url=self._patch202_retry_with_async_and_location_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -440,26 +428,27 @@ async def _patch202_retry_with_async_and_location_header_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _patch202_retry_with_async_and_location_header_initial.metadata = {"url": "/lro/patch/202/retry/asyncAndLocationHeader"} # type: ignore + _patch202_retry_with_async_and_location_header_initial.metadata = {'url': '/lro/patch/202/retry/asyncAndLocationHeader'} # type: ignore + @distributed_trace_async async def begin_patch202_retry_with_async_and_location_header( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running patch request, service returns a 202 to the initial request with async and location header. @@ -479,83 +468,97 @@ async def begin_patch202_retry_with_async_and_location_header( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._patch202_retry_with_async_and_location_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch202_retry_with_async_and_location_header.metadata = {"url": "/lro/patch/202/retry/asyncAndLocationHeader"} # type: ignore + begin_patch202_retry_with_async_and_location_header.metadata = {'url': '/lro/patch/202/retry/asyncAndLocationHeader'} # type: ignore async def _put201_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put201_succeeded_initial.metadata["url"], + template_url=self._put201_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_succeeded_initial.metadata = {"url": "/lro/put/201/succeeded"} # type: ignore + _put201_succeeded_initial.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore + @distributed_trace_async async def begin_put201_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -575,54 +578,67 @@ async def begin_put201_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_succeeded.metadata = {"url": "/lro/put/201/succeeded"} # type: ignore + begin_put201_succeeded.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore - async def _post202_list_initial(self, **kwargs: Any) -> Optional[List["_models.Product"]]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List["_models.Product"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post202_list_initial( + self, + **kwargs: Any + ) -> Optional[List["_models.Product"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.Product"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post202_list_request_initial( - template_url=self._post202_list_initial.metadata["url"], + template_url=self._post202_list_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -632,23 +648,26 @@ async def _post202_list_initial(self, **kwargs: Any) -> Optional[List["_models.P deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post202_list_initial.metadata = {"url": "/lro/list"} # type: ignore + _post202_list_initial.metadata = {'url': '/lro/list'} # type: ignore + @distributed_trace_async - async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List["_models.Product"]]: + async def begin_post202_list( + self, + **kwargs: Any + ) -> AsyncLROPoller[List["_models.Product"]]: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -665,80 +684,94 @@ async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List["_model :rtype: ~azure.core.polling.AsyncLROPoller[list[~lro.models.Product]] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post202_list_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post202_list_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_list.metadata = {"url": "/lro/list"} # type: ignore + begin_post202_list.metadata = {'url': '/lro/list'} # type: ignore async def _put200_succeeded_no_state_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_succeeded_no_state_request_initial( content_type=content_type, json=_json, - template_url=self._put200_succeeded_no_state_initial.metadata["url"], + template_url=self._put200_succeeded_no_state_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_succeeded_no_state_initial.metadata = {"url": "/lro/put/200/succeeded/nostate"} # type: ignore + _put200_succeeded_no_state_initial.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore + @distributed_trace_async async def begin_put200_succeeded_no_state( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -758,83 +791,97 @@ async def begin_put200_succeeded_no_state( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_succeeded_no_state_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_succeeded_no_state.metadata = {"url": "/lro/put/200/succeeded/nostate"} # type: ignore + begin_put200_succeeded_no_state.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore async def _put202_retry200_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._put202_retry200_initial.metadata["url"], + template_url=self._put202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put202_retry200_initial.metadata = {"url": "/lro/put/202/retry/200"} # type: ignore + _put202_retry200_initial.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore + @distributed_trace_async async def begin_put202_retry200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains @@ -855,65 +902,76 @@ async def begin_put202_retry200( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put202_retry200.metadata = {"url": "/lro/put/202/retry/200"} # type: ignore + begin_put202_retry200.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore async def _put201_creating_succeeded200_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_succeeded200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_succeeded200_initial.metadata["url"], + template_url=self._put201_creating_succeeded200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -921,21 +979,24 @@ async def _put201_creating_succeeded200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_succeeded200_initial.metadata = {"url": "/lro/put/201/creating/succeeded/200"} # type: ignore + _put201_creating_succeeded200_initial.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore + @distributed_trace_async async def begin_put201_creating_succeeded200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a @@ -956,83 +1017,97 @@ async def begin_put201_creating_succeeded200( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_succeeded200.metadata = {"url": "/lro/put/201/creating/succeeded/200"} # type: ignore + begin_put201_creating_succeeded200.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore async def _put200_updating_succeeded204_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_updating_succeeded204_request_initial( content_type=content_type, json=_json, - template_url=self._put200_updating_succeeded204_initial.metadata["url"], + template_url=self._put200_updating_succeeded204_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_updating_succeeded204_initial.metadata = {"url": "/lro/put/200/updating/succeeded/200"} # type: ignore + _put200_updating_succeeded204_initial.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore + @distributed_trace_async async def begin_put200_updating_succeeded204( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a @@ -1053,65 +1128,76 @@ async def begin_put200_updating_succeeded204( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_updating_succeeded204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_updating_succeeded204.metadata = {"url": "/lro/put/200/updating/succeeded/200"} # type: ignore + begin_put200_updating_succeeded204.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore async def _put201_creating_failed200_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_failed200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_failed200_initial.metadata["url"], + template_url=self._put201_creating_failed200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1119,21 +1205,24 @@ async def _put201_creating_failed200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_failed200_initial.metadata = {"url": "/lro/put/201/created/failed/200"} # type: ignore + _put201_creating_failed200_initial.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore + @distributed_trace_async async def begin_put201_creating_failed200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a @@ -1154,83 +1243,97 @@ async def begin_put201_creating_failed200( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_failed200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_failed200.metadata = {"url": "/lro/put/201/created/failed/200"} # type: ignore + begin_put201_creating_failed200.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore async def _put200_acceptedcanceled200_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_acceptedcanceled200_request_initial( content_type=content_type, json=_json, - template_url=self._put200_acceptedcanceled200_initial.metadata["url"], + template_url=self._put200_acceptedcanceled200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_acceptedcanceled200_initial.metadata = {"url": "/lro/put/200/accepted/canceled/200"} # type: ignore + _put200_acceptedcanceled200_initial.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore + @distributed_trace_async async def begin_put200_acceptedcanceled200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a @@ -1251,65 +1354,76 @@ async def begin_put200_acceptedcanceled200( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_acceptedcanceled200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_acceptedcanceled200.metadata = {"url": "/lro/put/200/accepted/canceled/200"} # type: ignore + begin_put200_acceptedcanceled200.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore async def _put_no_header_in_retry_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_no_header_in_retry_request_initial( content_type=content_type, json=_json, - template_url=self._put_no_header_in_retry_initial.metadata["url"], + template_url=self._put_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1317,20 +1431,23 @@ async def _put_no_header_in_retry_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers['location']=self._deserialize('str', response.headers.get('location')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_no_header_in_retry_initial.metadata = {"url": "/lro/put/noheader/202/200"} # type: ignore + _put_no_header_in_retry_initial.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore + @distributed_trace_async async def begin_put_no_header_in_retry( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -1350,68 +1467,79 @@ async def begin_put_no_header_in_retry( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_no_header_in_retry.metadata = {"url": "/lro/put/noheader/202/200"} # type: ignore + begin_put_no_header_in_retry.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore async def _put_async_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1419,24 +1547,25 @@ async def _put_async_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_retry_succeeded_initial.metadata = {"url": "/lro/putasync/retry/succeeded"} # type: ignore + _put_async_retry_succeeded_initial.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore + @distributed_trace_async async def begin_put_async_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1457,72 +1586,81 @@ async def begin_put_async_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_retry_succeeded.metadata = {"url": "/lro/putasync/retry/succeeded"} # type: ignore + begin_put_async_retry_succeeded.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore async def _put_async_no_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_no_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_no_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_no_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1530,23 +1668,24 @@ async def _put_async_no_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_no_retry_succeeded_initial.metadata = {"url": "/lro/putasync/noretry/succeeded"} # type: ignore + _put_async_no_retry_succeeded_initial.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore + @distributed_trace_async async def begin_put_async_no_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1567,71 +1706,80 @@ async def begin_put_async_no_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_no_retry_succeeded.metadata = {"url": "/lro/putasync/noretry/succeeded"} # type: ignore + begin_put_async_no_retry_succeeded.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore async def _put_async_retry_failed_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_retry_failed_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_retry_failed_initial.metadata["url"], + template_url=self._put_async_retry_failed_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1639,24 +1787,25 @@ async def _put_async_retry_failed_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_retry_failed_initial.metadata = {"url": "/lro/putasync/retry/failed"} # type: ignore + _put_async_retry_failed_initial.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore + @distributed_trace_async async def begin_put_async_retry_failed( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1677,72 +1826,81 @@ async def begin_put_async_retry_failed( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_retry_failed.metadata = {"url": "/lro/putasync/retry/failed"} # type: ignore + begin_put_async_retry_failed.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore async def _put_async_no_retrycanceled_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_no_retrycanceled_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_no_retrycanceled_initial.metadata["url"], + template_url=self._put_async_no_retrycanceled_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1750,23 +1908,24 @@ async def _put_async_no_retrycanceled_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_no_retrycanceled_initial.metadata = {"url": "/lro/putasync/noretry/canceled"} # type: ignore + _put_async_no_retrycanceled_initial.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore + @distributed_trace_async async def begin_put_async_no_retrycanceled( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1787,71 +1946,80 @@ async def begin_put_async_no_retrycanceled( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_no_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_no_retrycanceled.metadata = {"url": "/lro/putasync/noretry/canceled"} # type: ignore + begin_put_async_no_retrycanceled.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore async def _put_async_no_header_in_retry_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_no_header_in_retry_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_no_header_in_retry_initial.metadata["url"], + template_url=self._put_async_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1859,22 +2027,23 @@ async def _put_async_no_header_in_retry_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_no_header_in_retry_initial.metadata = {"url": "/lro/putasync/noheader/201/200"} # type: ignore + _put_async_no_header_in_retry_initial.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore + @distributed_trace_async async def begin_put_async_no_header_in_retry( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain @@ -1895,86 +2064,100 @@ async def begin_put_async_no_header_in_retry( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_no_header_in_retry.metadata = {"url": "/lro/putasync/noheader/201/200"} # type: ignore + begin_put_async_no_header_in_retry.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore - async def _put_non_resource_initial(self, sku: Optional["_models.Sku"] = None, **kwargs: Any) -> "_models.Sku": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _put_non_resource_initial( + self, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> "_models.Sku": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: - _json = self._serialize.body(sku, "Sku") + _json = self._serialize.body(sku, 'Sku') else: _json = None request = build_put_non_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_resource_initial.metadata["url"], + template_url=self._put_non_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_resource_initial.metadata = {"url": "/lro/putnonresource/202/200"} # type: ignore + _put_non_resource_initial.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore + @distributed_trace_async async def begin_put_non_resource( - self, sku: Optional["_models.Sku"] = None, **kwargs: Any + self, + sku: Optional["_models.Sku"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Sku"]: """Long running put request with non resource. @@ -1992,83 +2175,97 @@ async def begin_put_non_resource( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_resource.metadata = {"url": "/lro/putnonresource/202/200"} # type: ignore + begin_put_non_resource.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore async def _put_async_non_resource_initial( - self, sku: Optional["_models.Sku"] = None, **kwargs: Any + self, + sku: Optional["_models.Sku"] = None, + **kwargs: Any ) -> "_models.Sku": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: - _json = self._serialize.body(sku, "Sku") + _json = self._serialize.body(sku, 'Sku') else: _json = None request = build_put_async_non_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_non_resource_initial.metadata["url"], + template_url=self._put_async_non_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_async_non_resource_initial.metadata = {"url": "/lro/putnonresourceasync/202/200"} # type: ignore + _put_async_non_resource_initial.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore + @distributed_trace_async async def begin_put_async_non_resource( - self, sku: Optional["_models.Sku"] = None, **kwargs: Any + self, + sku: Optional["_models.Sku"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Sku"]: """Long running put request with non resource. @@ -2086,84 +2283,98 @@ async def begin_put_async_non_resource( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_non_resource.metadata = {"url": "/lro/putnonresourceasync/202/200"} # type: ignore + begin_put_async_non_resource.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore async def _put_sub_resource_initial( - self, provisioning_state: Optional[str] = None, **kwargs: Any + self, + provisioning_state: Optional[str] = None, + **kwargs: Any ) -> "_models.SubProduct": - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _product = _models.SubProduct(provisioning_state=provisioning_state) if _product is not None: - _json = self._serialize.body(_product, "SubProduct") + _json = self._serialize.body(_product, 'SubProduct') else: _json = None request = build_put_sub_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_sub_resource_initial.metadata["url"], + template_url=self._put_sub_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_sub_resource_initial.metadata = {"url": "/lro/putsubresource/202/200"} # type: ignore + _put_sub_resource_initial.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore + @distributed_trace_async async def begin_put_sub_resource( - self, provisioning_state: Optional[str] = None, **kwargs: Any + self, + provisioning_state: Optional[str] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.SubProduct"]: """Long running put request with sub resource. @@ -2182,84 +2393,98 @@ async def begin_put_sub_resource( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.SubProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_sub_resource_initial( - provisioning_state=provisioning_state, content_type=content_type, cls=lambda x, y, z: x, **kwargs + provisioning_state=provisioning_state, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_sub_resource.metadata = {"url": "/lro/putsubresource/202/200"} # type: ignore + begin_put_sub_resource.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore async def _put_async_sub_resource_initial( - self, provisioning_state: Optional[str] = None, **kwargs: Any + self, + provisioning_state: Optional[str] = None, + **kwargs: Any ) -> "_models.SubProduct": - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _product = _models.SubProduct(provisioning_state=provisioning_state) if _product is not None: - _json = self._serialize.body(_product, "SubProduct") + _json = self._serialize.body(_product, 'SubProduct') else: _json = None request = build_put_async_sub_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_sub_resource_initial.metadata["url"], + template_url=self._put_async_sub_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_async_sub_resource_initial.metadata = {"url": "/lro/putsubresourceasync/202/200"} # type: ignore + _put_async_sub_resource_initial.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore + @distributed_trace_async async def begin_put_async_sub_resource( - self, provisioning_state: Optional[str] = None, **kwargs: Any + self, + provisioning_state: Optional[str] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.SubProduct"]: """Long running put request with sub resource. @@ -2278,54 +2503,67 @@ async def begin_put_async_sub_resource( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.SubProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_sub_resource_initial( - provisioning_state=provisioning_state, content_type=content_type, cls=lambda x, y, z: x, **kwargs + provisioning_state=provisioning_state, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_sub_resource.metadata = {"url": "/lro/putsubresourceasync/202/200"} # type: ignore + begin_put_async_sub_resource.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore - async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_provisioning202_accepted200_succeeded_initial( + self, + **kwargs: Any + ) -> "_models.Product": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_accepted200_succeeded_request_initial( - template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata["url"], + template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2334,24 +2572,26 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_accepted200_succeeded_initial.metadata = {"url": "/lro/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + _delete_provisioning202_accepted200_succeeded_initial.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore + @distributed_trace_async async def begin_delete_provisioning202_accepted200_succeeded( - self, **kwargs: Any + self, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a @@ -2370,53 +2610,64 @@ async def begin_delete_provisioning202_accepted200_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_accepted200_succeeded.metadata = {"url": "/lro/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore - async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_provisioning202_deleting_failed200_initial( + self, + **kwargs: Any + ) -> "_models.Product": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_deleting_failed200_request_initial( - template_url=self._delete_provisioning202_deleting_failed200_initial.metadata["url"], + template_url=self._delete_provisioning202_deleting_failed200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2425,23 +2676,27 @@ async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_deleting_failed200_initial.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/failed"} # type: ignore + _delete_provisioning202_deleting_failed200_initial.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore + @distributed_trace_async - async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) -> AsyncLROPoller["_models.Product"]: + async def begin_delete_provisioning202_deleting_failed200( + self, + **kwargs: Any + ) -> AsyncLROPoller["_models.Product"]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -2459,51 +2714,64 @@ async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) - :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_provisioning202_deleting_failed200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_provisioning202_deleting_failed200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_deleting_failed200.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/failed"} # type: ignore + begin_delete_provisioning202_deleting_failed200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore - async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: Any) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_provisioning202_deletingcanceled200_initial( + self, + **kwargs: Any + ) -> "_models.Product": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_deletingcanceled200_request_initial( - template_url=self._delete_provisioning202_deletingcanceled200_initial.metadata["url"], + template_url=self._delete_provisioning202_deletingcanceled200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2512,24 +2780,26 @@ async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: An response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_deletingcanceled200_initial.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/canceled"} # type: ignore + _delete_provisioning202_deletingcanceled200_initial.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore + @distributed_trace_async async def begin_delete_provisioning202_deletingcanceled200( - self, **kwargs: Any + self, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a @@ -2548,51 +2818,64 @@ async def begin_delete_provisioning202_deletingcanceled200( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_provisioning202_deletingcanceled200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_provisioning202_deletingcanceled200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_deletingcanceled200.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/canceled"} # type: ignore + begin_delete_provisioning202_deletingcanceled200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore - async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete204_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete204_succeeded_request_initial( - template_url=self._delete204_succeeded_initial.metadata["url"], + template_url=self._delete204_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -2602,10 +2885,14 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - _delete204_succeeded_initial.metadata = {"url": "/lro/delete/204/succeeded"} # type: ignore + _delete204_succeeded_initial.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore + @distributed_trace_async - async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete204_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete succeeds and returns right away. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2620,48 +2907,61 @@ async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None] :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete204_succeeded.metadata = {"url": "/lro/delete/204/succeeded"} # type: ignore + begin_delete204_succeeded.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore - async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional["_models.Product"]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete202_retry200_initial( + self, + **kwargs: Any + ) -> Optional["_models.Product"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_retry200_request_initial( - template_url=self._delete202_retry200_initial.metadata["url"], + template_url=self._delete202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2671,21 +2971,26 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional["_models. deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete202_retry200_initial.metadata = {"url": "/lro/delete/202/retry/200"} # type: ignore + _delete202_retry200_initial.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore + @distributed_trace_async - async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller["_models.Product"]: + async def begin_delete202_retry200( + self, + **kwargs: Any + ) -> AsyncLROPoller["_models.Product"]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2702,51 +3007,64 @@ async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller["_mode :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_retry200.metadata = {"url": "/lro/delete/202/retry/200"} # type: ignore + begin_delete202_retry200.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore - async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional["_models.Product"]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete202_no_retry204_initial( + self, + **kwargs: Any + ) -> Optional["_models.Product"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_no_retry204_request_initial( - template_url=self._delete202_no_retry204_initial.metadata["url"], + template_url=self._delete202_no_retry204_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -2756,21 +3074,26 @@ async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional["_mode deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete202_no_retry204_initial.metadata = {"url": "/lro/delete/202/noretry/204"} # type: ignore + _delete202_no_retry204_initial.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore + @distributed_trace_async - async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller["_models.Product"]: + async def begin_delete202_no_retry204( + self, + **kwargs: Any + ) -> AsyncLROPoller["_models.Product"]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2787,51 +3110,64 @@ async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller["_m :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_no_retry204_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_no_retry204_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_no_retry204.metadata = {"url": "/lro/delete/202/noretry/204"} # type: ignore + begin_delete202_no_retry204.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore - async def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_no_header_in_retry_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_no_header_in_retry_request_initial( - template_url=self._delete_no_header_in_retry_initial.metadata["url"], + template_url=self._delete_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2840,15 +3176,20 @@ async def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_no_header_in_retry_initial.metadata = {"url": "/lro/delete/noheader"} # type: ignore + _delete_no_header_in_retry_initial.metadata = {'url': '/lro/delete/noheader'} # type: ignore + @distributed_trace_async - async def begin_delete_no_header_in_retry(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_no_header_in_retry( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -2864,48 +3205,61 @@ async def begin_delete_no_header_in_retry(self, **kwargs: Any) -> AsyncLROPoller :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_no_header_in_retry.metadata = {"url": "/lro/delete/noheader"} # type: ignore + begin_delete_no_header_in_retry.metadata = {'url': '/lro/delete/noheader'} # type: ignore - async def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_no_header_in_retry_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_no_header_in_retry_request_initial( - template_url=self._delete_async_no_header_in_retry_initial.metadata["url"], + template_url=self._delete_async_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -2914,15 +3268,20 @@ async def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_no_header_in_retry_initial.metadata = {"url": "/lro/deleteasync/noheader/202/204"} # type: ignore + _delete_async_no_header_in_retry_initial.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore + @distributed_trace_async - async def begin_delete_async_no_header_in_retry(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_no_header_in_retry( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -2938,48 +3297,61 @@ async def begin_delete_async_no_header_in_retry(self, **kwargs: Any) -> AsyncLRO :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_no_header_in_retry.metadata = {"url": "/lro/deleteasync/noheader/202/204"} # type: ignore + begin_delete_async_no_header_in_retry.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore - async def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_retry_succeeded_request_initial( - template_url=self._delete_async_retry_succeeded_initial.metadata["url"], + template_url=self._delete_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2987,19 +3359,22 @@ async def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_retry_succeeded_initial.metadata = {"url": "/lro/deleteasync/retry/succeeded"} # type: ignore + _delete_async_retry_succeeded_initial.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore + @distributed_trace_async - async def begin_delete_async_retry_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_retry_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3015,48 +3390,61 @@ async def begin_delete_async_retry_succeeded(self, **kwargs: Any) -> AsyncLROPol :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_retry_succeeded.metadata = {"url": "/lro/deleteasync/retry/succeeded"} # type: ignore + begin_delete_async_retry_succeeded.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore - async def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_no_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_no_retry_succeeded_request_initial( - template_url=self._delete_async_no_retry_succeeded_initial.metadata["url"], + template_url=self._delete_async_no_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -3064,19 +3452,22 @@ async def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_no_retry_succeeded_initial.metadata = {"url": "/lro/deleteasync/noretry/succeeded"} # type: ignore + _delete_async_no_retry_succeeded_initial.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore + @distributed_trace_async - async def begin_delete_async_no_retry_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_no_retry_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3092,48 +3483,61 @@ async def begin_delete_async_no_retry_succeeded(self, **kwargs: Any) -> AsyncLRO :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_no_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_no_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_no_retry_succeeded.metadata = {"url": "/lro/deleteasync/noretry/succeeded"} # type: ignore + begin_delete_async_no_retry_succeeded.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore - async def _delete_async_retry_failed_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_retry_failed_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_retry_failed_request_initial( - template_url=self._delete_async_retry_failed_initial.metadata["url"], + template_url=self._delete_async_retry_failed_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -3141,19 +3545,22 @@ async def _delete_async_retry_failed_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_retry_failed_initial.metadata = {"url": "/lro/deleteasync/retry/failed"} # type: ignore + _delete_async_retry_failed_initial.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore + @distributed_trace_async - async def begin_delete_async_retry_failed(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_retry_failed( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3169,48 +3576,61 @@ async def begin_delete_async_retry_failed(self, **kwargs: Any) -> AsyncLROPoller :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_retry_failed_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_retry_failed_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_retry_failed.metadata = {"url": "/lro/deleteasync/retry/failed"} # type: ignore + begin_delete_async_retry_failed.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore - async def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_retrycanceled_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_retrycanceled_request_initial( - template_url=self._delete_async_retrycanceled_initial.metadata["url"], + template_url=self._delete_async_retrycanceled_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -3218,19 +3638,22 @@ async def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_retrycanceled_initial.metadata = {"url": "/lro/deleteasync/retry/canceled"} # type: ignore + _delete_async_retrycanceled_initial.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore + @distributed_trace_async - async def begin_delete_async_retrycanceled(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_retrycanceled( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3246,48 +3669,61 @@ async def begin_delete_async_retrycanceled(self, **kwargs: Any) -> AsyncLROPolle :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_retrycanceled_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_retrycanceled_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_retrycanceled.metadata = {"url": "/lro/deleteasync/retry/canceled"} # type: ignore + begin_delete_async_retrycanceled.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore - async def _post200_with_payload_initial(self, **kwargs: Any) -> "_models.Sku": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post200_with_payload_initial( + self, + **kwargs: Any + ) -> "_models.Sku": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post200_with_payload_request_initial( - template_url=self._post200_with_payload_initial.metadata["url"], + template_url=self._post200_with_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3295,20 +3731,24 @@ async def _post200_with_payload_initial(self, **kwargs: Any) -> "_models.Sku": raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if response.status_code == 202: - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post200_with_payload_initial.metadata = {"url": "/lro/post/payload/200"} # type: ignore + _post200_with_payload_initial.metadata = {'url': '/lro/post/payload/200'} # type: ignore + @distributed_trace_async - async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller["_models.Sku"]: + async def begin_post200_with_payload( + self, + **kwargs: Any + ) -> AsyncLROPoller["_models.Sku"]: """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -3324,60 +3764,73 @@ async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller["_mo :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post200_with_payload_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post200_with_payload_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post200_with_payload.metadata = {"url": "/lro/post/payload/200"} # type: ignore + begin_post200_with_payload.metadata = {'url': '/lro/post/payload/200'} # type: ignore - async def _post202_retry200_initial(self, product: Optional["_models.Product"] = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post202_retry200_initial( + self, + product: Optional["_models.Product"] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry200_initial.metadata["url"], + template_url=self._post202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -3385,17 +3838,21 @@ async def _post202_retry200_initial(self, product: Optional["_models.Product"] = raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry200_initial.metadata = {"url": "/lro/post/202/retry/200"} # type: ignore + _post202_retry200_initial.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore + @distributed_trace_async async def begin_post202_retry200( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -3414,62 +3871,73 @@ async def begin_post202_retry200( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry200.metadata = {"url": "/lro/post/202/retry/200"} # type: ignore + begin_post202_retry200.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore async def _post202_no_retry204_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_no_retry204_request_initial( content_type=content_type, json=_json, - template_url=self._post202_no_retry204_initial.metadata["url"], + template_url=self._post202_no_retry204_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -3477,21 +3945,24 @@ async def _post202_no_retry204_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post202_no_retry204_initial.metadata = {"url": "/lro/post/202/noretry/204"} # type: ignore + _post202_no_retry204_initial.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore + @distributed_trace_async async def begin_post202_no_retry204( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -3511,75 +3982,92 @@ async def begin_post202_no_retry204( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_no_retry204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_no_retry204.metadata = {"url": "/lro/post/202/noretry/204"} # type: ignore + begin_post202_no_retry204.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore - async def _post_double_headers_final_location_get_initial(self, **kwargs: Any) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post_double_headers_final_location_get_initial( + self, + **kwargs: Any + ) -> "_models.Product": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_double_headers_final_location_get_request_initial( - template_url=self._post_double_headers_final_location_get_initial.metadata["url"], + template_url=self._post_double_headers_final_location_get_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post_double_headers_final_location_get_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalLocationGet"} # type: ignore + _post_double_headers_final_location_get_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore + @distributed_trace_async - async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> AsyncLROPoller["_models.Product"]: + async def begin_post_double_headers_final_location_get( + self, + **kwargs: Any + ) -> AsyncLROPoller["_models.Product"]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -3597,69 +4085,84 @@ async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> A :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post_double_headers_final_location_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post_double_headers_final_location_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_double_headers_final_location_get.metadata = {"url": "/lro/LROPostDoubleHeadersFinalLocationGet"} # type: ignore + begin_post_double_headers_final_location_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore - async def _post_double_headers_final_azure_header_get_initial(self, **kwargs: Any) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post_double_headers_final_azure_header_get_initial( + self, + **kwargs: Any + ) -> "_models.Product": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_double_headers_final_azure_header_get_request_initial( - template_url=self._post_double_headers_final_azure_header_get_initial.metadata["url"], + template_url=self._post_double_headers_final_azure_header_get_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post_double_headers_final_azure_header_get_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGet"} # type: ignore + _post_double_headers_final_azure_header_get_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore + @distributed_trace_async async def begin_post_double_headers_final_azure_header_get( - self, **kwargs: Any + self, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the @@ -3678,71 +4181,84 @@ async def begin_post_double_headers_final_azure_header_get( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post_double_headers_final_azure_header_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post_double_headers_final_azure_header_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling( - lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs - ) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_double_headers_final_azure_header_get.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGet"} # type: ignore + begin_post_double_headers_final_azure_header_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore - async def _post_double_headers_final_azure_header_get_default_initial(self, **kwargs: Any) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post_double_headers_final_azure_header_get_default_initial( + self, + **kwargs: Any + ) -> "_models.Product": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_double_headers_final_azure_header_get_default_request_initial( - template_url=self._post_double_headers_final_azure_header_get_default_initial.metadata["url"], + template_url=self._post_double_headers_final_azure_header_get_default_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post_double_headers_final_azure_header_get_default_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault"} # type: ignore + _post_double_headers_final_azure_header_get_default_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore + @distributed_trace_async async def begin_post_double_headers_final_azure_header_get_default( - self, **kwargs: Any + self, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the @@ -3761,64 +4277,73 @@ async def begin_post_double_headers_final_azure_header_get_default( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_double_headers_final_azure_header_get_default_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_double_headers_final_azure_header_get_default.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault"} # type: ignore + begin_post_double_headers_final_azure_header_get_default.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore async def _post_async_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> Optional["_models.Product"]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3828,25 +4353,27 @@ async def _post_async_retry_succeeded_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post_async_retry_succeeded_initial.metadata = {"url": "/lro/postasync/retry/succeeded"} # type: ignore + _post_async_retry_succeeded_initial.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore + @distributed_trace_async async def begin_post_async_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -3867,65 +4394,76 @@ async def begin_post_async_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retry_succeeded.metadata = {"url": "/lro/postasync/retry/succeeded"} # type: ignore + begin_post_async_retry_succeeded.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore async def _post_async_no_retry_succeeded_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> Optional["_models.Product"]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_no_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_no_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_no_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3935,25 +4473,27 @@ async def _post_async_no_retry_succeeded_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post_async_no_retry_succeeded_initial.metadata = {"url": "/lro/postasync/noretry/succeeded"} # type: ignore + _post_async_no_retry_succeeded_initial.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore + @distributed_trace_async async def begin_post_async_no_retry_succeeded( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -3974,65 +4514,76 @@ async def begin_post_async_no_retry_succeeded( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_no_retry_succeeded.metadata = {"url": "/lro/postasync/noretry/succeeded"} # type: ignore + begin_post_async_no_retry_succeeded.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore async def _post_async_retry_failed_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retry_failed_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retry_failed_initial.metadata["url"], + template_url=self._post_async_retry_failed_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4040,20 +4591,22 @@ async def _post_async_retry_failed_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_retry_failed_initial.metadata = {"url": "/lro/postasync/retry/failed"} # type: ignore + _post_async_retry_failed_initial.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore + @distributed_trace_async async def begin_post_async_retry_failed( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -4073,62 +4626,73 @@ async def begin_post_async_retry_failed( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retry_failed.metadata = {"url": "/lro/postasync/retry/failed"} # type: ignore + begin_post_async_retry_failed.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore async def _post_async_retrycanceled_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retrycanceled_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retrycanceled_initial.metadata["url"], + template_url=self._post_async_retrycanceled_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4136,20 +4700,22 @@ async def _post_async_retrycanceled_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_retrycanceled_initial.metadata = {"url": "/lro/postasync/retry/canceled"} # type: ignore + _post_async_retrycanceled_initial.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore + @distributed_trace_async async def begin_post_async_retrycanceled( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -4169,35 +4735,38 @@ async def begin_post_async_retrycanceled( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retrycanceled.metadata = {"url": "/lro/postasync/retry/canceled"} # type: ignore + begin_post_async_retrycanceled.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py index 345ec6b7e33..3f946ea0412 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -26,40 +19,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._lrosads_operations import ( - build_delete202_non_retry400_request_initial, - build_delete202_retry_invalid_header_request_initial, - build_delete204_succeeded_request_initial, - build_delete_async_relative_retry400_request_initial, - build_delete_async_relative_retry_invalid_header_request_initial, - build_delete_async_relative_retry_invalid_json_polling_request_initial, - build_delete_async_relative_retry_no_status_request_initial, - build_delete_non_retry400_request_initial, - build_post202_no_location_request_initial, - build_post202_non_retry400_request_initial, - build_post202_retry_invalid_header_request_initial, - build_post_async_relative_retry400_request_initial, - build_post_async_relative_retry_invalid_header_request_initial, - build_post_async_relative_retry_invalid_json_polling_request_initial, - build_post_async_relative_retry_no_payload_request_initial, - build_post_non_retry400_request_initial, - build_put200_invalid_json_request_initial, - build_put_async_relative_retry400_request_initial, - build_put_async_relative_retry_invalid_header_request_initial, - build_put_async_relative_retry_invalid_json_polling_request_initial, - build_put_async_relative_retry_no_status_payload_request_initial, - build_put_async_relative_retry_no_status_request_initial, - build_put_error201_no_provisioning_state_payload_request_initial, - build_put_non_retry201_creating400_invalid_json_request_initial, - build_put_non_retry201_creating400_request_initial, - build_put_non_retry400_request_initial, -) - -T = TypeVar("T") +from ...operations._lrosads_operations import build_delete202_non_retry400_request_initial, build_delete202_retry_invalid_header_request_initial, build_delete204_succeeded_request_initial, build_delete_async_relative_retry400_request_initial, build_delete_async_relative_retry_invalid_header_request_initial, build_delete_async_relative_retry_invalid_json_polling_request_initial, build_delete_async_relative_retry_no_status_request_initial, build_delete_non_retry400_request_initial, build_post202_no_location_request_initial, build_post202_non_retry400_request_initial, build_post202_retry_invalid_header_request_initial, build_post_async_relative_retry400_request_initial, build_post_async_relative_retry_invalid_header_request_initial, build_post_async_relative_retry_invalid_json_polling_request_initial, build_post_async_relative_retry_no_payload_request_initial, build_post_non_retry400_request_initial, build_put200_invalid_json_request_initial, build_put_async_relative_retry400_request_initial, build_put_async_relative_retry_invalid_header_request_initial, build_put_async_relative_retry_invalid_json_polling_request_initial, build_put_async_relative_retry_no_status_payload_request_initial, build_put_async_relative_retry_no_status_request_initial, build_put_error201_no_provisioning_state_payload_request_initial, build_put_non_retry201_creating400_invalid_json_request_initial, build_put_non_retry201_creating400_request_initial, build_put_non_retry400_request_initial +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class LROSADsOperations: +class LROSADsOperations: # pylint: disable=too-many-public-methods """LROSADsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -82,28 +46,36 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config async def _put_non_retry400_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_non_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_retry400_initial.metadata["url"], + template_url=self._put_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -111,21 +83,24 @@ async def _put_non_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/put/400"} # type: ignore + _put_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore + @distributed_trace_async async def begin_put_non_retry400( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 400 to the initial request. @@ -144,65 +119,76 @@ async def begin_put_non_retry400( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_retry400.metadata = {"url": "/lro/nonretryerror/put/400"} # type: ignore + begin_put_non_retry400.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore async def _put_non_retry201_creating400_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_non_retry201_creating400_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_retry201_creating400_initial.metadata["url"], + template_url=self._put_non_retry201_creating400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -210,21 +196,24 @@ async def _put_non_retry201_creating400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_retry201_creating400_initial.metadata = {"url": "/lro/nonretryerror/put/201/creating/400"} # type: ignore + _put_non_retry201_creating400_initial.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore + @distributed_trace_async async def begin_put_non_retry201_creating400( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -244,65 +233,76 @@ async def begin_put_non_retry201_creating400( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_retry201_creating400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_retry201_creating400.metadata = {"url": "/lro/nonretryerror/put/201/creating/400"} # type: ignore + begin_put_non_retry201_creating400.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore async def _put_non_retry201_creating400_invalid_json_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_non_retry201_creating400_invalid_json_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_retry201_creating400_invalid_json_initial.metadata["url"], + template_url=self._put_non_retry201_creating400_invalid_json_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -310,21 +310,24 @@ async def _put_non_retry201_creating400_invalid_json_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_retry201_creating400_invalid_json_initial.metadata = {"url": "/lro/nonretryerror/put/201/creating/400/invalidjson"} # type: ignore + _put_non_retry201_creating400_invalid_json_initial.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore + @distributed_trace_async async def begin_put_non_retry201_creating400_invalid_json( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -344,65 +347,76 @@ async def begin_put_non_retry201_creating400_invalid_json( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_retry201_creating400_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_retry201_creating400_invalid_json.metadata = {"url": "/lro/nonretryerror/put/201/creating/400/invalidjson"} # type: ignore + begin_put_non_retry201_creating400_invalid_json.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore async def _put_async_relative_retry400_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry400_initial.metadata["url"], + template_url=self._put_async_relative_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,24 +424,25 @@ async def _put_async_relative_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/putasync/retry/400"} # type: ignore + _put_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore + @distributed_trace_async async def begin_put_async_relative_retry400( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -447,61 +462,72 @@ async def begin_put_async_relative_retry400( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/putasync/retry/400"} # type: ignore + begin_put_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore - async def _delete_non_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_non_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_non_retry400_request_initial( - template_url=self._delete_non_retry400_initial.metadata["url"], + template_url=self._delete_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -509,16 +535,21 @@ async def _delete_non_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/delete/400"} # type: ignore + _delete_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore + @distributed_trace_async - async def begin_delete_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_non_retry400( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 400 with an error body. :keyword callable cls: A custom type or function that will be passed the direct response @@ -533,48 +564,61 @@ async def begin_delete_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[None] :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_non_retry400.metadata = {"url": "/lro/nonretryerror/delete/400"} # type: ignore + begin_delete_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore - async def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete202_non_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_non_retry400_request_initial( - template_url=self._delete202_non_retry400_initial.metadata["url"], + template_url=self._delete202_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -582,16 +626,21 @@ async def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete202_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/delete/202/retry/400"} # type: ignore + _delete202_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore + @distributed_trace_async - async def begin_delete202_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete202_non_retry400( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 with a location header. :keyword callable cls: A custom type or function that will be passed the direct response @@ -606,48 +655,61 @@ async def begin_delete202_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[No :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_non_retry400.metadata = {"url": "/lro/nonretryerror/delete/202/retry/400"} # type: ignore + begin_delete202_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore - async def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_relative_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry400_request_initial( - template_url=self._delete_async_relative_retry400_initial.metadata["url"], + template_url=self._delete_async_relative_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -655,19 +717,22 @@ async def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/deleteasync/retry/400"} # type: ignore + _delete_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore + @distributed_trace_async - async def begin_delete_async_relative_retry400(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry400( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -683,57 +748,70 @@ async def begin_delete_async_relative_retry400(self, **kwargs: Any) -> AsyncLROP :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/deleteasync/retry/400"} # type: ignore + begin_delete_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore - async def _post_non_retry400_initial(self, product: Optional["_models.Product"] = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post_non_retry400_initial( + self, + product: Optional["_models.Product"] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_non_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._post_non_retry400_initial.metadata["url"], + template_url=self._post_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -741,17 +819,21 @@ async def _post_non_retry400_initial(self, product: Optional["_models.Product"] raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/post/400"} # type: ignore + _post_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore + @distributed_trace_async async def begin_post_non_retry400( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 400 with no error body. @@ -769,60 +851,73 @@ async def begin_post_non_retry400( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_non_retry400.metadata = {"url": "/lro/nonretryerror/post/400"} # type: ignore + begin_post_non_retry400.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore - async def _post202_non_retry400_initial(self, product: Optional["_models.Product"] = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post202_non_retry400_initial( + self, + product: Optional["_models.Product"] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_non_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._post202_non_retry400_initial.metadata["url"], + template_url=self._post202_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -830,17 +925,21 @@ async def _post202_non_retry400_initial(self, product: Optional["_models.Product raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/post/202/retry/400"} # type: ignore + _post202_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore + @distributed_trace_async async def begin_post202_non_retry400( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 with a location header. @@ -858,62 +957,73 @@ async def begin_post202_non_retry400( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_non_retry400.metadata = {"url": "/lro/nonretryerror/post/202/retry/400"} # type: ignore + begin_post202_non_retry400.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore async def _post_async_relative_retry400_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry400_initial.metadata["url"], + template_url=self._post_async_relative_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -921,20 +1031,22 @@ async def _post_async_relative_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/postasync/retry/400"} # type: ignore + _post_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore + @distributed_trace_async async def begin_post_async_relative_retry400( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -953,62 +1065,73 @@ async def begin_post_async_relative_retry400( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/postasync/retry/400"} # type: ignore + begin_post_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore async def _put_error201_no_provisioning_state_payload_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_error201_no_provisioning_state_payload_request_initial( content_type=content_type, json=_json, - template_url=self._put_error201_no_provisioning_state_payload_initial.metadata["url"], + template_url=self._put_error201_no_provisioning_state_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1016,21 +1139,24 @@ async def _put_error201_no_provisioning_state_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_error201_no_provisioning_state_payload_initial.metadata = {"url": "/lro/error/put/201/noprovisioningstatepayload"} # type: ignore + _put_error201_no_provisioning_state_payload_initial.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore + @distributed_trace_async async def begin_put_error201_no_provisioning_state_payload( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 201 to the initial request with no payload. @@ -1049,65 +1175,76 @@ async def begin_put_error201_no_provisioning_state_payload( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_error201_no_provisioning_state_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_error201_no_provisioning_state_payload.metadata = {"url": "/lro/error/put/201/noprovisioningstatepayload"} # type: ignore + begin_put_error201_no_provisioning_state_payload.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore async def _put_async_relative_retry_no_status_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_no_status_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_no_status_initial.metadata["url"], + template_url=self._put_async_relative_retry_no_status_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1115,24 +1252,25 @@ async def _put_async_relative_retry_no_status_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_no_status_initial.metadata = {"url": "/lro/error/putasync/retry/nostatus"} # type: ignore + _put_async_relative_retry_no_status_initial.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore + @distributed_trace_async async def begin_put_async_relative_retry_no_status( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1153,72 +1291,81 @@ async def begin_put_async_relative_retry_no_status( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_no_status_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_no_status.metadata = {"url": "/lro/error/putasync/retry/nostatus"} # type: ignore + begin_put_async_relative_retry_no_status.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore async def _put_async_relative_retry_no_status_payload_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_no_status_payload_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_no_status_payload_initial.metadata["url"], + template_url=self._put_async_relative_retry_no_status_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1226,24 +1373,25 @@ async def _put_async_relative_retry_no_status_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_no_status_payload_initial.metadata = {"url": "/lro/error/putasync/retry/nostatuspayload"} # type: ignore + _put_async_relative_retry_no_status_payload_initial.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore + @distributed_trace_async async def begin_put_async_relative_retry_no_status_payload( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1264,61 +1412,72 @@ async def begin_put_async_relative_retry_no_status_payload( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_no_status_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_no_status_payload.metadata = {"url": "/lro/error/putasync/retry/nostatuspayload"} # type: ignore + begin_put_async_relative_retry_no_status_payload.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore - async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete204_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete204_succeeded_request_initial( - template_url=self._delete204_succeeded_initial.metadata["url"], + template_url=self._delete204_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1328,10 +1487,14 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - _delete204_succeeded_initial.metadata = {"url": "/lro/error/delete/204/nolocation"} # type: ignore + _delete204_succeeded_initial.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore + @distributed_trace_async - async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete204_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 204 to the initial request, indicating success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1346,48 +1509,61 @@ async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None] :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete204_succeeded.metadata = {"url": "/lro/error/delete/204/nolocation"} # type: ignore + begin_delete204_succeeded.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore - async def _delete_async_relative_retry_no_status_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_relative_retry_no_status_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_no_status_request_initial( - template_url=self._delete_async_relative_retry_no_status_initial.metadata["url"], + template_url=self._delete_async_relative_retry_no_status_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1395,19 +1571,22 @@ async def _delete_async_relative_retry_no_status_initial(self, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_no_status_initial.metadata = {"url": "/lro/error/deleteasync/retry/nostatus"} # type: ignore + _delete_async_relative_retry_no_status_initial.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore + @distributed_trace_async - async def begin_delete_async_relative_retry_no_status(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_no_status( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1423,57 +1602,70 @@ async def begin_delete_async_relative_retry_no_status(self, **kwargs: Any) -> As :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry_no_status_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry_no_status_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_no_status.metadata = {"url": "/lro/error/deleteasync/retry/nostatus"} # type: ignore + begin_delete_async_relative_retry_no_status.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore - async def _post202_no_location_initial(self, product: Optional["_models.Product"] = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _post202_no_location_initial( + self, + product: Optional["_models.Product"] = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_no_location_request_initial( content_type=content_type, json=_json, - template_url=self._post202_no_location_initial.metadata["url"], + template_url=self._post202_no_location_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1481,17 +1673,21 @@ async def _post202_no_location_initial(self, product: Optional["_models.Product" raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_no_location_initial.metadata = {"url": "/lro/error/post/202/nolocation"} # type: ignore + _post202_no_location_initial.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore + @distributed_trace_async async def begin_post202_no_location( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1510,62 +1706,73 @@ async def begin_post202_no_location( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_no_location_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_no_location.metadata = {"url": "/lro/error/post/202/nolocation"} # type: ignore + begin_post202_no_location.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore async def _post_async_relative_retry_no_payload_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_no_payload_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_no_payload_initial.metadata["url"], + template_url=self._post_async_relative_retry_no_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1573,20 +1780,22 @@ async def _post_async_relative_retry_no_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_no_payload_initial.metadata = {"url": "/lro/error/postasync/retry/nopayload"} # type: ignore + _post_async_relative_retry_no_payload_initial.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore + @distributed_trace_async async def begin_post_async_relative_retry_no_payload( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1606,62 +1815,73 @@ async def begin_post_async_relative_retry_no_payload( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_no_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_no_payload.metadata = {"url": "/lro/error/postasync/retry/nopayload"} # type: ignore + begin_post_async_relative_retry_no_payload.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore async def _put200_invalid_json_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> Optional["_models.Product"]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_invalid_json_request_initial( content_type=content_type, json=_json, - template_url=self._put200_invalid_json_initial.metadata["url"], + template_url=self._put200_invalid_json_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1670,18 +1890,21 @@ async def _put200_invalid_json_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_invalid_json_initial.metadata = {"url": "/lro/error/put/200/invalidjson"} # type: ignore + _put200_invalid_json_initial.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore + @distributed_trace_async async def begin_put200_invalid_json( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1701,65 +1924,76 @@ async def begin_put200_invalid_json( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_invalid_json.metadata = {"url": "/lro/error/put/200/invalidjson"} # type: ignore + begin_put200_invalid_json.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore async def _put_async_relative_retry_invalid_header_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_invalid_header_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_invalid_header_initial.metadata["url"], + template_url=self._put_async_relative_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1767,24 +2001,25 @@ async def _put_async_relative_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_invalid_header_initial.metadata = {"url": "/lro/error/putasync/retry/invalidheader"} # type: ignore + _put_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore + @distributed_trace_async async def begin_put_async_relative_retry_invalid_header( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -1805,72 +2040,81 @@ async def begin_put_async_relative_retry_invalid_header( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/putasync/retry/invalidheader"} # type: ignore + begin_put_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore async def _put_async_relative_retry_invalid_json_polling_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_invalid_json_polling_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_invalid_json_polling_initial.metadata["url"], + template_url=self._put_async_relative_retry_invalid_json_polling_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1878,24 +2122,25 @@ async def _put_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_invalid_json_polling_initial.metadata = {"url": "/lro/error/putasync/retry/invalidjsonpolling"} # type: ignore + _put_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore + @distributed_trace_async async def begin_put_async_relative_retry_invalid_json_polling( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller["_models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1916,61 +2161,72 @@ async def begin_put_async_relative_retry_invalid_json_polling( :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_invalid_json_polling.metadata = {"url": "/lro/error/putasync/retry/invalidjsonpolling"} # type: ignore + begin_put_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore - async def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete202_retry_invalid_header_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_retry_invalid_header_request_initial( - template_url=self._delete202_retry_invalid_header_initial.metadata["url"], + template_url=self._delete202_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1978,16 +2234,21 @@ async def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete202_retry_invalid_header_initial.metadata = {"url": "/lro/error/delete/202/retry/invalidheader"} # type: ignore + _delete202_retry_invalid_header_initial.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore + @distributed_trace_async - async def begin_delete202_retry_invalid_header(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete202_retry_invalid_header( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -2003,48 +2264,61 @@ async def begin_delete202_retry_invalid_header(self, **kwargs: Any) -> AsyncLROP :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_retry_invalid_header.metadata = {"url": "/lro/error/delete/202/retry/invalidheader"} # type: ignore + begin_delete202_retry_invalid_header.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore - async def _delete_async_relative_retry_invalid_header_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_relative_retry_invalid_header_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_invalid_header_request_initial( - template_url=self._delete_async_relative_retry_invalid_header_initial.metadata["url"], + template_url=self._delete_async_relative_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2052,19 +2326,22 @@ async def _delete_async_relative_retry_invalid_header_initial(self, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_invalid_header_initial.metadata = {"url": "/lro/error/deleteasync/retry/invalidheader"} # type: ignore + _delete_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore + @distributed_trace_async - async def begin_delete_async_relative_retry_invalid_header(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_invalid_header( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2080,48 +2357,61 @@ async def begin_delete_async_relative_retry_invalid_header(self, **kwargs: Any) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/deleteasync/retry/invalidheader"} # type: ignore + begin_delete_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore - async def _delete_async_relative_retry_invalid_json_polling_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _delete_async_relative_retry_invalid_json_polling_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_invalid_json_polling_request_initial( - template_url=self._delete_async_relative_retry_invalid_json_polling_initial.metadata["url"], + template_url=self._delete_async_relative_retry_invalid_json_polling_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2129,19 +2419,22 @@ async def _delete_async_relative_retry_invalid_json_polling_initial(self, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_invalid_json_polling_initial.metadata = {"url": "/lro/error/deleteasync/retry/invalidjsonpolling"} # type: ignore + _delete_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore + @distributed_trace_async - async def begin_delete_async_relative_retry_invalid_json_polling(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_invalid_json_polling( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2157,61 +2450,70 @@ async def begin_delete_async_relative_retry_invalid_json_polling(self, **kwargs: :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_async_relative_retry_invalid_json_polling_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_invalid_json_polling.metadata = {"url": "/lro/error/deleteasync/retry/invalidjsonpolling"} # type: ignore + begin_delete_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore async def _post202_retry_invalid_header_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry_invalid_header_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry_invalid_header_initial.metadata["url"], + template_url=self._post202_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2219,17 +2521,21 @@ async def _post202_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry_invalid_header_initial.metadata = {"url": "/lro/error/post/202/retry/invalidheader"} # type: ignore + _post202_retry_invalid_header_initial.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore + @distributed_trace_async async def begin_post202_retry_invalid_header( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -2248,62 +2554,73 @@ async def begin_post202_retry_invalid_header( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry_invalid_header.metadata = {"url": "/lro/error/post/202/retry/invalidheader"} # type: ignore + begin_post202_retry_invalid_header.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore async def _post_async_relative_retry_invalid_header_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_invalid_header_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_invalid_header_initial.metadata["url"], + template_url=self._post_async_relative_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2311,20 +2628,22 @@ async def _post_async_relative_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_invalid_header_initial.metadata = {"url": "/lro/error/postasync/retry/invalidheader"} # type: ignore + _post_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore + @distributed_trace_async async def begin_post_async_relative_retry_invalid_header( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -2344,62 +2663,73 @@ async def begin_post_async_relative_retry_invalid_header( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/postasync/retry/invalidheader"} # type: ignore + begin_post_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore async def _post_async_relative_retry_invalid_json_polling_initial( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_invalid_json_polling_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_invalid_json_polling_initial.metadata["url"], + template_url=self._post_async_relative_retry_invalid_json_polling_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2407,20 +2737,22 @@ async def _post_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_invalid_json_polling_initial.metadata = {"url": "/lro/error/postasync/retry/invalidjsonpolling"} # type: ignore + _post_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore + @distributed_trace_async async def begin_post_async_relative_retry_invalid_json_polling( - self, product: Optional["_models.Product"] = None, **kwargs: Any + self, + product: Optional["_models.Product"] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2440,35 +2772,38 @@ async def begin_post_async_relative_retry_invalid_json_polling( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_invalid_json_polling.metadata = {"url": "/lro/error/postasync/retry/invalidjsonpolling"} # type: ignore + begin_post_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py index 35e4862503b..71e63d73c45 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py @@ -30,14 +30,14 @@ ) __all__ = [ - "OperationResult", - "OperationResultError", - "Product", - "Resource", - "Sku", - "SubProduct", - "SubResource", - "OperationResultStatus", - "ProductPropertiesProvisioningStateValues", - "SubProductPropertiesProvisioningStateValues", + 'OperationResult', + 'OperationResultError', + 'Product', + 'Resource', + 'Sku', + 'SubProduct', + 'SubResource', + 'OperationResultStatus', + 'ProductPropertiesProvisioningStateValues', + 'SubProductPropertiesProvisioningStateValues', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_auto_rest_long_running_operation_test_service_enums.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_auto_rest_long_running_operation_test_service_enums.py index 8ee3ca2c5f4..a5d3ba646fe 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_auto_rest_long_running_operation_test_service_enums.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_auto_rest_long_running_operation_test_service_enums.py @@ -12,7 +12,8 @@ class OperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The status of the request""" + """The status of the request + """ SUCCEEDED = "Succeeded" FAILED = "Failed" @@ -26,7 +27,6 @@ class OperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" OK = "OK" - class ProductPropertiesProvisioningStateValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" @@ -41,7 +41,6 @@ class ProductPropertiesProvisioningStateValues(with_metaclass(CaseInsensitiveEnu DELETED = "Deleted" OK = "OK" - class SubProductPropertiesProvisioningStateValues(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models.py index e5afef72188..ea2e486028d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models.py @@ -21,11 +21,14 @@ class OperationResult(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "str"}, - "error": {"key": "error", "type": "OperationResultError"}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'OperationResultError'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: The status of the request. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", @@ -35,8 +38,8 @@ def __init__(self, **kwargs): :paramtype error: ~lro.models.OperationResultError """ super(OperationResult, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.error = kwargs.get("error", None) + self.status = kwargs.get('status', None) + self.error = kwargs.get('error', None) class OperationResultError(msrest.serialization.Model): @@ -49,11 +52,14 @@ class OperationResultError(msrest.serialization.Model): """ _attribute_map = { - "code": {"key": "code", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword code: The error code for an operation failure. :paramtype code: int @@ -61,8 +67,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(OperationResultError, self).__init__(**kwargs) - self.code = kwargs.get("code", None) - self.message = kwargs.get("message", None) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) class Resource(msrest.serialization.Model): @@ -83,20 +89,23 @@ class Resource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -106,8 +115,8 @@ def __init__(self, **kwargs): super(Resource, self).__init__(**kwargs) self.id = None self.type = None - self.tags = kwargs.get("tags", None) - self.location = kwargs.get("location", None) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) self.name = None @@ -134,23 +143,26 @@ class Product(Resource): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, - "provisioning_state_values": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'provisioning_state_values': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "provisioning_state_values": {"key": "properties.provisioningStateValues", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provisioning_state_values': {'key': 'properties.provisioningStateValues', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -160,7 +172,7 @@ def __init__(self, **kwargs): :paramtype provisioning_state: str """ super(Product, self).__init__(**kwargs) - self.provisioning_state = kwargs.get("provisioning_state", None) + self.provisioning_state = kwargs.get('provisioning_state', None) self.provisioning_state_values = None @@ -174,11 +186,14 @@ class Sku(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: :paramtype name: str @@ -186,8 +201,8 @@ def __init__(self, **kwargs): :paramtype id: str """ super(Sku, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.id = kwargs.get("id", None) + self.name = kwargs.get('name', None) + self.id = kwargs.get('id', None) class SubResource(msrest.serialization.Model): @@ -200,15 +215,19 @@ class SubResource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, + 'id': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(SubResource, self).__init__(**kwargs) self.id = None @@ -229,21 +248,24 @@ class SubProduct(SubResource): """ _validation = { - "id": {"readonly": True}, - "provisioning_state_values": {"readonly": True}, + 'id': {'readonly': True}, + 'provisioning_state_values': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "provisioning_state_values": {"key": "properties.provisioningStateValues", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provisioning_state_values': {'key': 'properties.provisioningStateValues', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword provisioning_state: :paramtype provisioning_state: str """ super(SubProduct, self).__init__(**kwargs) - self.provisioning_state = kwargs.get("provisioning_state", None) + self.provisioning_state = kwargs.get('provisioning_state', None) self.provisioning_state_values = None diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models_py3.py index 6efb837db36..944b2c0a71e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_models_py3.py @@ -25,8 +25,8 @@ class OperationResult(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "str"}, - "error": {"key": "error", "type": "OperationResultError"}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'OperationResultError'}, } def __init__( @@ -59,11 +59,17 @@ class OperationResultError(msrest.serialization.Model): """ _attribute_map = { - "code": {"key": "code", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + code: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword code: The error code for an operation failure. :paramtype code: int @@ -93,20 +99,26 @@ class Resource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ): """ :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -144,20 +156,20 @@ class Product(Resource): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, - "provisioning_state_values": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'provisioning_state_values': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "provisioning_state_values": {"key": "properties.provisioningStateValues", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provisioning_state_values': {'key': 'properties.provisioningStateValues', 'type': 'str'}, } def __init__( @@ -191,11 +203,17 @@ class Sku(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, name: Optional[str] = None, id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): """ :keyword name: :paramtype name: str @@ -217,15 +235,19 @@ class SubResource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, + 'id': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(SubResource, self).__init__(**kwargs) self.id = None @@ -246,17 +268,22 @@ class SubProduct(SubResource): """ _validation = { - "id": {"readonly": True}, - "provisioning_state_values": {"readonly": True}, + 'id': {'readonly': True}, + 'provisioning_state_values': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "provisioning_state_values": {"key": "properties.provisioningStateValues", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provisioning_state_values': {'key': 'properties.provisioningStateValues', 'type': 'str'}, } - def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs): + def __init__( + self, + *, + provisioning_state: Optional[str] = None, + **kwargs + ): """ :keyword provisioning_state: :paramtype provisioning_state: str diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/__init__.py index 234d447ace7..6e8646cae89 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/__init__.py @@ -12,8 +12,8 @@ from ._lr_os_custom_header_operations import LROsCustomHeaderOperations __all__ = [ - "LROsOperations", - "LRORetrysOperations", - "LROSADsOperations", - "LROsCustomHeaderOperations", + 'LROsOperations', + 'LRORetrysOperations', + 'LROSADsOperations', + 'LROsCustomHeaderOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py index ce633dc921c..dbf7d4d7711 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -30,9 +23,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -163,26 +155,32 @@ def _put_async_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -190,20 +188,19 @@ def _put_async_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_retry_succeeded_initial.metadata = {"url": "/lro/customheader/putasync/retry/succeeded"} # type: ignore + _put_async_retry_succeeded_initial.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_put_async_retry_succeeded( @@ -231,48 +228,49 @@ def begin_put_async_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_retry_succeeded.metadata = {"url": "/lro/customheader/putasync/retry/succeeded"} # type: ignore + begin_put_async_retry_succeeded.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore def _put201_creating_succeeded200_initial( self, @@ -280,26 +278,32 @@ def _put201_creating_succeeded200_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_succeeded200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_succeeded200_initial.metadata["url"], + template_url=self._put201_creating_succeeded200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -307,17 +311,18 @@ def _put201_creating_succeeded200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_succeeded200_initial.metadata = {"url": "/lro/customheader/put/201/creating/succeeded/200"} # type: ignore + _put201_creating_succeeded200_initial.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore + @distributed_trace def begin_put201_creating_succeeded200( @@ -345,41 +350,44 @@ def begin_put201_creating_succeeded200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_succeeded200.metadata = {"url": "/lro/customheader/put/201/creating/succeeded/200"} # type: ignore + begin_put201_creating_succeeded200.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore def _post202_retry200_initial( self, @@ -387,26 +395,32 @@ def _post202_retry200_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry200_initial.metadata["url"], + template_url=self._post202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -414,13 +428,15 @@ def _post202_retry200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry200_initial.metadata = {"url": "/lro/customheader/post/202/retry/200"} # type: ignore + _post202_retry200_initial.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore + @distributed_trace def begin_post202_retry200( @@ -447,38 +463,41 @@ def begin_post202_retry200( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry200.metadata = {"url": "/lro/customheader/post/202/retry/200"} # type: ignore + begin_post202_retry200.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore def _post_async_retry_succeeded_initial( self, @@ -486,26 +505,32 @@ def _post_async_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -513,16 +538,16 @@ def _post_async_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_retry_succeeded_initial.metadata = {"url": "/lro/customheader/postasync/retry/succeeded"} # type: ignore + _post_async_retry_succeeded_initial.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_post_async_retry_succeeded( @@ -550,35 +575,38 @@ def begin_post_async_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retry_succeeded.metadata = {"url": "/lro/customheader/postasync/retry/succeeded"} # type: ignore + begin_post_async_retry_succeeded.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py index 4d8b60bc1e6..62f5e65ccb8 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -30,9 +23,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -223,26 +215,32 @@ def _put201_creating_succeeded200_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_succeeded200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_succeeded200_initial.metadata["url"], + template_url=self._put201_creating_succeeded200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -250,17 +248,18 @@ def _put201_creating_succeeded200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_succeeded200_initial.metadata = {"url": "/lro/retryerror/put/201/creating/succeeded/200"} # type: ignore + _put201_creating_succeeded200_initial.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore + @distributed_trace def begin_put201_creating_succeeded200( @@ -287,41 +286,44 @@ def begin_put201_creating_succeeded200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_succeeded200.metadata = {"url": "/lro/retryerror/put/201/creating/succeeded/200"} # type: ignore + begin_put201_creating_succeeded200.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore def _put_async_relative_retry_succeeded_initial( self, @@ -329,26 +331,32 @@ def _put_async_relative_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_relative_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -356,20 +364,19 @@ def _put_async_relative_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_succeeded_initial.metadata = {"url": "/lro/retryerror/putasync/retry/succeeded"} # type: ignore + _put_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_put_async_relative_retry_succeeded( @@ -396,64 +403,73 @@ def begin_put_async_relative_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/putasync/retry/succeeded"} # type: ignore + begin_put_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore def _delete_provisioning202_accepted200_succeeded_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_accepted200_succeeded_request_initial( - template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata["url"], + template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -462,24 +478,26 @@ def _delete_provisioning202_accepted200_succeeded_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_accepted200_succeeded_initial.metadata = {"url": "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + _delete_provisioning202_accepted200_succeeded_initial.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore + @distributed_trace def begin_delete_provisioning202_accepted200_succeeded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running delete request, service returns a 500, then a 202 to the initial request, with an @@ -498,54 +516,65 @@ def begin_delete_provisioning202_accepted200_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_accepted200_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_accepted200_succeeded.metadata = {"url": "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore def _delete202_retry200_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_retry200_request_initial( - template_url=self._delete202_retry200_initial.metadata["url"], + template_url=self._delete202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -553,17 +582,20 @@ def _delete202_retry200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete202_retry200_initial.metadata = {"url": "/lro/retryerror/delete/202/retry/200"} # type: ignore + _delete202_retry200_initial.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore + @distributed_trace def begin_delete202_retry200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 500, then a 202 to the initial request. Polls @@ -581,51 +613,62 @@ def begin_delete202_retry200( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_retry200.metadata = {"url": "/lro/retryerror/delete/202/retry/200"} # type: ignore + begin_delete202_retry200.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore def _delete_async_relative_retry_succeeded_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_succeeded_request_initial( - template_url=self._delete_async_relative_retry_succeeded_initial.metadata["url"], + template_url=self._delete_async_relative_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -633,20 +676,21 @@ def _delete_async_relative_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_succeeded_initial.metadata = {"url": "/lro/retryerror/deleteasync/retry/succeeded"} # type: ignore + _delete_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_delete_async_relative_retry_succeeded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the @@ -664,35 +708,38 @@ def begin_delete_async_relative_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/deleteasync/retry/succeeded"} # type: ignore + begin_delete_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore def _post202_retry200_initial( self, @@ -700,26 +747,32 @@ def _post202_retry200_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry200_initial.metadata["url"], + template_url=self._post202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -727,13 +780,15 @@ def _post202_retry200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry200_initial.metadata = {"url": "/lro/retryerror/post/202/retry/200"} # type: ignore + _post202_retry200_initial.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore + @distributed_trace def begin_post202_retry200( @@ -759,38 +814,41 @@ def begin_post202_retry200( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry200.metadata = {"url": "/lro/retryerror/post/202/retry/200"} # type: ignore + begin_post202_retry200.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore def _post_async_relative_retry_succeeded_initial( self, @@ -798,26 +856,32 @@ def _post_async_relative_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_relative_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -825,16 +889,16 @@ def _post_async_relative_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_succeeded_initial.metadata = {"url": "/lro/retryerror/postasync/retry/succeeded"} # type: ignore + _post_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_post_async_relative_retry_succeeded( @@ -861,35 +925,38 @@ def begin_post_async_relative_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_succeeded.metadata = {"url": "/lro/retryerror/postasync/retry/succeeded"} # type: ignore + begin_post_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py index 9502ce1ccc2..1851420e926 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -30,9 +23,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1027,7 +1019,7 @@ def build_post_async_retrycanceled_request_initial( ) # fmt: on -class LROsOperations(object): +class LROsOperations(object): # pylint: disable=too-many-public-methods """LROsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -1055,26 +1047,32 @@ def _put200_succeeded_initial( **kwargs # type: Any ): # type: (...) -> Optional["_models.Product"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put200_succeeded_initial.metadata["url"], + template_url=self._put200_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1083,14 +1081,15 @@ def _put200_succeeded_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_succeeded_initial.metadata = {"url": "/lro/put/200/succeeded"} # type: ignore + _put200_succeeded_initial.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore + @distributed_trace def begin_put200_succeeded( @@ -1116,41 +1115,44 @@ def begin_put200_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_succeeded.metadata = {"url": "/lro/put/200/succeeded"} # type: ignore + begin_put200_succeeded.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore def _patch200_succeeded_ignore_headers_initial( self, @@ -1158,26 +1160,32 @@ def _patch200_succeeded_ignore_headers_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_patch200_succeeded_ignore_headers_request_initial( content_type=content_type, json=_json, - template_url=self._patch200_succeeded_ignore_headers_initial.metadata["url"], + template_url=self._patch200_succeeded_ignore_headers_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1185,18 +1193,17 @@ def _patch200_succeeded_ignore_headers_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _patch200_succeeded_ignore_headers_initial.metadata = {"url": "/lro/patch/200/succeeded/ignoreheaders"} # type: ignore + _patch200_succeeded_ignore_headers_initial.metadata = {'url': '/lro/patch/200/succeeded/ignoreheaders'} # type: ignore + @distributed_trace def begin_patch200_succeeded_ignore_headers( @@ -1222,46 +1229,47 @@ def begin_patch200_succeeded_ignore_headers( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._patch200_succeeded_ignore_headers_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch200_succeeded_ignore_headers.metadata = {"url": "/lro/patch/200/succeeded/ignoreheaders"} # type: ignore + begin_patch200_succeeded_ignore_headers.metadata = {'url': '/lro/patch/200/succeeded/ignoreheaders'} # type: ignore def _patch201_retry_with_async_header_initial( self, @@ -1269,26 +1277,32 @@ def _patch201_retry_with_async_header_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_patch201_retry_with_async_header_request_initial( content_type=content_type, json=_json, - template_url=self._patch201_retry_with_async_header_initial.metadata["url"], + template_url=self._patch201_retry_with_async_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1297,21 +1311,20 @@ def _patch201_retry_with_async_header_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _patch201_retry_with_async_header_initial.metadata = {"url": "/lro/patch/201/retry/onlyAsyncHeader"} # type: ignore + _patch201_retry_with_async_header_initial.metadata = {'url': '/lro/patch/201/retry/onlyAsyncHeader'} # type: ignore + @distributed_trace def begin_patch201_retry_with_async_header( @@ -1336,41 +1349,44 @@ def begin_patch201_retry_with_async_header( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._patch201_retry_with_async_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch201_retry_with_async_header.metadata = {"url": "/lro/patch/201/retry/onlyAsyncHeader"} # type: ignore + begin_patch201_retry_with_async_header.metadata = {'url': '/lro/patch/201/retry/onlyAsyncHeader'} # type: ignore def _patch202_retry_with_async_and_location_header_initial( self, @@ -1378,26 +1394,32 @@ def _patch202_retry_with_async_and_location_header_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_patch202_retry_with_async_and_location_header_request_initial( content_type=content_type, json=_json, - template_url=self._patch202_retry_with_async_and_location_header_initial.metadata["url"], + template_url=self._patch202_retry_with_async_and_location_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1406,22 +1428,21 @@ def _patch202_retry_with_async_and_location_header_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _patch202_retry_with_async_and_location_header_initial.metadata = {"url": "/lro/patch/202/retry/asyncAndLocationHeader"} # type: ignore + _patch202_retry_with_async_and_location_header_initial.metadata = {'url': '/lro/patch/202/retry/asyncAndLocationHeader'} # type: ignore + @distributed_trace def begin_patch202_retry_with_async_and_location_header( @@ -1447,41 +1468,44 @@ def begin_patch202_retry_with_async_and_location_header( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._patch202_retry_with_async_and_location_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_patch202_retry_with_async_and_location_header.metadata = {"url": "/lro/patch/202/retry/asyncAndLocationHeader"} # type: ignore + begin_patch202_retry_with_async_and_location_header.metadata = {'url': '/lro/patch/202/retry/asyncAndLocationHeader'} # type: ignore def _put201_succeeded_initial( self, @@ -1489,40 +1513,47 @@ def _put201_succeeded_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put201_succeeded_initial.metadata["url"], + template_url=self._put201_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_succeeded_initial.metadata = {"url": "/lro/put/201/succeeded"} # type: ignore + _put201_succeeded_initial.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore + @distributed_trace def begin_put201_succeeded( @@ -1548,57 +1579,68 @@ def begin_put201_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_succeeded.metadata = {"url": "/lro/put/201/succeeded"} # type: ignore + begin_put201_succeeded.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore def _post202_list_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[List["_models.Product"]] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List["_models.Product"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.Product"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post202_list_request_initial( - template_url=self._post202_list_initial.metadata["url"], + template_url=self._post202_list_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1608,24 +1650,25 @@ def _post202_list_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post202_list_initial.metadata = {"url": "/lro/list"} # type: ignore + _post202_list_initial.metadata = {'url': '/lro/list'} # type: ignore + @distributed_trace def begin_post202_list( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[List["_models.Product"]] """Long running put request, service returns a 202 with empty body to first request, returns a 200 @@ -1644,38 +1687,41 @@ def begin_post202_list( :rtype: ~azure.core.polling.LROPoller[list[~lro.models.Product]] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post202_list_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post202_list_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_list.metadata = {"url": "/lro/list"} # type: ignore + begin_post202_list.metadata = {'url': '/lro/list'} # type: ignore def _put200_succeeded_no_state_initial( self, @@ -1683,40 +1729,47 @@ def _put200_succeeded_no_state_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_succeeded_no_state_request_initial( content_type=content_type, json=_json, - template_url=self._put200_succeeded_no_state_initial.metadata["url"], + template_url=self._put200_succeeded_no_state_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_succeeded_no_state_initial.metadata = {"url": "/lro/put/200/succeeded/nostate"} # type: ignore + _put200_succeeded_no_state_initial.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore + @distributed_trace def begin_put200_succeeded_no_state( @@ -1742,41 +1795,44 @@ def begin_put200_succeeded_no_state( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_succeeded_no_state_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_succeeded_no_state.metadata = {"url": "/lro/put/200/succeeded/nostate"} # type: ignore + begin_put200_succeeded_no_state.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore def _put202_retry200_initial( self, @@ -1784,40 +1840,47 @@ def _put202_retry200_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._put202_retry200_initial.metadata["url"], + template_url=self._put202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put202_retry200_initial.metadata = {"url": "/lro/put/202/retry/200"} # type: ignore + _put202_retry200_initial.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore + @distributed_trace def begin_put202_retry200( @@ -1844,41 +1907,44 @@ def begin_put202_retry200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put202_retry200.metadata = {"url": "/lro/put/202/retry/200"} # type: ignore + begin_put202_retry200.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore def _put201_creating_succeeded200_initial( self, @@ -1886,26 +1952,32 @@ def _put201_creating_succeeded200_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_succeeded200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_succeeded200_initial.metadata["url"], + template_url=self._put201_creating_succeeded200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1913,17 +1985,18 @@ def _put201_creating_succeeded200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_succeeded200_initial.metadata = {"url": "/lro/put/201/creating/succeeded/200"} # type: ignore + _put201_creating_succeeded200_initial.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore + @distributed_trace def begin_put201_creating_succeeded200( @@ -1950,41 +2023,44 @@ def begin_put201_creating_succeeded200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_succeeded200.metadata = {"url": "/lro/put/201/creating/succeeded/200"} # type: ignore + begin_put201_creating_succeeded200.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore def _put200_updating_succeeded204_initial( self, @@ -1992,40 +2068,47 @@ def _put200_updating_succeeded204_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_updating_succeeded204_request_initial( content_type=content_type, json=_json, - template_url=self._put200_updating_succeeded204_initial.metadata["url"], + template_url=self._put200_updating_succeeded204_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_updating_succeeded204_initial.metadata = {"url": "/lro/put/200/updating/succeeded/200"} # type: ignore + _put200_updating_succeeded204_initial.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore + @distributed_trace def begin_put200_updating_succeeded204( @@ -2052,41 +2135,44 @@ def begin_put200_updating_succeeded204( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_updating_succeeded204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_updating_succeeded204.metadata = {"url": "/lro/put/200/updating/succeeded/200"} # type: ignore + begin_put200_updating_succeeded204.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore def _put201_creating_failed200_initial( self, @@ -2094,26 +2180,32 @@ def _put201_creating_failed200_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put201_creating_failed200_request_initial( content_type=content_type, json=_json, - template_url=self._put201_creating_failed200_initial.metadata["url"], + template_url=self._put201_creating_failed200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -2121,17 +2213,18 @@ def _put201_creating_failed200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put201_creating_failed200_initial.metadata = {"url": "/lro/put/201/created/failed/200"} # type: ignore + _put201_creating_failed200_initial.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore + @distributed_trace def begin_put201_creating_failed200( @@ -2158,41 +2251,44 @@ def begin_put201_creating_failed200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_failed200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put201_creating_failed200.metadata = {"url": "/lro/put/201/created/failed/200"} # type: ignore + begin_put201_creating_failed200.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore def _put200_acceptedcanceled200_initial( self, @@ -2200,40 +2296,47 @@ def _put200_acceptedcanceled200_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_acceptedcanceled200_request_initial( content_type=content_type, json=_json, - template_url=self._put200_acceptedcanceled200_initial.metadata["url"], + template_url=self._put200_acceptedcanceled200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_acceptedcanceled200_initial.metadata = {"url": "/lro/put/200/accepted/canceled/200"} # type: ignore + _put200_acceptedcanceled200_initial.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore + @distributed_trace def begin_put200_acceptedcanceled200( @@ -2260,41 +2363,44 @@ def begin_put200_acceptedcanceled200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_acceptedcanceled200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_acceptedcanceled200.metadata = {"url": "/lro/put/200/accepted/canceled/200"} # type: ignore + begin_put200_acceptedcanceled200.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore def _put_no_header_in_retry_initial( self, @@ -2302,26 +2408,32 @@ def _put_no_header_in_retry_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_no_header_in_retry_request_initial( content_type=content_type, json=_json, - template_url=self._put_no_header_in_retry_initial.metadata["url"], + template_url=self._put_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2329,16 +2441,17 @@ def _put_no_header_in_retry_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers['location']=self._deserialize('str', response.headers.get('location')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_no_header_in_retry_initial.metadata = {"url": "/lro/put/noheader/202/200"} # type: ignore + _put_no_header_in_retry_initial.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore + @distributed_trace def begin_put_no_header_in_retry( @@ -2364,44 +2477,47 @@ def begin_put_no_header_in_retry( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['location']=self._deserialize('str', response.headers.get('location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_no_header_in_retry.metadata = {"url": "/lro/put/noheader/202/200"} # type: ignore + begin_put_no_header_in_retry.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore def _put_async_retry_succeeded_initial( self, @@ -2409,26 +2525,32 @@ def _put_async_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2436,20 +2558,19 @@ def _put_async_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_retry_succeeded_initial.metadata = {"url": "/lro/putasync/retry/succeeded"} # type: ignore + _put_async_retry_succeeded_initial.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_put_async_retry_succeeded( @@ -2476,48 +2597,49 @@ def begin_put_async_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_retry_succeeded.metadata = {"url": "/lro/putasync/retry/succeeded"} # type: ignore + begin_put_async_retry_succeeded.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore def _put_async_no_retry_succeeded_initial( self, @@ -2525,26 +2647,32 @@ def _put_async_no_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_no_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_no_retry_succeeded_initial.metadata["url"], + template_url=self._put_async_no_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2552,19 +2680,18 @@ def _put_async_no_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_no_retry_succeeded_initial.metadata = {"url": "/lro/putasync/noretry/succeeded"} # type: ignore + _put_async_no_retry_succeeded_initial.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore + @distributed_trace def begin_put_async_no_retry_succeeded( @@ -2591,47 +2718,48 @@ def begin_put_async_no_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_no_retry_succeeded.metadata = {"url": "/lro/putasync/noretry/succeeded"} # type: ignore + begin_put_async_no_retry_succeeded.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore def _put_async_retry_failed_initial( self, @@ -2639,26 +2767,32 @@ def _put_async_retry_failed_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_retry_failed_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_retry_failed_initial.metadata["url"], + template_url=self._put_async_retry_failed_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2666,20 +2800,19 @@ def _put_async_retry_failed_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_retry_failed_initial.metadata = {"url": "/lro/putasync/retry/failed"} # type: ignore + _put_async_retry_failed_initial.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore + @distributed_trace def begin_put_async_retry_failed( @@ -2706,48 +2839,49 @@ def begin_put_async_retry_failed( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_retry_failed.metadata = {"url": "/lro/putasync/retry/failed"} # type: ignore + begin_put_async_retry_failed.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore def _put_async_no_retrycanceled_initial( self, @@ -2755,26 +2889,32 @@ def _put_async_no_retrycanceled_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_no_retrycanceled_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_no_retrycanceled_initial.metadata["url"], + template_url=self._put_async_no_retrycanceled_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2782,19 +2922,18 @@ def _put_async_no_retrycanceled_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_no_retrycanceled_initial.metadata = {"url": "/lro/putasync/noretry/canceled"} # type: ignore + _put_async_no_retrycanceled_initial.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore + @distributed_trace def begin_put_async_no_retrycanceled( @@ -2821,47 +2960,48 @@ def begin_put_async_no_retrycanceled( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_no_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_no_retrycanceled.metadata = {"url": "/lro/putasync/noretry/canceled"} # type: ignore + begin_put_async_no_retrycanceled.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore def _put_async_no_header_in_retry_initial( self, @@ -2869,26 +3009,32 @@ def _put_async_no_header_in_retry_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_no_header_in_retry_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_no_header_in_retry_initial.metadata["url"], + template_url=self._put_async_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -2896,18 +3042,17 @@ def _put_async_no_header_in_retry_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_no_header_in_retry_initial.metadata = {"url": "/lro/putasync/noheader/201/200"} # type: ignore + _put_async_no_header_in_retry_initial.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore + @distributed_trace def begin_put_async_no_header_in_retry( @@ -2934,46 +3079,47 @@ def begin_put_async_no_header_in_retry( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_no_header_in_retry.metadata = {"url": "/lro/putasync/noheader/201/200"} # type: ignore + begin_put_async_no_header_in_retry.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore def _put_non_resource_initial( self, @@ -2981,40 +3127,47 @@ def _put_non_resource_initial( **kwargs # type: Any ): # type: (...) -> "_models.Sku" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: - _json = self._serialize.body(sku, "Sku") + _json = self._serialize.body(sku, 'Sku') else: _json = None request = build_put_non_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_resource_initial.metadata["url"], + template_url=self._put_non_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_resource_initial.metadata = {"url": "/lro/putnonresource/202/200"} # type: ignore + _put_non_resource_initial.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore + @distributed_trace def begin_put_non_resource( @@ -3039,41 +3192,44 @@ def begin_put_non_resource( :rtype: ~azure.core.polling.LROPoller[~lro.models.Sku] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_resource.metadata = {"url": "/lro/putnonresource/202/200"} # type: ignore + begin_put_non_resource.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore def _put_async_non_resource_initial( self, @@ -3081,40 +3237,47 @@ def _put_async_non_resource_initial( **kwargs # type: Any ): # type: (...) -> "_models.Sku" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: - _json = self._serialize.body(sku, "Sku") + _json = self._serialize.body(sku, 'Sku') else: _json = None request = build_put_async_non_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_non_resource_initial.metadata["url"], + template_url=self._put_async_non_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_async_non_resource_initial.metadata = {"url": "/lro/putnonresourceasync/202/200"} # type: ignore + _put_async_non_resource_initial.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore + @distributed_trace def begin_put_async_non_resource( @@ -3139,41 +3302,44 @@ def begin_put_async_non_resource( :rtype: ~azure.core.polling.LROPoller[~lro.models.Sku] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_non_resource.metadata = {"url": "/lro/putnonresourceasync/202/200"} # type: ignore + begin_put_async_non_resource.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore def _put_sub_resource_initial( self, @@ -3181,41 +3347,48 @@ def _put_sub_resource_initial( **kwargs # type: Any ): # type: (...) -> "_models.SubProduct" - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _product = _models.SubProduct(provisioning_state=provisioning_state) if _product is not None: - _json = self._serialize.body(_product, "SubProduct") + _json = self._serialize.body(_product, 'SubProduct') else: _json = None request = build_put_sub_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_sub_resource_initial.metadata["url"], + template_url=self._put_sub_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_sub_resource_initial.metadata = {"url": "/lro/putsubresource/202/200"} # type: ignore + _put_sub_resource_initial.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore + @distributed_trace def begin_put_sub_resource( @@ -3240,41 +3413,44 @@ def begin_put_sub_resource( :rtype: ~azure.core.polling.LROPoller[~lro.models.SubProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_sub_resource_initial( - provisioning_state=provisioning_state, content_type=content_type, cls=lambda x, y, z: x, **kwargs + provisioning_state=provisioning_state, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_sub_resource.metadata = {"url": "/lro/putsubresource/202/200"} # type: ignore + begin_put_sub_resource.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore def _put_async_sub_resource_initial( self, @@ -3282,41 +3458,48 @@ def _put_async_sub_resource_initial( **kwargs # type: Any ): # type: (...) -> "_models.SubProduct" - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _product = _models.SubProduct(provisioning_state=provisioning_state) if _product is not None: - _json = self._serialize.body(_product, "SubProduct") + _json = self._serialize.body(_product, 'SubProduct') else: _json = None request = build_put_async_sub_resource_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_sub_resource_initial.metadata["url"], + template_url=self._put_async_sub_resource_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_async_sub_resource_initial.metadata = {"url": "/lro/putsubresourceasync/202/200"} # type: ignore + _put_async_sub_resource_initial.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore + @distributed_trace def begin_put_async_sub_resource( @@ -3341,57 +3524,68 @@ def begin_put_async_sub_resource( :rtype: ~azure.core.polling.LROPoller[~lro.models.SubProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.SubProduct"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubProduct"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_sub_resource_initial( - provisioning_state=provisioning_state, content_type=content_type, cls=lambda x, y, z: x, **kwargs + provisioning_state=provisioning_state, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("SubProduct", pipeline_response) + deserialized = self._deserialize('SubProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_sub_resource.metadata = {"url": "/lro/putsubresourceasync/202/200"} # type: ignore + begin_put_async_sub_resource.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore def _delete_provisioning202_accepted200_succeeded_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_accepted200_succeeded_request_initial( - template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata["url"], + template_url=self._delete_provisioning202_accepted200_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3400,24 +3594,26 @@ def _delete_provisioning202_accepted200_succeeded_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_accepted200_succeeded_initial.metadata = {"url": "/lro/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + _delete_provisioning202_accepted200_succeeded_initial.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore + @distributed_trace def begin_delete_provisioning202_accepted200_succeeded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running delete request, service returns a 202 to the initial request, with an entity that @@ -3436,54 +3632,65 @@ def begin_delete_provisioning202_accepted200_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_accepted200_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_accepted200_succeeded.metadata = {"url": "/lro/delete/provisioning/202/accepted/200/succeeded"} # type: ignore + begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore def _delete_provisioning202_deleting_failed200_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_deleting_failed200_request_initial( - template_url=self._delete_provisioning202_deleting_failed200_initial.metadata["url"], + template_url=self._delete_provisioning202_deleting_failed200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3492,24 +3699,26 @@ def _delete_provisioning202_deleting_failed200_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_deleting_failed200_initial.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/failed"} # type: ignore + _delete_provisioning202_deleting_failed200_initial.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore + @distributed_trace def begin_delete_provisioning202_deleting_failed200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running delete request, service returns a 202 to the initial request, with an entity that @@ -3528,54 +3737,65 @@ def begin_delete_provisioning202_deleting_failed200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_deleting_failed200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_deleting_failed200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_deleting_failed200.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/failed"} # type: ignore + begin_delete_provisioning202_deleting_failed200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore def _delete_provisioning202_deletingcanceled200_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_provisioning202_deletingcanceled200_request_initial( - template_url=self._delete_provisioning202_deletingcanceled200_initial.metadata["url"], + template_url=self._delete_provisioning202_deletingcanceled200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3584,24 +3804,26 @@ def _delete_provisioning202_deletingcanceled200_initial( response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_provisioning202_deletingcanceled200_initial.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/canceled"} # type: ignore + _delete_provisioning202_deletingcanceled200_initial.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore + @distributed_trace def begin_delete_provisioning202_deletingcanceled200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running delete request, service returns a 202 to the initial request, with an entity that @@ -3620,54 +3842,65 @@ def begin_delete_provisioning202_deletingcanceled200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_deletingcanceled200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_deletingcanceled200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_provisioning202_deletingcanceled200.metadata = {"url": "/lro/delete/provisioning/202/deleting/200/canceled"} # type: ignore + begin_delete_provisioning202_deletingcanceled200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore def _delete204_succeeded_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete204_succeeded_request_initial( - template_url=self._delete204_succeeded_initial.metadata["url"], + template_url=self._delete204_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -3677,11 +3910,13 @@ def _delete204_succeeded_initial( if cls: return cls(pipeline_response, None, {}) - _delete204_succeeded_initial.metadata = {"url": "/lro/delete/204/succeeded"} # type: ignore + _delete204_succeeded_initial.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore + @distributed_trace def begin_delete204_succeeded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete succeeds and returns right away. @@ -3698,51 +3933,62 @@ def begin_delete204_succeeded( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete204_succeeded.metadata = {"url": "/lro/delete/204/succeeded"} # type: ignore + begin_delete204_succeeded.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore def _delete202_retry200_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional["_models.Product"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_retry200_request_initial( - template_url=self._delete202_retry200_initial.metadata["url"], + template_url=self._delete202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3752,22 +3998,25 @@ def _delete202_retry200_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete202_retry200_initial.metadata = {"url": "/lro/delete/202/retry/200"} # type: ignore + _delete202_retry200_initial.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore + @distributed_trace def begin_delete202_retry200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running delete request, service returns a 202 to the initial request. Polls return this @@ -3785,54 +4034,65 @@ def begin_delete202_retry200( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_retry200.metadata = {"url": "/lro/delete/202/retry/200"} # type: ignore + begin_delete202_retry200.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore def _delete202_no_retry204_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional["_models.Product"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_no_retry204_request_initial( - template_url=self._delete202_no_retry204_initial.metadata["url"], + template_url=self._delete202_no_retry204_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -3842,22 +4102,25 @@ def _delete202_no_retry204_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete202_no_retry204_initial.metadata = {"url": "/lro/delete/202/noretry/204"} # type: ignore + _delete202_no_retry204_initial.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore + @distributed_trace def begin_delete202_no_retry204( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running delete request, service returns a 202 to the initial request. Polls return this @@ -3875,54 +4138,65 @@ def begin_delete202_no_retry204( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_no_retry204_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_no_retry204_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_no_retry204.metadata = {"url": "/lro/delete/202/noretry/204"} # type: ignore + begin_delete202_no_retry204.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore def _delete_no_header_in_retry_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_no_header_in_retry_request_initial( - template_url=self._delete_no_header_in_retry_initial.metadata["url"], + template_url=self._delete_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -3931,16 +4205,19 @@ def _delete_no_header_in_retry_initial( response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_no_header_in_retry_initial.metadata = {"url": "/lro/delete/noheader"} # type: ignore + _delete_no_header_in_retry_initial.metadata = {'url': '/lro/delete/noheader'} # type: ignore + @distributed_trace def begin_delete_no_header_in_retry( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a location header in the initial request. @@ -3958,51 +4235,62 @@ def begin_delete_no_header_in_retry( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_no_header_in_retry.metadata = {"url": "/lro/delete/noheader"} # type: ignore + begin_delete_no_header_in_retry.metadata = {'url': '/lro/delete/noheader'} # type: ignore def _delete_async_no_header_in_retry_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_no_header_in_retry_request_initial( - template_url=self._delete_async_no_header_in_retry_initial.metadata["url"], + template_url=self._delete_async_no_header_in_retry_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -4011,16 +4299,19 @@ def _delete_async_no_header_in_retry_initial( response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_no_header_in_retry_initial.metadata = {"url": "/lro/deleteasync/noheader/202/204"} # type: ignore + _delete_async_no_header_in_retry_initial.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore + @distributed_trace def begin_delete_async_no_header_in_retry( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns an Azure-AsyncOperation header in the initial @@ -4038,51 +4329,62 @@ def begin_delete_async_no_header_in_retry( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_no_header_in_retry.metadata = {"url": "/lro/deleteasync/noheader/202/204"} # type: ignore + begin_delete_async_no_header_in_retry.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore def _delete_async_retry_succeeded_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_retry_succeeded_request_initial( - template_url=self._delete_async_retry_succeeded_initial.metadata["url"], + template_url=self._delete_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4090,20 +4392,21 @@ def _delete_async_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_retry_succeeded_initial.metadata = {"url": "/lro/deleteasync/retry/succeeded"} # type: ignore + _delete_async_retry_succeeded_initial.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_delete_async_retry_succeeded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint @@ -4121,51 +4424,62 @@ def begin_delete_async_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_retry_succeeded.metadata = {"url": "/lro/deleteasync/retry/succeeded"} # type: ignore + begin_delete_async_retry_succeeded.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore def _delete_async_no_retry_succeeded_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_no_retry_succeeded_request_initial( - template_url=self._delete_async_no_retry_succeeded_initial.metadata["url"], + template_url=self._delete_async_no_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4173,20 +4487,21 @@ def _delete_async_no_retry_succeeded_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_no_retry_succeeded_initial.metadata = {"url": "/lro/deleteasync/noretry/succeeded"} # type: ignore + _delete_async_no_retry_succeeded_initial.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore + @distributed_trace def begin_delete_async_no_retry_succeeded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint @@ -4204,51 +4519,62 @@ def begin_delete_async_no_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_no_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_no_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_no_retry_succeeded.metadata = {"url": "/lro/deleteasync/noretry/succeeded"} # type: ignore + begin_delete_async_no_retry_succeeded.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore def _delete_async_retry_failed_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_retry_failed_request_initial( - template_url=self._delete_async_retry_failed_initial.metadata["url"], + template_url=self._delete_async_retry_failed_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4256,20 +4582,21 @@ def _delete_async_retry_failed_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_retry_failed_initial.metadata = {"url": "/lro/deleteasync/retry/failed"} # type: ignore + _delete_async_retry_failed_initial.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore + @distributed_trace def begin_delete_async_retry_failed( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint @@ -4287,51 +4614,62 @@ def begin_delete_async_retry_failed( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_retry_failed_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_retry_failed_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_retry_failed.metadata = {"url": "/lro/deleteasync/retry/failed"} # type: ignore + begin_delete_async_retry_failed.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore def _delete_async_retrycanceled_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_retrycanceled_request_initial( - template_url=self._delete_async_retrycanceled_initial.metadata["url"], + template_url=self._delete_async_retrycanceled_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4339,20 +4677,21 @@ def _delete_async_retrycanceled_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_retrycanceled_initial.metadata = {"url": "/lro/deleteasync/retry/canceled"} # type: ignore + _delete_async_retrycanceled_initial.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore + @distributed_trace def begin_delete_async_retrycanceled( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint @@ -4370,51 +4709,62 @@ def begin_delete_async_retrycanceled( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_retrycanceled_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_retrycanceled_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_retrycanceled.metadata = {"url": "/lro/deleteasync/retry/canceled"} # type: ignore + begin_delete_async_retrycanceled.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore def _post200_with_payload_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Sku" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post200_with_payload_request_initial( - template_url=self._post200_with_payload_initial.metadata["url"], + template_url=self._post200_with_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -4422,21 +4772,23 @@ def _post200_with_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if response.status_code == 202: - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post200_with_payload_initial.metadata = {"url": "/lro/post/payload/200"} # type: ignore + _post200_with_payload_initial.metadata = {'url': '/lro/post/payload/200'} # type: ignore + @distributed_trace def begin_post200_with_payload( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Sku"] """Long running post request, service returns a 202 to the initial request, with 'Location' @@ -4454,38 +4806,41 @@ def begin_post200_with_payload( :rtype: ~azure.core.polling.LROPoller[~lro.models.Sku] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Sku"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Sku"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post200_with_payload_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post200_with_payload_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Sku", pipeline_response) + deserialized = self._deserialize('Sku', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post200_with_payload.metadata = {"url": "/lro/post/payload/200"} # type: ignore + begin_post200_with_payload.metadata = {'url': '/lro/post/payload/200'} # type: ignore def _post202_retry200_initial( self, @@ -4493,26 +4848,32 @@ def _post202_retry200_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry200_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry200_initial.metadata["url"], + template_url=self._post202_retry200_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4520,13 +4881,15 @@ def _post202_retry200_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry200_initial.metadata = {"url": "/lro/post/202/retry/200"} # type: ignore + _post202_retry200_initial.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore + @distributed_trace def begin_post202_retry200( @@ -4552,38 +4915,41 @@ def begin_post202_retry200( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry200.metadata = {"url": "/lro/post/202/retry/200"} # type: ignore + begin_post202_retry200.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore def _post202_no_retry204_initial( self, @@ -4591,26 +4957,32 @@ def _post202_no_retry204_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_no_retry204_request_initial( content_type=content_type, json=_json, - template_url=self._post202_no_retry204_initial.metadata["url"], + template_url=self._post202_no_retry204_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -4618,17 +4990,18 @@ def _post202_no_retry204_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post202_no_retry204_initial.metadata = {"url": "/lro/post/202/noretry/204"} # type: ignore + _post202_no_retry204_initial.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore + @distributed_trace def begin_post202_no_retry204( @@ -4654,79 +5027,92 @@ def begin_post202_no_retry204( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_no_retry204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_no_retry204.metadata = {"url": "/lro/post/202/noretry/204"} # type: ignore + begin_post202_no_retry204.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore def _post_double_headers_final_location_get_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_double_headers_final_location_get_request_initial( - template_url=self._post_double_headers_final_location_get_initial.metadata["url"], + template_url=self._post_double_headers_final_location_get_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post_double_headers_final_location_get_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalLocationGet"} # type: ignore + _post_double_headers_final_location_get_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore + @distributed_trace def begin_post_double_headers_final_location_get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running post request, service returns a 202 to the initial request with both Location and @@ -4745,72 +5131,85 @@ def begin_post_double_headers_final_location_get( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post_double_headers_final_location_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post_double_headers_final_location_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_double_headers_final_location_get.metadata = {"url": "/lro/LROPostDoubleHeadersFinalLocationGet"} # type: ignore + begin_post_double_headers_final_location_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore def _post_double_headers_final_azure_header_get_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_double_headers_final_azure_header_get_request_initial( - template_url=self._post_double_headers_final_azure_header_get_initial.metadata["url"], + template_url=self._post_double_headers_final_azure_header_get_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post_double_headers_final_azure_header_get_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGet"} # type: ignore + _post_double_headers_final_azure_header_get_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore + @distributed_trace def begin_post_double_headers_final_azure_header_get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running post request, service returns a 202 to the initial request with both Location and @@ -4829,72 +5228,85 @@ def begin_post_double_headers_final_azure_header_get( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post_double_headers_final_azure_header_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post_double_headers_final_azure_header_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_double_headers_final_azure_header_get.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGet"} # type: ignore + begin_post_double_headers_final_azure_header_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore def _post_double_headers_final_azure_header_get_default_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_double_headers_final_azure_header_get_default_request_initial( - template_url=self._post_double_headers_final_azure_header_get_default_initial.metadata["url"], + template_url=self._post_double_headers_final_azure_header_get_default_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _post_double_headers_final_azure_header_get_default_initial.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault"} # type: ignore + _post_double_headers_final_azure_header_get_default_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore + @distributed_trace def begin_post_double_headers_final_azure_header_get_default( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller["_models.Product"] """Long running post request, service returns a 202 to the initial request with both Location and @@ -4913,40 +5325,41 @@ def begin_post_double_headers_final_azure_header_get_default( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_double_headers_final_azure_header_get_default_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_double_headers_final_azure_header_get_default.metadata = {"url": "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault"} # type: ignore + begin_post_double_headers_final_azure_header_get_default.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore def _post_async_retry_succeeded_initial( self, @@ -4954,26 +5367,32 @@ def _post_async_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> Optional["_models.Product"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -4983,21 +5402,21 @@ def _post_async_retry_succeeded_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post_async_retry_succeeded_initial.metadata = {"url": "/lro/postasync/retry/succeeded"} # type: ignore + _post_async_retry_succeeded_initial.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore + @distributed_trace def begin_post_async_retry_succeeded( @@ -5024,41 +5443,44 @@ def begin_post_async_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retry_succeeded.metadata = {"url": "/lro/postasync/retry/succeeded"} # type: ignore + begin_post_async_retry_succeeded.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore def _post_async_no_retry_succeeded_initial( self, @@ -5066,26 +5488,32 @@ def _post_async_no_retry_succeeded_initial( **kwargs # type: Any ): # type: (...) -> Optional["_models.Product"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_no_retry_succeeded_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_no_retry_succeeded_initial.metadata["url"], + template_url=self._post_async_no_retry_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -5095,21 +5523,21 @@ def _post_async_no_retry_succeeded_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _post_async_no_retry_succeeded_initial.metadata = {"url": "/lro/postasync/noretry/succeeded"} # type: ignore + _post_async_no_retry_succeeded_initial.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore + @distributed_trace def begin_post_async_no_retry_succeeded( @@ -5136,41 +5564,44 @@ def begin_post_async_no_retry_succeeded( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_no_retry_succeeded.metadata = {"url": "/lro/postasync/noretry/succeeded"} # type: ignore + begin_post_async_no_retry_succeeded.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore def _post_async_retry_failed_initial( self, @@ -5178,26 +5609,32 @@ def _post_async_retry_failed_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retry_failed_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retry_failed_initial.metadata["url"], + template_url=self._post_async_retry_failed_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -5205,16 +5642,16 @@ def _post_async_retry_failed_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_retry_failed_initial.metadata = {"url": "/lro/postasync/retry/failed"} # type: ignore + _post_async_retry_failed_initial.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore + @distributed_trace def begin_post_async_retry_failed( @@ -5241,38 +5678,41 @@ def begin_post_async_retry_failed( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retry_failed.metadata = {"url": "/lro/postasync/retry/failed"} # type: ignore + begin_post_async_retry_failed.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore def _post_async_retrycanceled_initial( self, @@ -5280,26 +5720,32 @@ def _post_async_retrycanceled_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_retrycanceled_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_retrycanceled_initial.metadata["url"], + template_url=self._post_async_retrycanceled_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -5307,16 +5753,16 @@ def _post_async_retrycanceled_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_retrycanceled_initial.metadata = {"url": "/lro/postasync/retry/canceled"} # type: ignore + _post_async_retrycanceled_initial.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore + @distributed_trace def begin_post_async_retrycanceled( @@ -5343,35 +5789,38 @@ def begin_post_async_retrycanceled( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_retrycanceled.metadata = {"url": "/lro/postasync/retry/canceled"} # type: ignore + begin_post_async_retrycanceled.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py index 63bf5b23e2c..e028bfab406 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -30,9 +23,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -631,7 +623,7 @@ def build_post_async_relative_retry_invalid_json_polling_request_initial( ) # fmt: on -class LROSADsOperations(object): +class LROSADsOperations(object): # pylint: disable=too-many-public-methods """LROSADsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -659,26 +651,32 @@ def _put_non_retry400_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_non_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_retry400_initial.metadata["url"], + template_url=self._put_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -686,17 +684,18 @@ def _put_non_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/put/400"} # type: ignore + _put_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore + @distributed_trace def begin_put_non_retry400( @@ -721,41 +720,44 @@ def begin_put_non_retry400( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_retry400.metadata = {"url": "/lro/nonretryerror/put/400"} # type: ignore + begin_put_non_retry400.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore def _put_non_retry201_creating400_initial( self, @@ -763,26 +765,32 @@ def _put_non_retry201_creating400_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_non_retry201_creating400_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_retry201_creating400_initial.metadata["url"], + template_url=self._put_non_retry201_creating400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -790,17 +798,18 @@ def _put_non_retry201_creating400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_retry201_creating400_initial.metadata = {"url": "/lro/nonretryerror/put/201/creating/400"} # type: ignore + _put_non_retry201_creating400_initial.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore + @distributed_trace def begin_put_non_retry201_creating400( @@ -826,41 +835,44 @@ def begin_put_non_retry201_creating400( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_retry201_creating400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_retry201_creating400.metadata = {"url": "/lro/nonretryerror/put/201/creating/400"} # type: ignore + begin_put_non_retry201_creating400.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore def _put_non_retry201_creating400_invalid_json_initial( self, @@ -868,26 +880,32 @@ def _put_non_retry201_creating400_invalid_json_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_non_retry201_creating400_invalid_json_request_initial( content_type=content_type, json=_json, - template_url=self._put_non_retry201_creating400_invalid_json_initial.metadata["url"], + template_url=self._put_non_retry201_creating400_invalid_json_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -895,17 +913,18 @@ def _put_non_retry201_creating400_invalid_json_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_non_retry201_creating400_invalid_json_initial.metadata = {"url": "/lro/nonretryerror/put/201/creating/400/invalidjson"} # type: ignore + _put_non_retry201_creating400_invalid_json_initial.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore + @distributed_trace def begin_put_non_retry201_creating400_invalid_json( @@ -931,41 +950,44 @@ def begin_put_non_retry201_creating400_invalid_json( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_retry201_creating400_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_non_retry201_creating400_invalid_json.metadata = {"url": "/lro/nonretryerror/put/201/creating/400/invalidjson"} # type: ignore + begin_put_non_retry201_creating400_invalid_json.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore def _put_async_relative_retry400_initial( self, @@ -973,26 +995,32 @@ def _put_async_relative_retry400_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry400_initial.metadata["url"], + template_url=self._put_async_relative_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1000,20 +1028,19 @@ def _put_async_relative_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/putasync/retry/400"} # type: ignore + _put_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore + @distributed_trace def begin_put_async_relative_retry400( @@ -1039,64 +1066,73 @@ def begin_put_async_relative_retry400( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/putasync/retry/400"} # type: ignore + begin_put_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore def _delete_non_retry400_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_non_retry400_request_initial( - template_url=self._delete_non_retry400_initial.metadata["url"], + template_url=self._delete_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1104,17 +1140,20 @@ def _delete_non_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/delete/400"} # type: ignore + _delete_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore + @distributed_trace def begin_delete_non_retry400( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 400 with an error body. @@ -1131,51 +1170,62 @@ def begin_delete_non_retry400( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_non_retry400.metadata = {"url": "/lro/nonretryerror/delete/400"} # type: ignore + begin_delete_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore def _delete202_non_retry400_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_non_retry400_request_initial( - template_url=self._delete202_non_retry400_initial.metadata["url"], + template_url=self._delete202_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1183,17 +1233,20 @@ def _delete202_non_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete202_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/delete/202/retry/400"} # type: ignore + _delete202_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore + @distributed_trace def begin_delete202_non_retry400( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 with a location header. @@ -1210,51 +1263,62 @@ def begin_delete202_non_retry400( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_non_retry400.metadata = {"url": "/lro/nonretryerror/delete/202/retry/400"} # type: ignore + begin_delete202_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore def _delete_async_relative_retry400_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry400_request_initial( - template_url=self._delete_async_relative_retry400_initial.metadata["url"], + template_url=self._delete_async_relative_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1262,20 +1326,21 @@ def _delete_async_relative_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/deleteasync/retry/400"} # type: ignore + _delete_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore + @distributed_trace def begin_delete_async_relative_retry400( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint @@ -1293,35 +1358,38 @@ def begin_delete_async_relative_retry400( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/deleteasync/retry/400"} # type: ignore + begin_delete_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore def _post_non_retry400_initial( self, @@ -1329,26 +1397,32 @@ def _post_non_retry400_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_non_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._post_non_retry400_initial.metadata["url"], + template_url=self._post_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1356,13 +1430,15 @@ def _post_non_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/post/400"} # type: ignore + _post_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore + @distributed_trace def begin_post_non_retry400( @@ -1387,38 +1463,41 @@ def begin_post_non_retry400( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_non_retry400.metadata = {"url": "/lro/nonretryerror/post/400"} # type: ignore + begin_post_non_retry400.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore def _post202_non_retry400_initial( self, @@ -1426,26 +1505,32 @@ def _post202_non_retry400_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_non_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._post202_non_retry400_initial.metadata["url"], + template_url=self._post202_non_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1453,13 +1538,15 @@ def _post202_non_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_non_retry400_initial.metadata = {"url": "/lro/nonretryerror/post/202/retry/400"} # type: ignore + _post202_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore + @distributed_trace def begin_post202_non_retry400( @@ -1484,38 +1571,41 @@ def begin_post202_non_retry400( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_non_retry400.metadata = {"url": "/lro/nonretryerror/post/202/retry/400"} # type: ignore + begin_post202_non_retry400.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore def _post_async_relative_retry400_initial( self, @@ -1523,26 +1613,32 @@ def _post_async_relative_retry400_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry400_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry400_initial.metadata["url"], + template_url=self._post_async_relative_retry400_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1550,16 +1646,16 @@ def _post_async_relative_retry400_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry400_initial.metadata = {"url": "/lro/nonretryerror/postasync/retry/400"} # type: ignore + _post_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore + @distributed_trace def begin_post_async_relative_retry400( @@ -1585,38 +1681,41 @@ def begin_post_async_relative_retry400( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry400.metadata = {"url": "/lro/nonretryerror/postasync/retry/400"} # type: ignore + begin_post_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore def _put_error201_no_provisioning_state_payload_initial( self, @@ -1624,26 +1723,32 @@ def _put_error201_no_provisioning_state_payload_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_error201_no_provisioning_state_payload_request_initial( content_type=content_type, json=_json, - template_url=self._put_error201_no_provisioning_state_payload_initial.metadata["url"], + template_url=self._put_error201_no_provisioning_state_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1651,17 +1756,18 @@ def _put_error201_no_provisioning_state_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put_error201_no_provisioning_state_payload_initial.metadata = {"url": "/lro/error/put/201/noprovisioningstatepayload"} # type: ignore + _put_error201_no_provisioning_state_payload_initial.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore + @distributed_trace def begin_put_error201_no_provisioning_state_payload( @@ -1686,41 +1792,44 @@ def begin_put_error201_no_provisioning_state_payload( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_error201_no_provisioning_state_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_error201_no_provisioning_state_payload.metadata = {"url": "/lro/error/put/201/noprovisioningstatepayload"} # type: ignore + begin_put_error201_no_provisioning_state_payload.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore def _put_async_relative_retry_no_status_initial( self, @@ -1728,26 +1837,32 @@ def _put_async_relative_retry_no_status_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_no_status_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_no_status_initial.metadata["url"], + template_url=self._put_async_relative_retry_no_status_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1755,20 +1870,19 @@ def _put_async_relative_retry_no_status_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_no_status_initial.metadata = {"url": "/lro/error/putasync/retry/nostatus"} # type: ignore + _put_async_relative_retry_no_status_initial.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore + @distributed_trace def begin_put_async_relative_retry_no_status( @@ -1795,48 +1909,49 @@ def begin_put_async_relative_retry_no_status( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_no_status_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_no_status.metadata = {"url": "/lro/error/putasync/retry/nostatus"} # type: ignore + begin_put_async_relative_retry_no_status.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore def _put_async_relative_retry_no_status_payload_initial( self, @@ -1844,26 +1959,32 @@ def _put_async_relative_retry_no_status_payload_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_no_status_payload_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_no_status_payload_initial.metadata["url"], + template_url=self._put_async_relative_retry_no_status_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1871,20 +1992,19 @@ def _put_async_relative_retry_no_status_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_no_status_payload_initial.metadata = {"url": "/lro/error/putasync/retry/nostatuspayload"} # type: ignore + _put_async_relative_retry_no_status_payload_initial.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore + @distributed_trace def begin_put_async_relative_retry_no_status_payload( @@ -1911,64 +2031,73 @@ def begin_put_async_relative_retry_no_status_payload( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_no_status_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_no_status_payload.metadata = {"url": "/lro/error/putasync/retry/nostatuspayload"} # type: ignore + begin_put_async_relative_retry_no_status_payload.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore def _delete204_succeeded_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete204_succeeded_request_initial( - template_url=self._delete204_succeeded_initial.metadata["url"], + template_url=self._delete204_succeeded_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1978,11 +2107,13 @@ def _delete204_succeeded_initial( if cls: return cls(pipeline_response, None, {}) - _delete204_succeeded_initial.metadata = {"url": "/lro/error/delete/204/nolocation"} # type: ignore + _delete204_succeeded_initial.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore + @distributed_trace def begin_delete204_succeeded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 204 to the initial request, indicating success. @@ -1999,51 +2130,62 @@ def begin_delete204_succeeded( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete204_succeeded.metadata = {"url": "/lro/error/delete/204/nolocation"} # type: ignore + begin_delete204_succeeded.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore def _delete_async_relative_retry_no_status_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_no_status_request_initial( - template_url=self._delete_async_relative_retry_no_status_initial.metadata["url"], + template_url=self._delete_async_relative_retry_no_status_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2051,20 +2193,21 @@ def _delete_async_relative_retry_no_status_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_no_status_initial.metadata = {"url": "/lro/error/deleteasync/retry/nostatus"} # type: ignore + _delete_async_relative_retry_no_status_initial.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore + @distributed_trace def begin_delete_async_relative_retry_no_status( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint @@ -2082,35 +2225,38 @@ def begin_delete_async_relative_retry_no_status( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_no_status_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_no_status_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_no_status.metadata = {"url": "/lro/error/deleteasync/retry/nostatus"} # type: ignore + begin_delete_async_relative_retry_no_status.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore def _post202_no_location_initial( self, @@ -2118,26 +2264,32 @@ def _post202_no_location_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_no_location_request_initial( content_type=content_type, json=_json, - template_url=self._post202_no_location_initial.metadata["url"], + template_url=self._post202_no_location_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2145,13 +2297,15 @@ def _post202_no_location_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_no_location_initial.metadata = {"url": "/lro/error/post/202/nolocation"} # type: ignore + _post202_no_location_initial.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore + @distributed_trace def begin_post202_no_location( @@ -2177,38 +2331,41 @@ def begin_post202_no_location( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_no_location_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_no_location.metadata = {"url": "/lro/error/post/202/nolocation"} # type: ignore + begin_post202_no_location.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore def _post_async_relative_retry_no_payload_initial( self, @@ -2216,26 +2373,32 @@ def _post_async_relative_retry_no_payload_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_no_payload_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_no_payload_initial.metadata["url"], + template_url=self._post_async_relative_retry_no_payload_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2243,16 +2406,16 @@ def _post_async_relative_retry_no_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_no_payload_initial.metadata = {"url": "/lro/error/postasync/retry/nopayload"} # type: ignore + _post_async_relative_retry_no_payload_initial.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore + @distributed_trace def begin_post_async_relative_retry_no_payload( @@ -2279,38 +2442,41 @@ def begin_post_async_relative_retry_no_payload( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_no_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_no_payload.metadata = {"url": "/lro/error/postasync/retry/nopayload"} # type: ignore + begin_post_async_relative_retry_no_payload.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore def _put200_invalid_json_initial( self, @@ -2318,26 +2484,32 @@ def _put200_invalid_json_initial( **kwargs # type: Any ): # type: (...) -> Optional["_models.Product"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put200_invalid_json_request_initial( content_type=content_type, json=_json, - template_url=self._put200_invalid_json_initial.metadata["url"], + template_url=self._put200_invalid_json_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -2346,14 +2518,15 @@ def _put200_invalid_json_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _put200_invalid_json_initial.metadata = {"url": "/lro/error/put/200/invalidjson"} # type: ignore + _put200_invalid_json_initial.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore + @distributed_trace def begin_put200_invalid_json( @@ -2379,41 +2552,44 @@ def begin_put200_invalid_json( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put200_invalid_json.metadata = {"url": "/lro/error/put/200/invalidjson"} # type: ignore + begin_put200_invalid_json.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore def _put_async_relative_retry_invalid_header_initial( self, @@ -2421,26 +2597,32 @@ def _put_async_relative_retry_invalid_header_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_invalid_header_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_invalid_header_initial.metadata["url"], + template_url=self._put_async_relative_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2448,20 +2630,19 @@ def _put_async_relative_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_invalid_header_initial.metadata = {"url": "/lro/error/putasync/retry/invalidheader"} # type: ignore + _put_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore + @distributed_trace def begin_put_async_relative_retry_invalid_header( @@ -2488,48 +2669,49 @@ def begin_put_async_relative_retry_invalid_header( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/putasync/retry/invalidheader"} # type: ignore + begin_put_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore def _put_async_relative_retry_invalid_json_polling_initial( self, @@ -2537,26 +2719,32 @@ def _put_async_relative_retry_invalid_json_polling_initial( **kwargs # type: Any ): # type: (...) -> "_models.Product" - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_put_async_relative_retry_invalid_json_polling_request_initial( content_type=content_type, json=_json, - template_url=self._put_async_relative_retry_invalid_json_polling_initial.metadata["url"], + template_url=self._put_async_relative_retry_invalid_json_polling_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2564,20 +2752,19 @@ def _put_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _put_async_relative_retry_invalid_json_polling_initial.metadata = {"url": "/lro/error/putasync/retry/invalidjsonpolling"} # type: ignore + _put_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore + @distributed_trace def begin_put_async_relative_retry_invalid_json_polling( @@ -2604,64 +2791,73 @@ def begin_put_async_relative_retry_invalid_json_polling( :rtype: ~azure.core.polling.LROPoller[~lro.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = self._deserialize("Product", pipeline_response) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put_async_relative_retry_invalid_json_polling.metadata = {"url": "/lro/error/putasync/retry/invalidjsonpolling"} # type: ignore + begin_put_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore def _delete202_retry_invalid_header_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete202_retry_invalid_header_request_initial( - template_url=self._delete202_retry_invalid_header_initial.metadata["url"], + template_url=self._delete202_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2669,17 +2865,20 @@ def _delete202_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete202_retry_invalid_header_initial.metadata = {"url": "/lro/error/delete/202/retry/invalidheader"} # type: ignore + _delete202_retry_invalid_header_initial.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore + @distributed_trace def begin_delete202_retry_invalid_header( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request receing a reponse @@ -2697,51 +2896,62 @@ def begin_delete202_retry_invalid_header( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete202_retry_invalid_header.metadata = {"url": "/lro/error/delete/202/retry/invalidheader"} # type: ignore + begin_delete202_retry_invalid_header.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore def _delete_async_relative_retry_invalid_header_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_invalid_header_request_initial( - template_url=self._delete_async_relative_retry_invalid_header_initial.metadata["url"], + template_url=self._delete_async_relative_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2749,20 +2959,21 @@ def _delete_async_relative_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_invalid_header_initial.metadata = {"url": "/lro/error/deleteasync/retry/invalidheader"} # type: ignore + _delete_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore + @distributed_trace def begin_delete_async_relative_retry_invalid_header( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. The endpoint @@ -2780,51 +2991,62 @@ def begin_delete_async_relative_retry_invalid_header( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/deleteasync/retry/invalidheader"} # type: ignore + begin_delete_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore def _delete_async_relative_retry_invalid_json_polling_initial( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_delete_async_relative_retry_invalid_json_polling_request_initial( - template_url=self._delete_async_relative_retry_invalid_json_polling_initial.metadata["url"], + template_url=self._delete_async_relative_retry_invalid_json_polling_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2832,20 +3054,21 @@ def _delete_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _delete_async_relative_retry_invalid_json_polling_initial.metadata = {"url": "/lro/error/deleteasync/retry/invalidjsonpolling"} # type: ignore + _delete_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore + @distributed_trace def begin_delete_async_relative_retry_invalid_json_polling( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint @@ -2863,35 +3086,38 @@ def begin_delete_async_relative_retry_invalid_json_polling( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_invalid_json_polling_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_invalid_json_polling_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_async_relative_retry_invalid_json_polling.metadata = {"url": "/lro/error/deleteasync/retry/invalidjsonpolling"} # type: ignore + begin_delete_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore def _post202_retry_invalid_header_initial( self, @@ -2899,26 +3125,32 @@ def _post202_retry_invalid_header_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post202_retry_invalid_header_request_initial( content_type=content_type, json=_json, - template_url=self._post202_retry_invalid_header_initial.metadata["url"], + template_url=self._post202_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -2926,13 +3158,15 @@ def _post202_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post202_retry_invalid_header_initial.metadata = {"url": "/lro/error/post/202/retry/invalidheader"} # type: ignore + _post202_retry_invalid_header_initial.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore + @distributed_trace def begin_post202_retry_invalid_header( @@ -2958,38 +3192,41 @@ def begin_post202_retry_invalid_header( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post202_retry_invalid_header.metadata = {"url": "/lro/error/post/202/retry/invalidheader"} # type: ignore + begin_post202_retry_invalid_header.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore def _post_async_relative_retry_invalid_header_initial( self, @@ -2997,26 +3234,32 @@ def _post_async_relative_retry_invalid_header_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_invalid_header_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_invalid_header_initial.metadata["url"], + template_url=self._post_async_relative_retry_invalid_header_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -3024,16 +3267,16 @@ def _post_async_relative_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_invalid_header_initial.metadata = {"url": "/lro/error/postasync/retry/invalidheader"} # type: ignore + _post_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore + @distributed_trace def begin_post_async_relative_retry_invalid_header( @@ -3060,38 +3303,41 @@ def begin_post_async_relative_retry_invalid_header( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_invalid_header.metadata = {"url": "/lro/error/postasync/retry/invalidheader"} # type: ignore + begin_post_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore def _post_async_relative_retry_invalid_json_polling_initial( self, @@ -3099,26 +3345,32 @@ def _post_async_relative_retry_invalid_json_polling_initial( **kwargs # type: Any ): # type: (...) -> None - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: - _json = self._serialize.body(product, "Product") + _json = self._serialize.body(product, 'Product') else: _json = None request = build_post_async_relative_retry_invalid_json_polling_request_initial( content_type=content_type, json=_json, - template_url=self._post_async_relative_retry_invalid_json_polling_initial.metadata["url"], + template_url=self._post_async_relative_retry_invalid_json_polling_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -3126,16 +3378,16 @@ def _post_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) - _post_async_relative_retry_invalid_json_polling_initial.metadata = {"url": "/lro/error/postasync/retry/invalidjsonpolling"} # type: ignore + _post_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore + @distributed_trace def begin_post_async_relative_retry_invalid_json_polling( @@ -3162,35 +3414,38 @@ def begin_post_async_relative_retry_invalid_json_polling( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_post_async_relative_retry_invalid_json_polling.metadata = {"url": "/lro/error/postasync/retry/invalidjsonpolling"} # type: ignore + begin_post_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py index 226e1d293dc..73e7389d758 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Long-running Operation for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/__init__.py index 20185994f95..f347f9b0b0d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["LROWithParamaterizedEndpoints"] +__all__ = ['LROWithParamaterizedEndpoints'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_configuration.py index a0f5369c24e..d85e80270ec 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_configuration.py @@ -18,13 +18,14 @@ from typing import Any -class LROWithParamaterizedEndpointsConfiguration(Configuration): +class LROWithParamaterizedEndpointsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LROWithParamaterizedEndpoints. Note that all parameters used to create this instance are saved as instance attributes. - :param host: A string value that is used as a global part of the parameterized host. Pass in 'host:3000' to pass test. + :param host: A string value that is used as a global part of the parameterized host. Pass in + 'host:3000' to pass test. :type host: str """ @@ -39,19 +40,20 @@ def __init__( raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "lrowithparamaterizedendpoints/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'lrowithparamaterizedendpoints/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py index 0e28b0d0bea..06416bdf26c 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py @@ -22,7 +22,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class LROWithParamaterizedEndpoints(LROWithParamaterizedEndpointsOperationsMixin): """Test Infrastructure for AutoRest. @@ -39,7 +38,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - _base_url = "http://{accountName}{host}" + _base_url = 'http://{accountName}{host}' self._config = LROWithParamaterizedEndpointsConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -48,6 +47,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest @@ -73,7 +73,7 @@ def _send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/__init__.py index c083144aca2..53484dfaccb 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._lro_with_paramaterized_endpoints import LROWithParamaterizedEndpoints - -__all__ = ["LROWithParamaterizedEndpoints"] +__all__ = ['LROWithParamaterizedEndpoints'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_configuration.py index 1b2efaf32f1..1aeee6aaf3d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_configuration.py @@ -14,32 +14,40 @@ from .._version import VERSION -class LROWithParamaterizedEndpointsConfiguration(Configuration): +class LROWithParamaterizedEndpointsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LROWithParamaterizedEndpoints. Note that all parameters used to create this instance are saved as instance attributes. - :param host: A string value that is used as a global part of the parameterized host. Pass in 'host:3000' to pass test. + :param host: A string value that is used as a global part of the parameterized host. Pass in + 'host:3000' to pass test. :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(LROWithParamaterizedEndpointsConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "lrowithparamaterizedendpoints/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'lrowithparamaterizedendpoints/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py index 2514a089302..c23d206cb64 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py @@ -17,7 +17,6 @@ from ._configuration import LROWithParamaterizedEndpointsConfiguration from .operations import LROWithParamaterizedEndpointsOperationsMixin - class LROWithParamaterizedEndpoints(LROWithParamaterizedEndpointsOperationsMixin): """Test Infrastructure for AutoRest. @@ -28,8 +27,12 @@ class LROWithParamaterizedEndpoints(LROWithParamaterizedEndpointsOperationsMixin Retry-After header is present. """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _base_url = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _base_url = 'http://{accountName}{host}' self._config = LROWithParamaterizedEndpointsConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -38,7 +41,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -58,7 +66,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/__init__.py index a2bafefd874..c395bec102b 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._lro_with_paramaterized_endpoints_operations import LROWithParamaterizedEndpointsOperationsMixin __all__ = [ - "LROWithParamaterizedEndpointsOperationsMixin", + 'LROWithParamaterizedEndpointsOperationsMixin', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py index 87de58fb5d1..56eed52d46e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -25,32 +18,39 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._lro_with_paramaterized_endpoints_operations import ( - build_poll_with_constant_parameterized_endpoints_request_initial, - build_poll_with_parameterized_endpoints_request_initial, -) - -T = TypeVar("T") +from ...operations._lro_with_paramaterized_endpoints_operations import build_poll_with_constant_parameterized_endpoints_request_initial, build_poll_with_parameterized_endpoints_request_initial +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class LROWithParamaterizedEndpointsOperationsMixin: - async def _poll_with_parameterized_endpoints_initial(self, account_name: str, **kwargs: Any) -> Optional[str]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _poll_with_parameterized_endpoints_initial( + self, + account_name: str, + **kwargs: Any + ) -> Optional[str]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + request = build_poll_with_parameterized_endpoints_request_initial( - template_url=self._poll_with_parameterized_endpoints_initial.metadata["url"], + template_url=self._poll_with_parameterized_endpoints_initial.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -60,20 +60,26 @@ async def _poll_with_parameterized_endpoints_initial(self, account_name: str, ** deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _poll_with_parameterized_endpoints_initial.metadata = {"url": "/lroParameterizedEndpoints"} # type: ignore + _poll_with_parameterized_endpoints_initial.metadata = {'url': '/lroParameterizedEndpoints'} # type: ignore + @distributed_trace_async - async def begin_poll_with_parameterized_endpoints(self, account_name: str, **kwargs: Any) -> AsyncLROPoller[str]: + async def begin_poll_with_parameterized_endpoints( + self, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[str]: """Poll with method and client level parameters in endpoint. :param account_name: Account Name. Pass in 'local' to pass test. @@ -90,72 +96,78 @@ async def begin_poll_with_parameterized_endpoints(self, account_name: str, **kwa :rtype: ~azure.core.polling.AsyncLROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._poll_with_parameterized_endpoints_initial( - account_name=account_name, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = AsyncLROBasePolling( - lro_delay, - lro_options={"final-state-via": "location"}, - path_format_arguments=path_format_arguments, - **kwargs - ) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_poll_with_parameterized_endpoints.metadata = {"url": "/lroParameterizedEndpoints"} # type: ignore + begin_poll_with_parameterized_endpoints.metadata = {'url': '/lroParameterizedEndpoints'} # type: ignore async def _poll_with_constant_parameterized_endpoints_initial( - self, account_name: str, **kwargs: Any + self, + account_name: str, + **kwargs: Any ) -> Optional[str]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + request = build_poll_with_constant_parameterized_endpoints_request_initial( constant_parameter=constant_parameter, - template_url=self._poll_with_constant_parameterized_endpoints_initial.metadata["url"], + template_url=self._poll_with_constant_parameterized_endpoints_initial.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -165,21 +177,25 @@ async def _poll_with_constant_parameterized_endpoints_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _poll_with_constant_parameterized_endpoints_initial.metadata = {"url": "/lroConstantParameterizedEndpoints/{constantParameter}"} # type: ignore + _poll_with_constant_parameterized_endpoints_initial.metadata = {'url': '/lroConstantParameterizedEndpoints/{constantParameter}'} # type: ignore + @distributed_trace_async async def begin_poll_with_constant_parameterized_endpoints( - self, account_name: str, **kwargs: Any + self, + account_name: str, + **kwargs: Any ) -> AsyncLROPoller[str]: """Poll with method and client level parameters in endpoint, with a constant value. @@ -200,43 +216,46 @@ async def begin_poll_with_constant_parameterized_endpoints( :rtype: ~azure.core.polling.AsyncLROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._poll_with_constant_parameterized_endpoints_initial( - account_name=account_name, constant_parameter=constant_parameter, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + constant_parameter=constant_parameter, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_poll_with_constant_parameterized_endpoints.metadata = {"url": "/lroConstantParameterizedEndpoints/{constantParameter}"} # type: ignore + begin_poll_with_constant_parameterized_endpoints.metadata = {'url': '/lroConstantParameterizedEndpoints/{constantParameter}'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/__init__.py index a2bafefd874..c395bec102b 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/__init__.py @@ -9,5 +9,5 @@ from ._lro_with_paramaterized_endpoints_operations import LROWithParamaterizedEndpointsOperationsMixin __all__ = [ - "LROWithParamaterizedEndpointsOperationsMixin", + 'LROWithParamaterizedEndpointsOperationsMixin', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py index a7f5037f73f..a5e3d56b552 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -29,9 +22,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -86,27 +78,35 @@ def build_poll_with_constant_parameterized_endpoints_request_initial( # fmt: on class LROWithParamaterizedEndpointsOperationsMixin(object): + def _poll_with_parameterized_endpoints_initial( self, account_name, # type: str **kwargs # type: Any ): # type: (...) -> Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_poll_with_parameterized_endpoints_request_initial( - template_url=self._poll_with_parameterized_endpoints_initial.metadata["url"], + template_url=self._poll_with_parameterized_endpoints_initial.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -116,17 +116,19 @@ def _poll_with_parameterized_endpoints_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _poll_with_parameterized_endpoints_initial.metadata = {"url": "/lroParameterizedEndpoints"} # type: ignore + _poll_with_parameterized_endpoints_initial.metadata = {'url': '/lroParameterizedEndpoints'} # type: ignore + @distributed_trace def begin_poll_with_parameterized_endpoints( @@ -151,50 +153,47 @@ def begin_poll_with_parameterized_endpoints( :rtype: ~azure.core.polling.LROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._poll_with_parameterized_endpoints_initial( - account_name=account_name, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = LROBasePolling( - lro_delay, - lro_options={"final-state-via": "location"}, - path_format_arguments=path_format_arguments, - **kwargs - ) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_poll_with_parameterized_endpoints.metadata = {"url": "/lroParameterizedEndpoints"} # type: ignore + begin_poll_with_parameterized_endpoints.metadata = {'url': '/lroParameterizedEndpoints'} # type: ignore def _poll_with_constant_parameterized_endpoints_initial( self, @@ -202,24 +201,31 @@ def _poll_with_constant_parameterized_endpoints_initial( **kwargs # type: Any ): # type: (...) -> Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + request = build_poll_with_constant_parameterized_endpoints_request_initial( constant_parameter=constant_parameter, - template_url=self._poll_with_constant_parameterized_endpoints_initial.metadata["url"], + template_url=self._poll_with_constant_parameterized_endpoints_initial.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -229,17 +235,19 @@ def _poll_with_constant_parameterized_endpoints_initial( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - _poll_with_constant_parameterized_endpoints_initial.metadata = {"url": "/lroConstantParameterizedEndpoints/{constantParameter}"} # type: ignore + _poll_with_constant_parameterized_endpoints_initial.metadata = {'url': '/lroConstantParameterizedEndpoints/{constantParameter}'} # type: ignore + @distributed_trace def begin_poll_with_constant_parameterized_endpoints( @@ -267,43 +275,46 @@ def begin_poll_with_constant_parameterized_endpoints( :rtype: ~azure.core.polling.LROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._poll_with_constant_parameterized_endpoints_initial( - account_name=account_name, constant_parameter=constant_parameter, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + constant_parameter=constant_parameter, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_poll_with_constant_parameterized_endpoints.metadata = {"url": "/lroConstantParameterizedEndpoints/{constantParameter}"} # type: ignore + begin_poll_with_constant_parameterized_endpoints.metadata = {'url': '/lroConstantParameterizedEndpoints/{constantParameter}'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py index c0c7a324c37..17f17459445 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/__init__.py index e8e67b959c7..f0189aa1367 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py index f14ff44b785..3c21eef0b70 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestPagingTestService(object): """Long-running Operation for AutoRest. @@ -49,6 +48,7 @@ def __init__( self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_configuration.py index 1e57648004b..c09e33cf6a6 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestPagingTestServiceConfiguration(Configuration): +class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestPagingTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestPagingTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestpagingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestpagingtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/__init__.py index deb5dd54332..f9327b479e8 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_paging_test_service import AutoRestPagingTestService - -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py index a02c7c5b762..c17e0674747 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations - class AutoRestPagingTestService: """Long-running Operation for AutoRest. @@ -29,7 +28,11 @@ class AutoRestPagingTestService: Retry-After header is present. """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestPagingTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -39,7 +42,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_configuration.py index e39ce7a3614..5b32ba327e5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestPagingTestServiceConfiguration(Configuration): +class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestPagingTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestpagingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestpagingtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/__init__.py index 8e128dd3d8e..9a5b2005928 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._paging_operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py index 68988775268..4887783bb9f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -27,33 +20,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._paging_operations import ( - build_first_response_empty_request, - build_get_multiple_pages_failure_request, - build_get_multiple_pages_failure_uri_request, - build_get_multiple_pages_fragment_next_link_request, - build_get_multiple_pages_fragment_with_grouping_next_link_request, - build_get_multiple_pages_lro_request_initial, - build_get_multiple_pages_request, - build_get_multiple_pages_retry_first_request, - build_get_multiple_pages_retry_second_request, - build_get_multiple_pages_with_offset_request, - build_get_no_item_name_pages_request, - build_get_null_next_link_name_pages_request, - build_get_odata_multiple_pages_request, - build_get_paging_model_with_item_name_with_xms_client_name_request, - build_get_single_pages_failure_request, - build_get_single_pages_request, - build_get_with_query_params_request, - build_next_fragment_request, - build_next_fragment_with_grouping_request, - build_next_operation_with_query_params_request, -) - -T = TypeVar("T") +from ...operations._paging_operations import build_first_response_empty_request, build_get_multiple_pages_failure_request, build_get_multiple_pages_failure_uri_request, build_get_multiple_pages_fragment_next_link_request, build_get_multiple_pages_fragment_with_grouping_next_link_request, build_get_multiple_pages_lro_request_initial, build_get_multiple_pages_request, build_get_multiple_pages_retry_first_request, build_get_multiple_pages_retry_second_request, build_get_multiple_pages_with_offset_request, build_get_no_item_name_pages_request, build_get_null_next_link_name_pages_request, build_get_odata_multiple_pages_request, build_get_paging_model_with_item_name_with_xms_client_name_request, build_get_single_pages_failure_request, build_get_single_pages_request, build_get_with_query_params_request, build_next_fragment_request, build_next_fragment_with_grouping_request, build_next_operation_with_query_params_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PagingOperations: """PagingOperations async operations. @@ -77,7 +47,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace - def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable["_models.ProductResultValue"]: + def get_no_item_name_pages( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResultValue"]: """A paging operation that must return result of the default 'value' node. :keyword callable cls: A custom type or function that will be passed the direct response @@ -85,21 +58,22 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable["_models.Produc :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResultValue] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResultValue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResultValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_no_item_name_pages_request( - template_url=self.get_no_item_name_pages.metadata["url"], + template_url=self.get_no_item_name_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_no_item_name_pages_request( template_url=next_link, ) @@ -118,7 +92,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,12 +105,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_no_item_name_pages.metadata = {"url": "/paging/noitemname"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_no_item_name_pages.metadata = {'url': '/paging/noitemname'} # type: ignore @distributed_trace - def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_null_next_link_name_pages( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that must ignore any kind of nextLink, and stop after page 1. :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,21 +123,22 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_models :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_null_next_link_name_pages_request( - template_url=self.get_null_next_link_name_pages.metadata["url"], + template_url=self.get_null_next_link_name_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_null_next_link_name_pages_request( template_url=next_link, ) @@ -173,7 +157,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -182,12 +170,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_null_next_link_name_pages.metadata = {"url": "/paging/nullnextlink"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_null_next_link_name_pages.metadata = {'url': '/paging/nullnextlink'} # type: ignore @distributed_trace - def get_single_pages(self, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_single_pages( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that finishes on the first call without a nextlink. :keyword callable cls: A custom type or function that will be passed the direct response @@ -195,21 +188,22 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable["_models.ProductResul :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_single_pages_request( - template_url=self.get_single_pages.metadata["url"], + template_url=self.get_single_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_single_pages_request( template_url=next_link, ) @@ -228,7 +222,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -237,12 +235,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_single_pages.metadata = {"url": "/paging/single"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_single_pages.metadata = {'url': '/paging/single'} # type: ignore @distributed_trace - def first_response_empty(self, **kwargs: Any) -> AsyncIterable["_models.ProductResultValue"]: + def first_response_empty( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResultValue"]: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. @@ -251,21 +254,22 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable["_models.ProductR :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResultValue] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResultValue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResultValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_first_response_empty_request( - template_url=self.first_response_empty.metadata["url"], + template_url=self.first_response_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_first_response_empty_request( template_url=next_link, ) @@ -284,7 +288,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -293,9 +301,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - first_response_empty.metadata = {"url": "/paging/firstResponseEmpty/1"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + first_response_empty.metadata = {'url': '/paging/firstResponseEmpty/1'} # type: ignore @distributed_trace def get_multiple_pages( @@ -315,10 +325,11 @@ def get_multiple_pages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -326,12 +337,12 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_options is not None: _maxresults = paging_get_multiple_pages_options.maxresults _timeout = paging_get_multiple_pages_options.timeout - + request = build_get_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.get_multiple_pages.metadata["url"], + template_url=self.get_multiple_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -342,7 +353,7 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_options is not None: _maxresults = paging_get_multiple_pages_options.maxresults _timeout = paging_get_multiple_pages_options.timeout - + request = build_get_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, @@ -364,7 +375,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,13 +388,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages.metadata = {"url": "/paging/multiple"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages.metadata = {'url': '/paging/multiple'} # type: ignore @distributed_trace def get_with_query_params( - self, required_query_parameter: int, **kwargs: Any + self, + required_query_parameter: int, + **kwargs: Any ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -396,28 +415,29 @@ def get_with_query_params( :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - query_constant = kwargs.pop("query_constant", True) # type: bool - - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + query_constant = kwargs.pop('query_constant', True) # type: bool + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_with_query_params_request( query_constant=query_constant, required_query_parameter=required_query_parameter, - template_url=self.get_with_query_params.metadata["url"], + template_url=self.get_with_query_params.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_next_operation_with_query_params_request( query_constant=query_constant, - template_url="/paging/multiple/nextOperationWithQueryParams", + template_url='/paging/multiple/nextOperationWithQueryParams', ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -434,7 +454,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -443,9 +467,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_with_query_params.metadata = {"url": "/paging/multiple/getWithQueryParams"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_with_query_params.metadata = {'url': '/paging/multiple/getWithQueryParams'} # type: ignore @distributed_trace def get_odata_multiple_pages( @@ -466,10 +492,11 @@ def get_odata_multiple_pages( :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.OdataProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.OdataProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.OdataProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -477,12 +504,12 @@ def prepare_request(next_link=None): if paging_get_odata_multiple_pages_options is not None: _maxresults = paging_get_odata_multiple_pages_options.maxresults _timeout = paging_get_odata_multiple_pages_options.timeout - + request = build_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.get_odata_multiple_pages.metadata["url"], + template_url=self.get_odata_multiple_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -493,7 +520,7 @@ def prepare_request(next_link=None): if paging_get_odata_multiple_pages_options is not None: _maxresults = paging_get_odata_multiple_pages_options.maxresults _timeout = paging_get_odata_multiple_pages_options.timeout - + request = build_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, @@ -515,7 +542,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -524,9 +555,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_odata_multiple_pages.metadata = {"url": "/paging/multiple/odata"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_odata_multiple_pages.metadata = {'url': '/paging/multiple/odata'} # type: ignore @distributed_trace def get_multiple_pages_with_offset( @@ -547,10 +580,11 @@ def get_multiple_pages_with_offset( :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -560,13 +594,13 @@ def prepare_request(next_link=None): _maxresults = paging_get_multiple_pages_with_offset_options.maxresults _offset = paging_get_multiple_pages_with_offset_options.offset _timeout = paging_get_multiple_pages_with_offset_options.timeout - + request = build_get_multiple_pages_with_offset_request( offset=_offset, client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.get_multiple_pages_with_offset.metadata["url"], + template_url=self.get_multiple_pages_with_offset.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -579,7 +613,7 @@ def prepare_request(next_link=None): _maxresults = paging_get_multiple_pages_with_offset_options.maxresults _offset = paging_get_multiple_pages_with_offset_options.offset _timeout = paging_get_multiple_pages_with_offset_options.timeout - + request = build_get_multiple_pages_with_offset_request( offset=_offset, client_request_id=client_request_id, @@ -602,7 +636,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -611,12 +649,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages_with_offset.metadata = {"url": "/paging/multiple/withpath/{offset}"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages_with_offset.metadata = {'url': '/paging/multiple/withpath/{offset}'} # type: ignore @distributed_trace - def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_multiple_pages_retry_first( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. @@ -625,21 +668,22 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable["_model :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_retry_first_request( - template_url=self.get_multiple_pages_retry_first.metadata["url"], + template_url=self.get_multiple_pages_retry_first.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_retry_first_request( template_url=next_link, ) @@ -658,7 +702,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -667,12 +715,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages_retry_first.metadata = {"url": "/paging/multiple/retryfirst"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages_retry_first.metadata = {'url': '/paging/multiple/retryfirst'} # type: ignore @distributed_trace - def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_multiple_pages_retry_second( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. @@ -681,21 +734,22 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable["_mode :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_retry_second_request( - template_url=self.get_multiple_pages_retry_second.metadata["url"], + template_url=self.get_multiple_pages_retry_second.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_retry_second_request( template_url=next_link, ) @@ -714,7 +768,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -723,12 +781,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages_retry_second.metadata = {"url": "/paging/multiple/retrysecond"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages_retry_second.metadata = {'url': '/paging/multiple/retrysecond'} # type: ignore @distributed_trace - def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_single_pages_failure( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that receives a 400 on the first call. :keyword callable cls: A custom type or function that will be passed the direct response @@ -736,21 +799,22 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Prod :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_single_pages_failure_request( - template_url=self.get_single_pages_failure.metadata["url"], + template_url=self.get_single_pages_failure.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_single_pages_failure_request( template_url=next_link, ) @@ -769,7 +833,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -778,12 +846,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_single_pages_failure.metadata = {"url": "/paging/single/failure"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_single_pages_failure.metadata = {'url': '/paging/single/failure'} # type: ignore @distributed_trace - def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_multiple_pages_failure( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that receives a 400 on the second call. :keyword callable cls: A custom type or function that will be passed the direct response @@ -791,21 +864,22 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Pr :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_failure_request( - template_url=self.get_multiple_pages_failure.metadata["url"], + template_url=self.get_multiple_pages_failure.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_failure_request( template_url=next_link, ) @@ -824,7 +898,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -833,12 +911,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages_failure.metadata = {"url": "/paging/multiple/failure"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages_failure.metadata = {'url': '/paging/multiple/failure'} # type: ignore @distributed_trace - def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable["_models.ProductResult"]: + def get_multiple_pages_failure_uri( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProductResult"]: """A paging operation that receives an invalid nextLink. :keyword callable cls: A custom type or function that will be passed the direct response @@ -846,21 +929,22 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable["_model :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_failure_uri_request( - template_url=self.get_multiple_pages_failure_uri.metadata["url"], + template_url=self.get_multiple_pages_failure_uri.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_failure_uri_request( template_url=next_link, ) @@ -879,7 +963,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -888,13 +976,18 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages_failure_uri.metadata = {"url": "/paging/multiple/failureuri"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages_failure_uri.metadata = {'url': '/paging/multiple/failureuri'} # type: ignore @distributed_trace def get_multiple_pages_fragment_next_link( - self, api_version: str, tenant: str, **kwargs: Any + self, + api_version: str, + tenant: str, + **kwargs: Any ) -> AsyncIterable["_models.OdataProductResult"]: """A paging operation that doesn't return a full URL, just a fragment. @@ -907,28 +1000,29 @@ def get_multiple_pages_fragment_next_link( :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.OdataProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.OdataProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.OdataProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_fragment_next_link_request( tenant=tenant, api_version=api_version, - template_url=self.get_multiple_pages_fragment_next_link.metadata["url"], + template_url=self.get_multiple_pages_fragment_next_link.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_next_fragment_request( tenant=tenant, next_link=next_link, api_version=api_version, - template_url="/paging/multiple/fragment/{tenant}/{nextLink}", + template_url='/paging/multiple/fragment/{tenant}/{nextLink}', ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -945,7 +1039,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -954,13 +1052,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages_fragment_next_link.metadata = {"url": "/paging/multiple/fragment/{tenant}"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages_fragment_next_link.metadata = {'url': '/paging/multiple/fragment/{tenant}'} # type: ignore @distributed_trace def get_multiple_pages_fragment_with_grouping_next_link( - self, custom_parameter_group: "_models.CustomParameterGroup", **kwargs: Any + self, + custom_parameter_group: "_models.CustomParameterGroup", + **kwargs: Any ) -> AsyncIterable["_models.OdataProductResult"]: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. @@ -971,10 +1073,11 @@ def get_multiple_pages_fragment_with_grouping_next_link( :rtype: ~azure.core.async_paging.AsyncItemPaged[~paging.models.OdataProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.OdataProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.OdataProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _api_version = None @@ -982,11 +1085,11 @@ def prepare_request(next_link=None): if custom_parameter_group is not None: _api_version = custom_parameter_group.api_version _tenant = custom_parameter_group.tenant - + request = build_get_multiple_pages_fragment_with_grouping_next_link_request( tenant=_tenant, api_version=_api_version, - template_url=self.get_multiple_pages_fragment_with_grouping_next_link.metadata["url"], + template_url=self.get_multiple_pages_fragment_with_grouping_next_link.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -997,12 +1100,12 @@ def prepare_request(next_link=None): if custom_parameter_group is not None: _api_version = custom_parameter_group.api_version _tenant = custom_parameter_group.tenant - + request = build_next_fragment_with_grouping_request( tenant=_tenant, next_link=next_link, api_version=_api_version, - template_url="/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}", + template_url='/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}', ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1019,7 +1122,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1028,9 +1135,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_multiple_pages_fragment_with_grouping_next_link.metadata = {"url": "/paging/multiple/fragmentwithgrouping/{tenant}"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_multiple_pages_fragment_with_grouping_next_link.metadata = {'url': '/paging/multiple/fragmentwithgrouping/{tenant}'} # type: ignore async def _get_multiple_pages_lro_initial( self, @@ -1038,9 +1147,11 @@ async def _get_multiple_pages_lro_initial( paging_get_multiple_pages_lro_options: Optional["_models.PagingGetMultiplePagesLroOptions"] = None, **kwargs: Any ) -> "_models.ProductResult": - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _maxresults = None _timeout = None @@ -1052,26 +1163,31 @@ async def _get_multiple_pages_lro_initial( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self._get_multiple_pages_lro_initial.metadata["url"], + template_url=self._get_multiple_pages_lro_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ProductResult", pipeline_response) + deserialized = self._deserialize('ProductResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _get_multiple_pages_lro_initial.metadata = {"url": "/paging/multiple/lro"} # type: ignore + _get_multiple_pages_lro_initial.metadata = {'url': '/paging/multiple/lro'} # type: ignore + @distributed_trace_async async def begin_get_multiple_pages_lro( @@ -1101,10 +1217,11 @@ async def begin_get_multiple_pages_lro( :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -1112,12 +1229,12 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_lro_options is not None: _maxresults = paging_get_multiple_pages_lro_options.maxresults _timeout = paging_get_multiple_pages_lro_options.timeout - + request = build_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.begin_get_multiple_pages_lro.metadata["url"], + template_url=self.begin_get_multiple_pages_lro.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1128,7 +1245,7 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_lro_options is not None: _maxresults = paging_get_multiple_pages_lro_options.maxresults _timeout = paging_get_multiple_pages_lro_options.timeout - + request = build_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=_maxresults, @@ -1150,7 +1267,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1159,49 +1280,52 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._get_multiple_pages_lro_initial( client_request_id=client_request_id, paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return await get_next(next_link) + return await get_next(next_link) - return AsyncItemPaged(internal_get_next, extract_data) + return AsyncItemPaged( + internal_get_next, extract_data + ) - if polling is True: - polling_method = AsyncLROBasePolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_get_multiple_pages_lro.metadata = {'url': '/paging/multiple/lro'} # type: ignore - begin_get_multiple_pages_lro.metadata = {"url": "/paging/multiple/lro"} # type: ignore @distributed_trace def get_paging_model_with_item_name_with_xms_client_name( - self, **kwargs: Any + self, + **kwargs: Any ) -> AsyncIterable["_models.ProductResultValueWithXMSClientName"]: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. @@ -1213,21 +1337,22 @@ def get_paging_model_with_item_name_with_xms_client_name( ~azure.core.async_paging.AsyncItemPaged[~paging.models.ProductResultValueWithXMSClientName] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResultValueWithXMSClientName"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResultValueWithXMSClientName"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_paging_model_with_item_name_with_xms_client_name_request( - template_url=self.get_paging_model_with_item_name_with_xms_client_name.metadata["url"], + template_url=self.get_paging_model_with_item_name_with_xms_client_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_paging_model_with_item_name_with_xms_client_name_request( template_url=next_link, ) @@ -1246,7 +1371,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1255,6 +1384,8 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - get_paging_model_with_item_name_with_xms_client_name.metadata = {"url": "/paging/itemNameWithXMSClientName"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + get_paging_model_with_item_name_with_xms_client_name.metadata = {'url': '/paging/itemNameWithXMSClientName'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py index 4f30b92663c..865518351bf 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py @@ -38,17 +38,17 @@ ) __all__ = [ - "CustomParameterGroup", - "OdataProductResult", - "OperationResult", - "PagingGetMultiplePagesLroOptions", - "PagingGetMultiplePagesOptions", - "PagingGetMultiplePagesWithOffsetOptions", - "PagingGetOdataMultiplePagesOptions", - "Product", - "ProductProperties", - "ProductResult", - "ProductResultValue", - "ProductResultValueWithXMSClientName", - "OperationResultStatus", + 'CustomParameterGroup', + 'OdataProductResult', + 'OperationResult', + 'PagingGetMultiplePagesLroOptions', + 'PagingGetMultiplePagesOptions', + 'PagingGetMultiplePagesWithOffsetOptions', + 'PagingGetOdataMultiplePagesOptions', + 'Product', + 'ProductProperties', + 'ProductResult', + 'ProductResultValue', + 'ProductResultValueWithXMSClientName', + 'OperationResultStatus', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_auto_rest_paging_test_service_enums.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_auto_rest_paging_test_service_enums.py index 76a0c9dec31..e1fb240ac9f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_auto_rest_paging_test_service_enums.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_auto_rest_paging_test_service_enums.py @@ -12,7 +12,8 @@ class OperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The status of the request""" + """The status of the request + """ SUCCEEDED = "Succeeded" FAILED = "Failed" diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models.py index 4f38ff10968..0108c4fe32c 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models.py @@ -21,16 +21,19 @@ class CustomParameterGroup(msrest.serialization.Model): """ _validation = { - "api_version": {"required": True}, - "tenant": {"required": True}, + 'api_version': {'required': True}, + 'tenant': {'required': True}, } _attribute_map = { - "api_version": {"key": "api_version", "type": "str"}, - "tenant": {"key": "tenant", "type": "str"}, + 'api_version': {'key': 'api_version', 'type': 'str'}, + 'tenant': {'key': 'tenant', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword api_version: Required. Sets the api version to use. :paramtype api_version: str @@ -38,8 +41,8 @@ def __init__(self, **kwargs): :paramtype tenant: str """ super(CustomParameterGroup, self).__init__(**kwargs) - self.api_version = kwargs["api_version"] - self.tenant = kwargs["tenant"] + self.api_version = kwargs['api_version'] + self.tenant = kwargs['tenant'] class OdataProductResult(msrest.serialization.Model): @@ -52,11 +55,14 @@ class OdataProductResult(msrest.serialization.Model): """ _attribute_map = { - "values": {"key": "values", "type": "[Product]"}, - "odata_next_link": {"key": "odata\\.nextLink", "type": "str"}, + 'values': {'key': 'values', 'type': '[Product]'}, + 'odata_next_link': {'key': 'odata\\.nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword values: :paramtype values: list[~paging.models.Product] @@ -64,8 +70,8 @@ def __init__(self, **kwargs): :paramtype odata_next_link: str """ super(OdataProductResult, self).__init__(**kwargs) - self.values = kwargs.get("values", None) - self.odata_next_link = kwargs.get("odata_next_link", None) + self.values = kwargs.get('values', None) + self.odata_next_link = kwargs.get('odata_next_link', None) class OperationResult(msrest.serialization.Model): @@ -78,10 +84,13 @@ class OperationResult(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "str"}, + 'status': {'key': 'status', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: The status of the request. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", @@ -89,7 +98,7 @@ def __init__(self, **kwargs): :paramtype status: str or ~paging.models.OperationResultStatus """ super(OperationResult, self).__init__(**kwargs) - self.status = kwargs.get("status", None) + self.status = kwargs.get('status', None) class PagingGetMultiplePagesLroOptions(msrest.serialization.Model): @@ -103,11 +112,14 @@ class PagingGetMultiplePagesLroOptions(msrest.serialization.Model): """ _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -116,8 +128,8 @@ def __init__(self, **kwargs): :paramtype timeout: int """ super(PagingGetMultiplePagesLroOptions, self).__init__(**kwargs) - self.maxresults = kwargs.get("maxresults", None) - self.timeout = kwargs.get("timeout", 30) + self.maxresults = kwargs.get('maxresults', None) + self.timeout = kwargs.get('timeout', 30) class PagingGetMultiplePagesOptions(msrest.serialization.Model): @@ -131,11 +143,14 @@ class PagingGetMultiplePagesOptions(msrest.serialization.Model): """ _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -144,8 +159,8 @@ def __init__(self, **kwargs): :paramtype timeout: int """ super(PagingGetMultiplePagesOptions, self).__init__(**kwargs) - self.maxresults = kwargs.get("maxresults", None) - self.timeout = kwargs.get("timeout", 30) + self.maxresults = kwargs.get('maxresults', None) + self.timeout = kwargs.get('timeout', 30) class PagingGetMultiplePagesWithOffsetOptions(msrest.serialization.Model): @@ -163,16 +178,19 @@ class PagingGetMultiplePagesWithOffsetOptions(msrest.serialization.Model): """ _validation = { - "offset": {"required": True}, + 'offset': {'required': True}, } _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "offset": {"key": "offset", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -183,9 +201,9 @@ def __init__(self, **kwargs): :paramtype timeout: int """ super(PagingGetMultiplePagesWithOffsetOptions, self).__init__(**kwargs) - self.maxresults = kwargs.get("maxresults", None) - self.offset = kwargs["offset"] - self.timeout = kwargs.get("timeout", 30) + self.maxresults = kwargs.get('maxresults', None) + self.offset = kwargs['offset'] + self.timeout = kwargs.get('timeout', 30) class PagingGetOdataMultiplePagesOptions(msrest.serialization.Model): @@ -199,11 +217,14 @@ class PagingGetOdataMultiplePagesOptions(msrest.serialization.Model): """ _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -212,8 +233,8 @@ def __init__(self, **kwargs): :paramtype timeout: int """ super(PagingGetOdataMultiplePagesOptions, self).__init__(**kwargs) - self.maxresults = kwargs.get("maxresults", None) - self.timeout = kwargs.get("timeout", 30) + self.maxresults = kwargs.get('maxresults', None) + self.timeout = kwargs.get('timeout', 30) class Product(msrest.serialization.Model): @@ -224,16 +245,19 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "properties": {"key": "properties", "type": "ProductProperties"}, + 'properties': {'key': 'properties', 'type': 'ProductProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword properties: :paramtype properties: ~paging.models.ProductProperties """ super(Product, self).__init__(**kwargs) - self.properties = kwargs.get("properties", None) + self.properties = kwargs.get('properties', None) class ProductProperties(msrest.serialization.Model): @@ -246,11 +270,14 @@ class ProductProperties(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -258,8 +285,8 @@ def __init__(self, **kwargs): :paramtype name: str """ super(ProductProperties, self).__init__(**kwargs) - self.id = kwargs.get("id", None) - self.name = kwargs.get("name", None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) class ProductResult(msrest.serialization.Model): @@ -272,11 +299,14 @@ class ProductResult(msrest.serialization.Model): """ _attribute_map = { - "values": {"key": "values", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'values': {'key': 'values', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword values: :paramtype values: list[~paging.models.Product] @@ -284,8 +314,8 @@ def __init__(self, **kwargs): :paramtype next_link: str """ super(ProductResult, self).__init__(**kwargs) - self.values = kwargs.get("values", None) - self.next_link = kwargs.get("next_link", None) + self.values = kwargs.get('values', None) + self.next_link = kwargs.get('next_link', None) class ProductResultValue(msrest.serialization.Model): @@ -298,11 +328,14 @@ class ProductResultValue(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'value': {'key': 'value', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: :paramtype value: list[~paging.models.Product] @@ -310,8 +343,8 @@ def __init__(self, **kwargs): :paramtype next_link: str """ super(ProductResultValue, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = kwargs.get("next_link", None) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) class ProductResultValueWithXMSClientName(msrest.serialization.Model): @@ -324,11 +357,14 @@ class ProductResultValueWithXMSClientName(msrest.serialization.Model): """ _attribute_map = { - "indexes": {"key": "values", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'indexes': {'key': 'values', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword indexes: :paramtype indexes: list[~paging.models.Product] @@ -336,5 +372,5 @@ def __init__(self, **kwargs): :paramtype next_link: str """ super(ProductResultValueWithXMSClientName, self).__init__(**kwargs) - self.indexes = kwargs.get("indexes", None) - self.next_link = kwargs.get("next_link", None) + self.indexes = kwargs.get('indexes', None) + self.next_link = kwargs.get('next_link', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models_py3.py index 0bd76a428fc..aeea7eeff31 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_models_py3.py @@ -25,16 +25,22 @@ class CustomParameterGroup(msrest.serialization.Model): """ _validation = { - "api_version": {"required": True}, - "tenant": {"required": True}, + 'api_version': {'required': True}, + 'tenant': {'required': True}, } _attribute_map = { - "api_version": {"key": "api_version", "type": "str"}, - "tenant": {"key": "tenant", "type": "str"}, + 'api_version': {'key': 'api_version', 'type': 'str'}, + 'tenant': {'key': 'tenant', 'type': 'str'}, } - def __init__(self, *, api_version: str, tenant: str, **kwargs): + def __init__( + self, + *, + api_version: str, + tenant: str, + **kwargs + ): """ :keyword api_version: Required. Sets the api version to use. :paramtype api_version: str @@ -56,11 +62,17 @@ class OdataProductResult(msrest.serialization.Model): """ _attribute_map = { - "values": {"key": "values", "type": "[Product]"}, - "odata_next_link": {"key": "odata\\.nextLink", "type": "str"}, + 'values': {'key': 'values', 'type': '[Product]'}, + 'odata_next_link': {'key': 'odata\\.nextLink', 'type': 'str'}, } - def __init__(self, *, values: Optional[List["Product"]] = None, odata_next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + values: Optional[List["Product"]] = None, + odata_next_link: Optional[str] = None, + **kwargs + ): """ :keyword values: :paramtype values: list[~paging.models.Product] @@ -82,10 +94,15 @@ class OperationResult(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "str"}, + 'status': {'key': 'status', 'type': 'str'}, } - def __init__(self, *, status: Optional[Union[str, "OperationResultStatus"]] = None, **kwargs): + def __init__( + self, + *, + status: Optional[Union[str, "OperationResultStatus"]] = None, + **kwargs + ): """ :keyword status: The status of the request. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", @@ -107,11 +124,17 @@ class PagingGetMultiplePagesLroOptions(msrest.serialization.Model): """ _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, *, maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs): + def __init__( + self, + *, + maxresults: Optional[int] = None, + timeout: Optional[int] = 30, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -135,11 +158,17 @@ class PagingGetMultiplePagesOptions(msrest.serialization.Model): """ _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, *, maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs): + def __init__( + self, + *, + maxresults: Optional[int] = None, + timeout: Optional[int] = 30, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -167,16 +196,23 @@ class PagingGetMultiplePagesWithOffsetOptions(msrest.serialization.Model): """ _validation = { - "offset": {"required": True}, + 'offset': {'required': True}, } _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "offset": {"key": "offset", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, *, offset: int, maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs): + def __init__( + self, + *, + offset: int, + maxresults: Optional[int] = None, + timeout: Optional[int] = 30, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -203,11 +239,17 @@ class PagingGetOdataMultiplePagesOptions(msrest.serialization.Model): """ _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, + 'maxresults': {'key': 'maxresults', 'type': 'int'}, + 'timeout': {'key': 'timeout', 'type': 'int'}, } - def __init__(self, *, maxresults: Optional[int] = None, timeout: Optional[int] = 30, **kwargs): + def __init__( + self, + *, + maxresults: Optional[int] = None, + timeout: Optional[int] = 30, + **kwargs + ): """ :keyword maxresults: Sets the maximum number of items to return in the response. :paramtype maxresults: int @@ -228,10 +270,15 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "properties": {"key": "properties", "type": "ProductProperties"}, + 'properties': {'key': 'properties', 'type': 'ProductProperties'}, } - def __init__(self, *, properties: Optional["ProductProperties"] = None, **kwargs): + def __init__( + self, + *, + properties: Optional["ProductProperties"] = None, + **kwargs + ): """ :keyword properties: :paramtype properties: ~paging.models.ProductProperties @@ -250,11 +297,17 @@ class ProductProperties(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, id: Optional[int] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -276,11 +329,17 @@ class ProductResult(msrest.serialization.Model): """ _attribute_map = { - "values": {"key": "values", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'values': {'key': 'values', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, values: Optional[List["Product"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + values: Optional[List["Product"]] = None, + next_link: Optional[str] = None, + **kwargs + ): """ :keyword values: :paramtype values: list[~paging.models.Product] @@ -302,11 +361,17 @@ class ProductResultValue(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'value': {'key': 'value', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value: Optional[List["Product"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[List["Product"]] = None, + next_link: Optional[str] = None, + **kwargs + ): """ :keyword value: :paramtype value: list[~paging.models.Product] @@ -328,11 +393,17 @@ class ProductResultValueWithXMSClientName(msrest.serialization.Model): """ _attribute_map = { - "indexes": {"key": "values", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'indexes': {'key': 'values', 'type': '[Product]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, indexes: Optional[List["Product"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + indexes: Optional[List["Product"]] = None, + next_link: Optional[str] = None, + **kwargs + ): """ :keyword indexes: :paramtype indexes: list[~paging.models.Product] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/__init__.py index 8e128dd3d8e..9a5b2005928 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/__init__.py @@ -9,5 +9,5 @@ from ._paging_operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py index 562a9cba845..20edd67b69d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -30,9 +23,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -581,7 +573,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_no_item_name_pages( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResultValue"] """A paging operation that must return result of the default 'value' node. @@ -591,21 +584,22 @@ def get_no_item_name_pages( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResultValue] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResultValue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResultValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_no_item_name_pages_request( - template_url=self.get_no_item_name_pages.metadata["url"], + template_url=self.get_no_item_name_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_no_item_name_pages_request( template_url=next_link, ) @@ -624,7 +618,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -633,13 +631,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_no_item_name_pages.metadata = {"url": "/paging/noitemname"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_no_item_name_pages.metadata = {'url': '/paging/noitemname'} # type: ignore @distributed_trace def get_null_next_link_name_pages( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResult"] """A paging operation that must ignore any kind of nextLink, and stop after page 1. @@ -649,21 +650,22 @@ def get_null_next_link_name_pages( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_null_next_link_name_pages_request( - template_url=self.get_null_next_link_name_pages.metadata["url"], + template_url=self.get_null_next_link_name_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_null_next_link_name_pages_request( template_url=next_link, ) @@ -682,7 +684,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -691,13 +697,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_null_next_link_name_pages.metadata = {"url": "/paging/nullnextlink"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_null_next_link_name_pages.metadata = {'url': '/paging/nullnextlink'} # type: ignore @distributed_trace def get_single_pages( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResult"] """A paging operation that finishes on the first call without a nextlink. @@ -707,21 +716,22 @@ def get_single_pages( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_single_pages_request( - template_url=self.get_single_pages.metadata["url"], + template_url=self.get_single_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_single_pages_request( template_url=next_link, ) @@ -740,7 +750,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -749,13 +763,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_single_pages.metadata = {"url": "/paging/single"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_single_pages.metadata = {'url': '/paging/single'} # type: ignore @distributed_trace def first_response_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResultValue"] """A paging operation whose first response's items list is empty, but still returns a next link. @@ -766,21 +783,22 @@ def first_response_empty( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResultValue] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResultValue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResultValue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_first_response_empty_request( - template_url=self.first_response_empty.metadata["url"], + template_url=self.first_response_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_first_response_empty_request( template_url=next_link, ) @@ -799,7 +817,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -808,9 +830,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - first_response_empty.metadata = {"url": "/paging/firstResponseEmpty/1"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + first_response_empty.metadata = {'url': '/paging/firstResponseEmpty/1'} # type: ignore @distributed_trace def get_multiple_pages( @@ -831,10 +855,11 @@ def get_multiple_pages( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -842,12 +867,12 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_options is not None: _maxresults = paging_get_multiple_pages_options.maxresults _timeout = paging_get_multiple_pages_options.timeout - + request = build_get_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.get_multiple_pages.metadata["url"], + template_url=self.get_multiple_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -858,7 +883,7 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_options is not None: _maxresults = paging_get_multiple_pages_options.maxresults _timeout = paging_get_multiple_pages_options.timeout - + request = build_get_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, @@ -880,7 +905,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -889,9 +918,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages.metadata = {"url": "/paging/multiple"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages.metadata = {'url': '/paging/multiple'} # type: ignore @distributed_trace def get_with_query_params( @@ -915,28 +946,29 @@ def get_with_query_params( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - query_constant = kwargs.pop("query_constant", True) # type: bool - - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + query_constant = kwargs.pop('query_constant', True) # type: bool + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_with_query_params_request( query_constant=query_constant, required_query_parameter=required_query_parameter, - template_url=self.get_with_query_params.metadata["url"], + template_url=self.get_with_query_params.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_next_operation_with_query_params_request( query_constant=query_constant, - template_url="/paging/multiple/nextOperationWithQueryParams", + template_url='/paging/multiple/nextOperationWithQueryParams', ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -953,7 +985,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -962,9 +998,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_with_query_params.metadata = {"url": "/paging/multiple/getWithQueryParams"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_with_query_params.metadata = {'url': '/paging/multiple/getWithQueryParams'} # type: ignore @distributed_trace def get_odata_multiple_pages( @@ -986,10 +1024,11 @@ def get_odata_multiple_pages( :rtype: ~azure.core.paging.ItemPaged[~paging.models.OdataProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.OdataProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.OdataProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -997,12 +1036,12 @@ def prepare_request(next_link=None): if paging_get_odata_multiple_pages_options is not None: _maxresults = paging_get_odata_multiple_pages_options.maxresults _timeout = paging_get_odata_multiple_pages_options.timeout - + request = build_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.get_odata_multiple_pages.metadata["url"], + template_url=self.get_odata_multiple_pages.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1013,7 +1052,7 @@ def prepare_request(next_link=None): if paging_get_odata_multiple_pages_options is not None: _maxresults = paging_get_odata_multiple_pages_options.maxresults _timeout = paging_get_odata_multiple_pages_options.timeout - + request = build_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=_maxresults, @@ -1035,7 +1074,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1044,9 +1087,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_odata_multiple_pages.metadata = {"url": "/paging/multiple/odata"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_odata_multiple_pages.metadata = {'url': '/paging/multiple/odata'} # type: ignore @distributed_trace def get_multiple_pages_with_offset( @@ -1068,10 +1113,11 @@ def get_multiple_pages_with_offset( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -1081,13 +1127,13 @@ def prepare_request(next_link=None): _maxresults = paging_get_multiple_pages_with_offset_options.maxresults _offset = paging_get_multiple_pages_with_offset_options.offset _timeout = paging_get_multiple_pages_with_offset_options.timeout - + request = build_get_multiple_pages_with_offset_request( offset=_offset, client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.get_multiple_pages_with_offset.metadata["url"], + template_url=self.get_multiple_pages_with_offset.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1100,7 +1146,7 @@ def prepare_request(next_link=None): _maxresults = paging_get_multiple_pages_with_offset_options.maxresults _offset = paging_get_multiple_pages_with_offset_options.offset _timeout = paging_get_multiple_pages_with_offset_options.timeout - + request = build_get_multiple_pages_with_offset_request( offset=_offset, client_request_id=client_request_id, @@ -1123,7 +1169,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1132,13 +1182,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages_with_offset.metadata = {"url": "/paging/multiple/withpath/{offset}"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages_with_offset.metadata = {'url': '/paging/multiple/withpath/{offset}'} # type: ignore @distributed_trace def get_multiple_pages_retry_first( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResult"] """A paging operation that fails on the first call with 500 and then retries and then get a @@ -1149,21 +1202,22 @@ def get_multiple_pages_retry_first( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_retry_first_request( - template_url=self.get_multiple_pages_retry_first.metadata["url"], + template_url=self.get_multiple_pages_retry_first.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_retry_first_request( template_url=next_link, ) @@ -1182,7 +1236,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1191,13 +1249,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages_retry_first.metadata = {"url": "/paging/multiple/retryfirst"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages_retry_first.metadata = {'url': '/paging/multiple/retryfirst'} # type: ignore @distributed_trace def get_multiple_pages_retry_second( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResult"] """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails @@ -1208,21 +1269,22 @@ def get_multiple_pages_retry_second( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_retry_second_request( - template_url=self.get_multiple_pages_retry_second.metadata["url"], + template_url=self.get_multiple_pages_retry_second.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_retry_second_request( template_url=next_link, ) @@ -1241,7 +1303,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1250,13 +1316,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages_retry_second.metadata = {"url": "/paging/multiple/retrysecond"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages_retry_second.metadata = {'url': '/paging/multiple/retrysecond'} # type: ignore @distributed_trace def get_single_pages_failure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResult"] """A paging operation that receives a 400 on the first call. @@ -1266,21 +1335,22 @@ def get_single_pages_failure( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_single_pages_failure_request( - template_url=self.get_single_pages_failure.metadata["url"], + template_url=self.get_single_pages_failure.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_single_pages_failure_request( template_url=next_link, ) @@ -1299,7 +1369,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1308,13 +1382,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_single_pages_failure.metadata = {"url": "/paging/single/failure"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_single_pages_failure.metadata = {'url': '/paging/single/failure'} # type: ignore @distributed_trace def get_multiple_pages_failure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResult"] """A paging operation that receives a 400 on the second call. @@ -1324,21 +1401,22 @@ def get_multiple_pages_failure( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_failure_request( - template_url=self.get_multiple_pages_failure.metadata["url"], + template_url=self.get_multiple_pages_failure.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_failure_request( template_url=next_link, ) @@ -1357,7 +1435,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1366,13 +1448,16 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages_failure.metadata = {"url": "/paging/multiple/failure"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages_failure.metadata = {'url': '/paging/multiple/failure'} # type: ignore @distributed_trace def get_multiple_pages_failure_uri( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResult"] """A paging operation that receives an invalid nextLink. @@ -1382,21 +1467,22 @@ def get_multiple_pages_failure_uri( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_failure_uri_request( - template_url=self.get_multiple_pages_failure_uri.metadata["url"], + template_url=self.get_multiple_pages_failure_uri.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_multiple_pages_failure_uri_request( template_url=next_link, ) @@ -1415,7 +1501,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1424,9 +1514,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages_failure_uri.metadata = {"url": "/paging/multiple/failureuri"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages_failure_uri.metadata = {'url': '/paging/multiple/failureuri'} # type: ignore @distributed_trace def get_multiple_pages_fragment_next_link( @@ -1447,28 +1539,29 @@ def get_multiple_pages_fragment_next_link( :rtype: ~azure.core.paging.ItemPaged[~paging.models.OdataProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.OdataProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.OdataProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_multiple_pages_fragment_next_link_request( tenant=tenant, api_version=api_version, - template_url=self.get_multiple_pages_fragment_next_link.metadata["url"], + template_url=self.get_multiple_pages_fragment_next_link.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_next_fragment_request( tenant=tenant, next_link=next_link, api_version=api_version, - template_url="/paging/multiple/fragment/{tenant}/{nextLink}", + template_url='/paging/multiple/fragment/{tenant}/{nextLink}', ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1485,7 +1578,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1494,9 +1591,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages_fragment_next_link.metadata = {"url": "/paging/multiple/fragment/{tenant}"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages_fragment_next_link.metadata = {'url': '/paging/multiple/fragment/{tenant}'} # type: ignore @distributed_trace def get_multiple_pages_fragment_with_grouping_next_link( @@ -1514,10 +1613,11 @@ def get_multiple_pages_fragment_with_grouping_next_link( :rtype: ~azure.core.paging.ItemPaged[~paging.models.OdataProductResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.OdataProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.OdataProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _api_version = None @@ -1525,11 +1625,11 @@ def prepare_request(next_link=None): if custom_parameter_group is not None: _api_version = custom_parameter_group.api_version _tenant = custom_parameter_group.tenant - + request = build_get_multiple_pages_fragment_with_grouping_next_link_request( tenant=_tenant, api_version=_api_version, - template_url=self.get_multiple_pages_fragment_with_grouping_next_link.metadata["url"], + template_url=self.get_multiple_pages_fragment_with_grouping_next_link.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1540,12 +1640,12 @@ def prepare_request(next_link=None): if custom_parameter_group is not None: _api_version = custom_parameter_group.api_version _tenant = custom_parameter_group.tenant - + request = build_next_fragment_with_grouping_request( tenant=_tenant, next_link=next_link, api_version=_api_version, - template_url="/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}", + template_url='/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}', ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1562,7 +1662,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1571,9 +1675,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_multiple_pages_fragment_with_grouping_next_link.metadata = {"url": "/paging/multiple/fragmentwithgrouping/{tenant}"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_multiple_pages_fragment_with_grouping_next_link.metadata = {'url': '/paging/multiple/fragmentwithgrouping/{tenant}'} # type: ignore def _get_multiple_pages_lro_initial( self, @@ -1582,9 +1688,11 @@ def _get_multiple_pages_lro_initial( **kwargs # type: Any ): # type: (...) -> "_models.ProductResult" - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) _maxresults = None _timeout = None @@ -1596,26 +1704,31 @@ def _get_multiple_pages_lro_initial( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self._get_multiple_pages_lro_initial.metadata["url"], + template_url=self._get_multiple_pages_lro_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ProductResult", pipeline_response) + deserialized = self._deserialize('ProductResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _get_multiple_pages_lro_initial.metadata = {"url": "/paging/multiple/lro"} # type: ignore + _get_multiple_pages_lro_initial.metadata = {'url': '/paging/multiple/lro'} # type: ignore + @distributed_trace def begin_get_multiple_pages_lro( @@ -1646,10 +1759,11 @@ def begin_get_multiple_pages_lro( :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: _maxresults = None @@ -1657,12 +1771,12 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_lro_options is not None: _maxresults = paging_get_multiple_pages_lro_options.maxresults _timeout = paging_get_multiple_pages_lro_options.timeout - + request = build_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=_maxresults, timeout=_timeout, - template_url=self.begin_get_multiple_pages_lro.metadata["url"], + template_url=self.begin_get_multiple_pages_lro.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) @@ -1673,7 +1787,7 @@ def prepare_request(next_link=None): if paging_get_multiple_pages_lro_options is not None: _maxresults = paging_get_multiple_pages_lro_options.maxresults _timeout = paging_get_multiple_pages_lro_options.timeout - + request = build_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=_maxresults, @@ -1695,7 +1809,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1704,49 +1822,52 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResult"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._get_multiple_pages_lro_initial( client_request_id=client_request_id, paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) - return ItemPaged(internal_get_next, extract_data) + return ItemPaged( + internal_get_next, extract_data + ) - if polling is True: - polling_method = LROBasePolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + if polling is True: polling_method = LROBasePolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_get_multiple_pages_lro.metadata = {'url': '/paging/multiple/lro'} # type: ignore - begin_get_multiple_pages_lro.metadata = {"url": "/paging/multiple/lro"} # type: ignore @distributed_trace def get_paging_model_with_item_name_with_xms_client_name( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.ProductResultValueWithXMSClientName"] """A paging operation that returns a paging model whose item name is is overriden by @@ -1758,21 +1879,22 @@ def get_paging_model_with_item_name_with_xms_client_name( :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResultValueWithXMSClientName] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ProductResultValueWithXMSClientName"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProductResultValueWithXMSClientName"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_get_paging_model_with_item_name_with_xms_client_name_request( - template_url=self.get_paging_model_with_item_name_with_xms_client_name.metadata["url"], + template_url=self.get_paging_model_with_item_name_with_xms_client_name.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_get_paging_model_with_item_name_with_xms_client_name_request( template_url=next_link, ) @@ -1791,7 +1913,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1800,6 +1926,8 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - get_paging_model_with_item_name_with_xms_client_name.metadata = {"url": "/paging/itemNameWithXMSClientName"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + get_paging_model_with_item_name_with_xms_client_name.metadata = {'url': '/paging/itemNameWithXMSClientName'} # type: ignore diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py index 3e9c4b351e5..6bdb38f58a7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Long-running Operation for AutoRest. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py index a553c7263e5..7b497d82d97 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ StorageManagementClient. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/__init__.py index 46519cbf943..1072dc10316 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["StorageManagementClient"] +__all__ = ['StorageManagementClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_configuration.py index d09f446b201..03ad7b25f5e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration(Configuration): +class StorageManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,9 +29,11 @@ class StorageManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -43,7 +45,7 @@ def __init__( ): # type: (...) -> None super(StorageManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -53,24 +55,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "storagemanagementclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'storagemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py index b907e464fa6..a7c5484535a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py @@ -18,12 +18,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse - class StorageManagementClient(object): """StorageManagementClient. @@ -53,20 +52,17 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - self._config = StorageManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) + self._config = StorageManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/__init__.py index bba070179f2..3b85e3279ea 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._storage_management_client import StorageManagementClient - -__all__ = ["StorageManagementClient"] +__all__ = ['StorageManagementClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_configuration.py index 71aa018cc31..46bdc675acb 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration(Configuration): +class StorageManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,15 +27,22 @@ class StorageManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: super(StorageManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,21 +52,22 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "storagemanagementclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'storagemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py index 68f0e60a85a..d12e90e365a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential - class StorageManagementClient: """StorageManagementClient. @@ -50,21 +49,22 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = StorageManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) + self._config = StorageManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/__init__.py index 387513ba3a8..291f880b141 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._usage_operations import UsageOperations __all__ = [ - "StorageAccountsOperations", - "UsageOperations", + 'StorageAccountsOperations', + 'UsageOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py index 09280683792..bb134773b70 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -28,22 +21,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._storage_accounts_operations import ( - build_check_name_availability_request, - build_create_request_initial, - build_delete_request, - build_get_properties_request, - build_list_by_resource_group_request, - build_list_keys_request, - build_list_request, - build_regenerate_key_request, - build_update_request, -) - -T = TypeVar("T") +from ...operations._storage_accounts_operations import build_check_name_availability_request, build_create_request_initial, build_delete_request, build_get_properties_request, build_list_by_resource_group_request, build_list_keys_request, build_list_request, build_regenerate_key_request, build_update_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class StorageAccountsOperations: """StorageAccountsOperations async operations. @@ -68,7 +49,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: @distributed_trace_async async def check_name_availability( - self, account_name: "_models.StorageAccountCheckNameAvailabilityParameters", **kwargs: Any + self, + account_name: "_models.StorageAccountCheckNameAvailabilityParameters", + **kwargs: Any ) -> "_models.CheckNameAvailabilityResult": """Checks that account name is valid and is not in use. @@ -81,40 +64,47 @@ async def check_name_availability( :rtype: ~storage.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.CheckNameAvailabilityResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(account_name, "StorageAccountCheckNameAvailabilityParameters") + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata["url"], + template_url=self.check_name_availability.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + async def _create_initial( self, @@ -123,14 +113,16 @@ async def _create_initial( parameters: "_models.StorageAccountCreateParameters", **kwargs: Any ) -> Optional["_models.StorageAccount"]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.StorageAccount"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(parameters, "StorageAccountCreateParameters") + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') request = build_create_request_initial( resource_group_name=resource_group_name, @@ -139,12 +131,16 @@ async def _create_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata["url"], + template_url=self._create_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -153,14 +149,15 @@ async def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def begin_create( @@ -196,12 +193,15 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~storage.models.StorageAccount] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccount"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._create_initial( resource_group_name=resource_group_name, @@ -209,38 +209,40 @@ async def begin_create( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore @distributed_trace_async - async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: + async def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -254,23 +256,30 @@ async def delete(self, resource_group_name: str, account_name: str, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_delete_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -280,11 +289,15 @@ async def delete(self, resource_group_name: str, account_name: str, **kwargs: An if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def get_properties( - self, resource_group_name: str, account_name: str, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + **kwargs: Any ) -> "_models.StorageAccount": """Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve @@ -301,37 +314,45 @@ async def get_properties( :rtype: ~storage.models.StorageAccount :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccount"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_get_properties_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_properties.metadata["url"], + template_url=self.get_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_properties.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def update( @@ -363,14 +384,16 @@ async def update( :rtype: ~storage.models.StorageAccount :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccount"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') request = build_update_request( resource_group_name=resource_group_name, @@ -379,30 +402,38 @@ async def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], + template_url=self.update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace_async async def list_keys( - self, resource_group_name: str, account_name: str, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + **kwargs: Any ) -> "_models.StorageAccountKeys": """Lists the access keys for the specified storage account. @@ -415,40 +446,51 @@ async def list_keys( :rtype: ~storage.models.StorageAccountKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountKeys"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_list_keys_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], + template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize('StorageAccountKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccountListResult"]: + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -458,25 +500,26 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccountListResult :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountListResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], + template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -497,7 +540,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -506,13 +553,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore @distributed_trace def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any + self, + resource_group_name: str, + **kwargs: Any ) -> AsyncIterable["_models.StorageAccountListResult"]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -525,26 +576,27 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~storage.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountListResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, @@ -566,7 +618,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -575,9 +631,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts"} # type: ignore + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore @distributed_trace_async async def regenerate_key( @@ -602,15 +660,17 @@ async def regenerate_key( :rtype: ~storage.models.StorageAccountKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountKeys"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _regenerate_key = _models.StorageAccountRegenerateKeyParameters(key_name=key_name) - _json = self._serialize.body(_regenerate_key, "StorageAccountRegenerateKeyParameters") + _json = self._serialize.body(_regenerate_key, 'StorageAccountRegenerateKeyParameters') request = build_regenerate_key_request( resource_group_name=resource_group_name, @@ -619,23 +679,28 @@ async def regenerate_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_key.metadata["url"], + template_url=self.regenerate_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize('StorageAccountKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey"} # type: ignore + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py index affae720c80..b30ea91e4e2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -25,11 +18,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class UsageOperations: """UsageOperations async operations. @@ -53,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def list(self, **kwargs: Any) -> "_models.UsageListResult": + async def list( + self, + **kwargs: Any + ) -> "_models.UsageListResult": """Gets the current usage count and the limit for the resources under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,32 +55,40 @@ async def list(self, **kwargs: Any) -> "_models.UsageListResult": :rtype: ~storage.models.UsageListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.UsageListResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], + template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("UsageListResult", pipeline_response) + deserialized = self._deserialize('UsageListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py index 8c01812c98a..cc03c3d23ac 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py @@ -53,27 +53,27 @@ ) __all__ = [ - "Bar", - "CheckNameAvailabilityResult", - "CustomDomain", - "Endpoints", - "Foo", - "Resource", - "StorageAccount", - "StorageAccountCheckNameAvailabilityParameters", - "StorageAccountCreateParameters", - "StorageAccountKeys", - "StorageAccountListResult", - "StorageAccountRegenerateKeyParameters", - "StorageAccountUpdateParameters", - "SubResource", - "Usage", - "UsageListResult", - "UsageName", - "AccountStatus", - "AccountType", - "KeyName", - "ProvisioningState", - "Reason", - "UsageUnit", + 'Bar', + 'CheckNameAvailabilityResult', + 'CustomDomain', + 'Endpoints', + 'Foo', + 'Resource', + 'StorageAccount', + 'StorageAccountCheckNameAvailabilityParameters', + 'StorageAccountCreateParameters', + 'StorageAccountKeys', + 'StorageAccountListResult', + 'StorageAccountRegenerateKeyParameters', + 'StorageAccountUpdateParameters', + 'SubResource', + 'Usage', + 'UsageListResult', + 'UsageName', + 'AccountStatus', + 'AccountType', + 'KeyName', + 'ProvisioningState', + 'Reason', + 'UsageUnit', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models.py index c7c8be86001..fa393ab8976 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models.py @@ -17,16 +17,19 @@ class Bar(msrest.serialization.Model): """ _attribute_map = { - "recursive_point": {"key": "RecursivePoint", "type": "Endpoints"}, + 'recursive_point': {'key': 'RecursivePoint', 'type': 'Endpoints'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword recursive_point: Recursive Endpoints. :paramtype recursive_point: ~storage.models.Endpoints """ super(Bar, self).__init__(**kwargs) - self.recursive_point = kwargs.get("recursive_point", None) + self.recursive_point = kwargs.get('recursive_point', None) class CheckNameAvailabilityResult(msrest.serialization.Model): @@ -45,12 +48,15 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): """ _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name_available: Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or @@ -64,9 +70,9 @@ def __init__(self, **kwargs): :paramtype message: str """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = kwargs.get("name_available", None) - self.reason = kwargs.get("reason", None) - self.message = kwargs.get("message", None) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = kwargs.get('message', None) class CustomDomain(msrest.serialization.Model): @@ -80,11 +86,14 @@ class CustomDomain(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "use_sub_domain": {"key": "useSubDomain", "type": "bool"}, + 'name': {'key': 'name', 'type': 'str'}, + 'use_sub_domain': {'key': 'useSubDomain', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Gets or sets the custom domain name. Name is the CNAME source. :paramtype name: str @@ -93,8 +102,8 @@ def __init__(self, **kwargs): :paramtype use_sub_domain: bool """ super(CustomDomain, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.use_sub_domain = kwargs.get("use_sub_domain", None) + self.name = kwargs.get('name', None) + self.use_sub_domain = kwargs.get('use_sub_domain', None) class Endpoints(msrest.serialization.Model): @@ -113,14 +122,17 @@ class Endpoints(msrest.serialization.Model): """ _attribute_map = { - "blob": {"key": "blob", "type": "str"}, - "queue": {"key": "queue", "type": "str"}, - "table": {"key": "table", "type": "str"}, - "dummy_end_point": {"key": "dummyEndPoint", "type": "Endpoints"}, - "foo_point": {"key": "FooPoint", "type": "Foo"}, + 'blob': {'key': 'blob', 'type': 'str'}, + 'queue': {'key': 'queue', 'type': 'str'}, + 'table': {'key': 'table', 'type': 'str'}, + 'dummy_end_point': {'key': 'dummyEndPoint', 'type': 'Endpoints'}, + 'foo_point': {'key': 'FooPoint', 'type': 'Foo'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword blob: Gets the blob endpoint. :paramtype blob: str @@ -134,11 +146,11 @@ def __init__(self, **kwargs): :paramtype foo_point: ~storage.models.Foo """ super(Endpoints, self).__init__(**kwargs) - self.blob = kwargs.get("blob", None) - self.queue = kwargs.get("queue", None) - self.table = kwargs.get("table", None) - self.dummy_end_point = kwargs.get("dummy_end_point", None) - self.foo_point = kwargs.get("foo_point", None) + self.blob = kwargs.get('blob', None) + self.queue = kwargs.get('queue', None) + self.table = kwargs.get('table', None) + self.dummy_end_point = kwargs.get('dummy_end_point', None) + self.foo_point = kwargs.get('foo_point', None) class Foo(msrest.serialization.Model): @@ -149,16 +161,19 @@ class Foo(msrest.serialization.Model): """ _attribute_map = { - "bar_point": {"key": "Bar\\.Point", "type": "Bar"}, + 'bar_point': {'key': 'Bar\\.Point', 'type': 'Bar'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword bar_point: Bar point. :paramtype bar_point: ~storage.models.Bar """ super(Foo, self).__init__(**kwargs) - self.bar_point = kwargs.get("bar_point", None) + self.bar_point = kwargs.get('bar_point', None) class Resource(msrest.serialization.Model): @@ -181,21 +196,24 @@ class Resource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword location: Required. Resource location. :paramtype location: str @@ -206,8 +224,8 @@ def __init__(self, **kwargs): self.id = None self.name = None self.type = None - self.location = kwargs["location"] - self.tags = kwargs.get("tags", None) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) class StorageAccount(Resource): @@ -265,32 +283,35 @@ class StorageAccount(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "account_type": {"key": "properties.accountType", "type": "str"}, - "primary_endpoints": {"key": "properties.primaryEndpoints", "type": "Endpoints"}, - "primary_location": {"key": "properties.primaryLocation", "type": "str"}, - "status_of_primary": {"key": "properties.statusOfPrimary", "type": "str"}, - "last_geo_failover_time": {"key": "properties.lastGeoFailoverTime", "type": "iso-8601"}, - "secondary_location": {"key": "properties.secondaryLocation", "type": "str"}, - "status_of_secondary": {"key": "properties.statusOfSecondary", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "custom_domain": {"key": "properties.customDomain", "type": "CustomDomain"}, - "secondary_endpoints": {"key": "properties.secondaryEndpoints", "type": "Endpoints"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, + 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, + 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, + 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, + 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, + 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, + 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword location: Required. Resource location. :paramtype location: str @@ -334,17 +355,17 @@ def __init__(self, **kwargs): :paramtype secondary_endpoints: ~storage.models.Endpoints """ super(StorageAccount, self).__init__(**kwargs) - self.provisioning_state = kwargs.get("provisioning_state", None) - self.account_type = kwargs.get("account_type", None) - self.primary_endpoints = kwargs.get("primary_endpoints", None) - self.primary_location = kwargs.get("primary_location", None) - self.status_of_primary = kwargs.get("status_of_primary", None) - self.last_geo_failover_time = kwargs.get("last_geo_failover_time", None) - self.secondary_location = kwargs.get("secondary_location", None) - self.status_of_secondary = kwargs.get("status_of_secondary", None) - self.creation_time = kwargs.get("creation_time", None) - self.custom_domain = kwargs.get("custom_domain", None) - self.secondary_endpoints = kwargs.get("secondary_endpoints", None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.account_type = kwargs.get('account_type', None) + self.primary_endpoints = kwargs.get('primary_endpoints', None) + self.primary_location = kwargs.get('primary_location', None) + self.status_of_primary = kwargs.get('status_of_primary', None) + self.last_geo_failover_time = kwargs.get('last_geo_failover_time', None) + self.secondary_location = kwargs.get('secondary_location', None) + self.status_of_secondary = kwargs.get('status_of_secondary', None) + self.creation_time = kwargs.get('creation_time', None) + self.custom_domain = kwargs.get('custom_domain', None) + self.secondary_endpoints = kwargs.get('secondary_endpoints', None) class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): @@ -359,15 +380,18 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -375,8 +399,8 @@ def __init__(self, **kwargs): :paramtype type: str """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs["name"] - self.type = kwargs.get("type", "Microsoft.Storage/storageAccounts") + self.name = kwargs['name'] + self.type = kwargs.get('type', "Microsoft.Storage/storageAccounts") class StorageAccountCreateParameters(Resource): @@ -402,22 +426,25 @@ class StorageAccountCreateParameters(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "account_type": {"key": "properties.accountType", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword location: Required. Resource location. :paramtype location: str @@ -428,7 +455,7 @@ def __init__(self, **kwargs): :paramtype account_type: str or ~storage.models.AccountType """ super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.account_type = kwargs.get("account_type", None) + self.account_type = kwargs.get('account_type', None) class StorageAccountKeys(msrest.serialization.Model): @@ -441,11 +468,14 @@ class StorageAccountKeys(msrest.serialization.Model): """ _attribute_map = { - "key1": {"key": "key1", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword key1: Gets the value of key 1. :paramtype key1: str @@ -453,8 +483,8 @@ def __init__(self, **kwargs): :paramtype key2: str """ super(StorageAccountKeys, self).__init__(**kwargs) - self.key1 = kwargs.get("key1", None) - self.key2 = kwargs.get("key2", None) + self.key1 = kwargs.get('key1', None) + self.key2 = kwargs.get('key2', None) class StorageAccountListResult(msrest.serialization.Model): @@ -468,11 +498,14 @@ class StorageAccountListResult(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[StorageAccount]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'value': {'key': 'value', 'type': '[StorageAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: Gets the list of storage accounts and their properties. :paramtype value: list[~storage.models.StorageAccount] @@ -481,8 +514,8 @@ def __init__(self, **kwargs): :paramtype next_link: str """ super(StorageAccountListResult, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = kwargs.get("next_link", None) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): @@ -493,16 +526,19 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): """ _attribute_map = { - "key_name": {"key": "keyName", "type": "str"}, + 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword key_name: Possible values include: "key1", "key2". :paramtype key_name: str or ~storage.models.KeyName """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs.get("key_name", None) + self.key_name = kwargs.get('key_name', None) class StorageAccountUpdateParameters(Resource): @@ -534,23 +570,26 @@ class StorageAccountUpdateParameters(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "account_type": {"key": "properties.accountType", "type": "str"}, - "custom_domain": {"key": "properties.customDomain", "type": "CustomDomain"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword location: Required. Resource location. :paramtype location: str @@ -567,8 +606,8 @@ def __init__(self, **kwargs): :paramtype custom_domain: ~storage.models.CustomDomain """ super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.account_type = kwargs.get("account_type", None) - self.custom_domain = kwargs.get("custom_domain", None) + self.account_type = kwargs.get('account_type', None) + self.custom_domain = kwargs.get('custom_domain', None) class SubResource(msrest.serialization.Model): @@ -579,16 +618,19 @@ class SubResource(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: Resource Id. :paramtype id: str """ super(SubResource, self).__init__(**kwargs) - self.id = kwargs.get("id", None) + self.id = kwargs.get('id', None) class Usage(msrest.serialization.Model): @@ -606,13 +648,16 @@ class Usage(msrest.serialization.Model): """ _attribute_map = { - "unit": {"key": "unit", "type": "str"}, - "current_value": {"key": "currentValue", "type": "int"}, - "limit": {"key": "limit", "type": "int"}, - "name": {"key": "name", "type": "UsageName"}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'UsageName'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword unit: Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", "Percent", "CountsPerSecond", "BytesPerSecond". @@ -626,10 +671,10 @@ def __init__(self, **kwargs): :paramtype name: ~storage.models.UsageName """ super(Usage, self).__init__(**kwargs) - self.unit = kwargs.get("unit", None) - self.current_value = kwargs.get("current_value", None) - self.limit = kwargs.get("limit", None) - self.name = kwargs.get("name", None) + self.unit = kwargs.get('unit', None) + self.current_value = kwargs.get('current_value', None) + self.limit = kwargs.get('limit', None) + self.name = kwargs.get('name', None) class UsageListResult(msrest.serialization.Model): @@ -640,16 +685,19 @@ class UsageListResult(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, + 'value': {'key': 'value', 'type': '[Usage]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: Gets or sets the list Storage Resource Usages. :paramtype value: list[~storage.models.Usage] """ super(UsageListResult, self).__init__(**kwargs) - self.value = kwargs.get("value", None) + self.value = kwargs.get('value', None) class UsageName(msrest.serialization.Model): @@ -662,11 +710,14 @@ class UsageName(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: Gets a string describing the resource name. :paramtype value: str @@ -674,5 +725,5 @@ def __init__(self, **kwargs): :paramtype localized_value: str """ super(UsageName, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.localized_value = kwargs.get("localized_value", None) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models_py3.py index b4a542b1d32..aa396d88cb5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_models_py3.py @@ -22,10 +22,15 @@ class Bar(msrest.serialization.Model): """ _attribute_map = { - "recursive_point": {"key": "RecursivePoint", "type": "Endpoints"}, + 'recursive_point': {'key': 'RecursivePoint', 'type': 'Endpoints'}, } - def __init__(self, *, recursive_point: Optional["Endpoints"] = None, **kwargs): + def __init__( + self, + *, + recursive_point: Optional["Endpoints"] = None, + **kwargs + ): """ :keyword recursive_point: Recursive Endpoints. :paramtype recursive_point: ~storage.models.Endpoints @@ -50,9 +55,9 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): """ _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, } def __init__( @@ -92,11 +97,17 @@ class CustomDomain(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "use_sub_domain": {"key": "useSubDomain", "type": "bool"}, + 'name': {'key': 'name', 'type': 'str'}, + 'use_sub_domain': {'key': 'useSubDomain', 'type': 'bool'}, } - def __init__(self, *, name: Optional[str] = None, use_sub_domain: Optional[bool] = None, **kwargs): + def __init__( + self, + *, + name: Optional[str] = None, + use_sub_domain: Optional[bool] = None, + **kwargs + ): """ :keyword name: Gets or sets the custom domain name. Name is the CNAME source. :paramtype name: str @@ -125,11 +136,11 @@ class Endpoints(msrest.serialization.Model): """ _attribute_map = { - "blob": {"key": "blob", "type": "str"}, - "queue": {"key": "queue", "type": "str"}, - "table": {"key": "table", "type": "str"}, - "dummy_end_point": {"key": "dummyEndPoint", "type": "Endpoints"}, - "foo_point": {"key": "FooPoint", "type": "Foo"}, + 'blob': {'key': 'blob', 'type': 'str'}, + 'queue': {'key': 'queue', 'type': 'str'}, + 'table': {'key': 'table', 'type': 'str'}, + 'dummy_end_point': {'key': 'dummyEndPoint', 'type': 'Endpoints'}, + 'foo_point': {'key': 'FooPoint', 'type': 'Foo'}, } def __init__( @@ -170,10 +181,15 @@ class Foo(msrest.serialization.Model): """ _attribute_map = { - "bar_point": {"key": "Bar\\.Point", "type": "Bar"}, + 'bar_point': {'key': 'Bar\\.Point', 'type': 'Bar'}, } - def __init__(self, *, bar_point: Optional["Bar"] = None, **kwargs): + def __init__( + self, + *, + bar_point: Optional["Bar"] = None, + **kwargs + ): """ :keyword bar_point: Bar point. :paramtype bar_point: ~storage.models.Bar @@ -202,21 +218,27 @@ class Resource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): """ :keyword location: Required. Resource location. :paramtype location: str @@ -286,29 +308,29 @@ class StorageAccount(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "account_type": {"key": "properties.accountType", "type": "str"}, - "primary_endpoints": {"key": "properties.primaryEndpoints", "type": "Endpoints"}, - "primary_location": {"key": "properties.primaryLocation", "type": "str"}, - "status_of_primary": {"key": "properties.statusOfPrimary", "type": "str"}, - "last_geo_failover_time": {"key": "properties.lastGeoFailoverTime", "type": "iso-8601"}, - "secondary_location": {"key": "properties.secondaryLocation", "type": "str"}, - "status_of_secondary": {"key": "properties.statusOfSecondary", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - "custom_domain": {"key": "properties.customDomain", "type": "CustomDomain"}, - "secondary_endpoints": {"key": "properties.secondaryEndpoints", "type": "Endpoints"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'primary_endpoints': {'key': 'properties.primaryEndpoints', 'type': 'Endpoints'}, + 'primary_location': {'key': 'properties.primaryLocation', 'type': 'str'}, + 'status_of_primary': {'key': 'properties.statusOfPrimary', 'type': 'str'}, + 'last_geo_failover_time': {'key': 'properties.lastGeoFailoverTime', 'type': 'iso-8601'}, + 'secondary_location': {'key': 'properties.secondaryLocation', 'type': 'str'}, + 'status_of_secondary': {'key': 'properties.statusOfSecondary', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, + 'secondary_endpoints': {'key': 'properties.secondaryEndpoints', 'type': 'Endpoints'}, } def __init__( @@ -397,15 +419,21 @@ class StorageAccountCheckNameAvailabilityParameters(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str, type: Optional[str] = "Microsoft.Storage/storageAccounts", **kwargs): + def __init__( + self, + *, + name: str, + type: Optional[str] = "Microsoft.Storage/storageAccounts", + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -440,19 +468,19 @@ class StorageAccountCreateParameters(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "account_type": {"key": "properties.accountType", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, } def __init__( @@ -486,11 +514,17 @@ class StorageAccountKeys(msrest.serialization.Model): """ _attribute_map = { - "key1": {"key": "key1", "type": "str"}, - "key2": {"key": "key2", "type": "str"}, + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, } - def __init__(self, *, key1: Optional[str] = None, key2: Optional[str] = None, **kwargs): + def __init__( + self, + *, + key1: Optional[str] = None, + key2: Optional[str] = None, + **kwargs + ): """ :keyword key1: Gets the value of key 1. :paramtype key1: str @@ -513,11 +547,17 @@ class StorageAccountListResult(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[StorageAccount]"}, - "next_link": {"key": "nextLink", "type": "str"}, + 'value': {'key': 'value', 'type': '[StorageAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value: Optional[List["StorageAccount"]] = None, next_link: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[List["StorageAccount"]] = None, + next_link: Optional[str] = None, + **kwargs + ): """ :keyword value: Gets the list of storage accounts and their properties. :paramtype value: list[~storage.models.StorageAccount] @@ -538,10 +578,15 @@ class StorageAccountRegenerateKeyParameters(msrest.serialization.Model): """ _attribute_map = { - "key_name": {"key": "keyName", "type": "str"}, + 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, *, key_name: Optional[Union[str, "KeyName"]] = None, **kwargs): + def __init__( + self, + *, + key_name: Optional[Union[str, "KeyName"]] = None, + **kwargs + ): """ :keyword key_name: Possible values include: "key1", "key2". :paramtype key_name: str or ~storage.models.KeyName @@ -579,20 +624,20 @@ class StorageAccountUpdateParameters(Resource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "account_type": {"key": "properties.accountType", "type": "str"}, - "custom_domain": {"key": "properties.customDomain", "type": "CustomDomain"}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_type': {'key': 'properties.accountType', 'type': 'str'}, + 'custom_domain': {'key': 'properties.customDomain', 'type': 'CustomDomain'}, } def __init__( @@ -632,10 +677,15 @@ class SubResource(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): """ :keyword id: Resource Id. :paramtype id: str @@ -659,10 +709,10 @@ class Usage(msrest.serialization.Model): """ _attribute_map = { - "unit": {"key": "unit", "type": "str"}, - "current_value": {"key": "currentValue", "type": "int"}, - "limit": {"key": "limit", "type": "int"}, - "name": {"key": "name", "type": "UsageName"}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'UsageName'}, } def __init__( @@ -701,10 +751,15 @@ class UsageListResult(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, + 'value': {'key': 'value', 'type': '[Usage]'}, } - def __init__(self, *, value: Optional[List["Usage"]] = None, **kwargs): + def __init__( + self, + *, + value: Optional[List["Usage"]] = None, + **kwargs + ): """ :keyword value: Gets or sets the list Storage Resource Usages. :paramtype value: list[~storage.models.Usage] @@ -723,11 +778,17 @@ class UsageName(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): """ :keyword value: Gets a string describing the resource name. :paramtype value: str diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_storage_management_client_enums.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_storage_management_client_enums.py index 42ce44d45ef..cdb6d697091 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_storage_management_client_enums.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_storage_management_client_enums.py @@ -19,9 +19,9 @@ class AccountStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "Available" UNAVAILABLE = "Unavailable" - class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets or sets the account type.""" + """Gets or sets the account type. + """ STANDARD_LRS = "Standard_LRS" STANDARD_ZRS = "Standard_ZRS" @@ -29,21 +29,19 @@ class AccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STANDARD_RAGRS = "Standard_RAGRS" PREMIUM_LRS = "Premium_LRS" - class KeyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): KEY1 = "key1" KEY2 = "key2" - class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets the status of the storage account at the time the operation was called.""" + """Gets the status of the storage account at the time the operation was called. + """ CREATING = "Creating" RESOLVING_DNS = "ResolvingDNS" SUCCEEDED = "Succeeded" - class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. @@ -52,9 +50,9 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" - class UsageUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets the unit of measurement.""" + """Gets the unit of measurement. + """ COUNT = "Count" BYTES = "Bytes" diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/__init__.py index 387513ba3a8..291f880b141 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/__init__.py @@ -10,6 +10,6 @@ from ._usage_operations import UsageOperations __all__ = [ - "StorageAccountsOperations", - "UsageOperations", + 'StorageAccountsOperations', + 'UsageOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py index 8edf1bd1f66..1c43fe1aaff 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -31,9 +24,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -88,7 +80,7 @@ def build_create_request_initial( accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -126,7 +118,7 @@ def build_delete_request( api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -158,7 +150,7 @@ def build_get_properties_request( accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -196,7 +188,7 @@ def build_update_request( accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}') # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -235,7 +227,7 @@ def build_list_keys_request( accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys') # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -304,7 +296,7 @@ def build_list_by_resource_group_request( accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts') # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -341,7 +333,7 @@ def build_regenerate_key_request( accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey') # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -409,40 +401,47 @@ def check_name_availability( :rtype: ~storage.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.CheckNameAvailabilityResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(account_name, "StorageAccountCheckNameAvailabilityParameters") + _json = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, - template_url=self.check_name_availability.metadata["url"], + template_url=self.check_name_availability.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'} # type: ignore + def _create_initial( self, @@ -452,14 +451,16 @@ def _create_initial( **kwargs # type: Any ): # type: (...) -> Optional["_models.StorageAccount"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.StorageAccount"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.StorageAccount"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(parameters, "StorageAccountCreateParameters") + _json = self._serialize.body(parameters, 'StorageAccountCreateParameters') request = build_create_request_initial( resource_group_name=resource_group_name, @@ -468,12 +469,16 @@ def _create_initial( api_version=api_version, content_type=content_type, json=_json, - template_url=self._create_initial.metadata["url"], + template_url=self._create_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -482,14 +487,15 @@ def _create_initial( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def begin_create( @@ -526,12 +532,15 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~storage.models.StorageAccount] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccount"] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._create_initial( resource_group_name=resource_group_name, @@ -539,35 +548,32 @@ def begin_create( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore @distributed_trace def delete( @@ -590,23 +596,30 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_delete_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -616,7 +629,8 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def get_properties( @@ -641,37 +655,45 @@ def get_properties( :rtype: ~storage.models.StorageAccount :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccount"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_get_properties_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_properties.metadata["url"], + template_url=self.get_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_properties.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def update( @@ -704,14 +726,16 @@ def update( :rtype: ~storage.models.StorageAccount :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccount"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(parameters, "StorageAccountUpdateParameters") + _json = self._serialize.body(parameters, 'StorageAccountUpdateParameters') request = build_update_request( resource_group_name=resource_group_name, @@ -720,26 +744,31 @@ def update( api_version=api_version, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], + template_url=self.update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize('StorageAccount', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"} # type: ignore + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + @distributed_trace def list_keys( @@ -760,41 +789,50 @@ def list_keys( :rtype: ~storage.models.StorageAccountKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountKeys"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_list_keys_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], + template_url=self.list_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize('StorageAccountKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys"} # type: ignore + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'} # type: ignore + @distributed_trace def list( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Iterable["_models.StorageAccountListResult"] """Lists all the storage accounts available under the subscription. Note that storage keys are not @@ -806,25 +844,26 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~storage.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountListResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], + template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -845,7 +884,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -854,9 +897,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'} # type: ignore @distributed_trace def list_by_resource_group( @@ -876,26 +921,27 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~storage.models.StorageAccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountListResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], + template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, @@ -917,7 +963,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -926,9 +976,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts"} # type: ignore + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'} # type: ignore @distributed_trace def regenerate_key( @@ -954,15 +1006,17 @@ def regenerate_key( :rtype: ~storage.models.StorageAccountKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageAccountKeys"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageAccountKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _regenerate_key = _models.StorageAccountRegenerateKeyParameters(key_name=key_name) - _json = self._serialize.body(_regenerate_key, "StorageAccountRegenerateKeyParameters") + _json = self._serialize.body(_regenerate_key, 'StorageAccountRegenerateKeyParameters') request = build_regenerate_key_request( resource_group_name=resource_group_name, @@ -971,23 +1025,28 @@ def regenerate_key( api_version=api_version, content_type=content_type, json=_json, - template_url=self.regenerate_key.metadata["url"], + template_url=self.regenerate_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize('StorageAccountKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey"} # type: ignore + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py index 62591bd8f96..d82405300d8 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -94,7 +86,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def list( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.UsageListResult" """Gets the current usage count and the limit for the resources under the subscription. @@ -104,32 +97,40 @@ def list( :rtype: ~storage.models.UsageListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.UsageListResult"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], + template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("UsageListResult", pipeline_response) + deserialized = self._deserialize('UsageListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py index 134ed19236e..76028e221e7 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Some cool documentation. - """, + """ ) diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/__init__.py index 5516098e010..83558158f3d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MicrosoftAzureTestUrl"] +__all__ = ['MicrosoftAzureTestUrl'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_configuration.py index aa4abb9c79c..f796896f719 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_configuration.py @@ -21,7 +21,7 @@ from azure.core.credentials import TokenCredential -class MicrosoftAzureTestUrlConfiguration(Configuration): +class MicrosoftAzureTestUrlConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MicrosoftAzureTestUrl. Note that all parameters used to create this instance are saved as instance @@ -31,7 +31,8 @@ class MicrosoftAzureTestUrlConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription Id. :type subscription_id: str - :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -43,7 +44,7 @@ def __init__( ): # type: (...) -> None super(MicrosoftAzureTestUrlConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -53,24 +54,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "microsoftazuretesturl/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftazuretesturl/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py index e62f5ac2453..6c782c3e9ac 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py @@ -18,12 +18,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse - class MicrosoftAzureTestUrl(object): """Some cool documentation. @@ -48,9 +47,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - self._config = MicrosoftAzureTestUrlConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) + self._config = MicrosoftAzureTestUrlConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -59,6 +56,7 @@ def __init__( self._serialize.client_side_validation = False self.group = GroupOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_vendor.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_vendor.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/__init__.py index 5595d4583ad..b02e25a00c5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._microsoft_azure_test_url import MicrosoftAzureTestUrl - -__all__ = ["MicrosoftAzureTestUrl"] +__all__ = ['MicrosoftAzureTestUrl'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_configuration.py index c236e1ba3cf..ab9c0a1c01b 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftAzureTestUrlConfiguration(Configuration): +class MicrosoftAzureTestUrlConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MicrosoftAzureTestUrl. Note that all parameters used to create this instance are saved as instance @@ -29,13 +29,19 @@ class MicrosoftAzureTestUrlConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription Id. :type subscription_id: str - :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: super(MicrosoftAzureTestUrlConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -45,21 +51,22 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "microsoftazuretesturl/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftazuretesturl/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py index 3632f70f0d2..ee4972df743 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential - class MicrosoftAzureTestUrl: """Some cool documentation. @@ -45,9 +44,7 @@ def __init__( base_url: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = MicrosoftAzureTestUrlConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) + self._config = MicrosoftAzureTestUrlConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -56,7 +53,12 @@ def __init__( self._serialize.client_side_validation = False self.group = GroupOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/__init__.py index 30329fa5a61..59b9cb0110a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._group_operations import GroupOperations __all__ = [ - "GroupOperations", + 'GroupOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py index 9d0f90101e2..4ebb32dbbb0 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -25,11 +18,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._group_operations import build_get_sample_resource_group_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class GroupOperations: """GroupOperations async operations. @@ -53,7 +44,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> "_models.SampleResourceGroup": + async def get_sample_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> "_models.SampleResourceGroup": """Provides a resouce group with name 'testgroup101' and location 'West US'. :param resource_group_name: Resource Group name 'testgroup101'. @@ -63,22 +58,29 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An :rtype: ~subscriptionidapiversion.models.SampleResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SampleResourceGroup"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SampleResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str + request = build_get_sample_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, api_version=api_version, - template_url=self.get_sample_resource_group.metadata["url"], + template_url=self.get_sample_resource_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -86,11 +88,12 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SampleResourceGroup", pipeline_response) + deserialized = self._deserialize('SampleResourceGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sample_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}"} # type: ignore + get_sample_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py index 1b41d8f1471..75ad5081ede 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py @@ -14,6 +14,6 @@ from ._models import SampleResourceGroup # type: ignore __all__ = [ - "Error", - "SampleResourceGroup", + 'Error', + 'SampleResourceGroup', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models.py index 632612561d4..543d1f5dd2f 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "code": {"key": "code", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword code: :paramtype code: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.code = kwargs.get("code", None) - self.message = kwargs.get("message", None) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) class SampleResourceGroup(msrest.serialization.Model): @@ -46,11 +49,14 @@ class SampleResourceGroup(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: resource group name 'testgroup101'. :paramtype name: str @@ -58,5 +64,5 @@ def __init__(self, **kwargs): :paramtype location: str """ super(SampleResourceGroup, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.location = kwargs.get("location", None) + self.name = kwargs.get('name', None) + self.location = kwargs.get('location', None) diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models_py3.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models_py3.py index ac914bcec00..17c7809ff67 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models_py3.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "code": {"key": "code", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + code: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword code: :paramtype code: int @@ -48,11 +54,17 @@ class SampleResourceGroup(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, name: Optional[str] = None, location: Optional[str] = None, **kwargs): + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): """ :keyword name: resource group name 'testgroup101'. :paramtype name: str diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/__init__.py index 30329fa5a61..59b9cb0110a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/__init__.py @@ -9,5 +9,5 @@ from ._group_operations import GroupOperations __all__ = [ - "GroupOperations", + 'GroupOperations', ] diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py index a4d70fa48f0..8fd8e05bce9 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -110,22 +102,29 @@ def get_sample_resource_group( :rtype: ~subscriptionidapiversion.models.SampleResourceGroup :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SampleResourceGroup"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SampleResourceGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str + request = build_get_sample_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, api_version=api_version, - template_url=self.get_sample_resource_group.metadata["url"], + template_url=self.get_sample_resource_group.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,11 +132,12 @@ def get_sample_resource_group( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SampleResourceGroup", pipeline_response) + deserialized = self._deserialize('SampleResourceGroup', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_sample_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}"} # type: ignore + get_sample_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} # type: ignore + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/__init__.py index 623e438eb9c..48ac23f1972 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py index 27b3e462369..3d4ce69a7b4 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_configuration.py index eebf56f42f2..b9017b0ff7b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py index ecd1d021c33..2db0a55fdb1 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_duration_test_service import AutoRestDurationTestService - -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py index d53c6fcfd31..54e75592246 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodydurationlowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py index f7cece514e6..5994e663a71 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py index 2551fd5500f..1068a1ad711 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_get_invalid_request # type: ignore __all__ = [ - "build_get_null_request", - "build_put_positive_duration_request", - "build_get_positive_duration_request", - "build_get_invalid_request", + 'build_get_null_request', + 'build_put_positive_duration_request', + 'build_get_positive_duration_request', + 'build_get_invalid_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py index f3a13712c8e..21eeb377285 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -14,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -161,3 +159,4 @@ def build_get_invalid_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py index 3ed698a6462..c53c9d32639 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,16 +32,26 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/null" + url = '/duration/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_positive_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_positive_duration_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a positive duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -65,22 +75,31 @@ def build_put_positive_duration_request(*, json: JSONType = None, content: Any = json = "1 day, 0:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_positive_duration_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_positive_duration_request( + **kwargs: Any +) -> HttpRequest: """Get a positive duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -94,16 +113,23 @@ def build_get_positive_duration_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get an invalid duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -117,10 +143,16 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/invalid" + url = '/duration/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/setup.py index 385afe6573c..05c0d98d9d2 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/__init__.py index 56e647414e7..4b4eb6c2361 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterGroupingTestService"] +__all__ = ['AutoRestParameterGroupingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_auto_rest_parameter_grouping_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_auto_rest_parameter_grouping_test_service.py index aef89a7a20c..33943a0b988 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_auto_rest_parameter_grouping_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_auto_rest_parameter_grouping_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterGroupingTestService: """Test Infrastructure for AutoRest. @@ -27,14 +26,20 @@ class AutoRestParameterGroupingTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestParameterGroupingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_configuration.py index 80ae620b743..e26c79294ea 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestParameterGroupingTestServiceConfiguration(Configuration): +class AutoRestParameterGroupingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterGroupingTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterGroupingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparametergroupingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparametergroupingtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_vendor.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_vendor.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/__init__.py index 925eefd8198..43644446d42 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameter_grouping_test_service import AutoRestParameterGroupingTestService - -__all__ = ["AutoRestParameterGroupingTestService"] +__all__ = ['AutoRestParameterGroupingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_auto_rest_parameter_grouping_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_auto_rest_parameter_grouping_test_service.py index 035436c9db4..a7745727f00 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_auto_rest_parameter_grouping_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_auto_rest_parameter_grouping_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterGroupingTestService: """Test Infrastructure for AutoRest. @@ -27,14 +26,24 @@ class AutoRestParameterGroupingTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestParameterGroupingTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `azureparametergroupinglowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_configuration.py index 41cfe947cb7..b29d04da057 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestParameterGroupingTestServiceConfiguration(Configuration): +class AutoRestParameterGroupingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterGroupingTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterGroupingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparametergroupingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparametergroupingtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py index 7054a526d92..4ef570741cc 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py @@ -20,9 +20,9 @@ from ._request_builders import build_post_shared_parameter_group_object_request # type: ignore __all__ = [ - "build_post_required_request", - "build_post_optional_request", - "build_post_reserved_words_request", - "build_post_multi_param_groups_request", - "build_post_shared_parameter_group_object_request", + 'build_post_required_request', + 'build_post_optional_request', + 'build_post_reserved_words_request', + 'build_post_multi_param_groups_request', + 'build_post_shared_parameter_group_object_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py index 339e436afe0..27dfae75c7b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py @@ -15,8 +15,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -284,3 +283,4 @@ def build_post_shared_parameter_group_object_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py index a8b1a8ab8c0..69e66dcdb9c 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py @@ -11,8 +11,7 @@ from msrest import Serializer from ..._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -56,13 +55,13 @@ def build_post_required_request( json = 0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/parameterGrouping/postRequired/{path}" + url = '/parameterGrouping/postRequired/{path}' path_format_arguments = { - "path": _SERIALIZER.url("path", path, "str"), + "path": _SERIALIZER.url("path", path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -70,23 +69,32 @@ def build_post_required_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query is not None: - query_parameters["query"] = _SERIALIZER.query("query", query, "int") + query_parameters['query'] = _SERIALIZER.query("query", query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if custom_header is not None: - header_parameters["customHeader"] = _SERIALIZER.header("custom_header", custom_header, "str") + header_parameters['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) def build_post_optional_request( - *, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs: Any + *, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs: Any ) -> HttpRequest: """Post a bunch of optional parameters grouped. @@ -105,24 +113,33 @@ def build_post_optional_request( accept = "application/json" # Construct URL - url = "/parameterGrouping/postOptional" + url = '/parameterGrouping/postOptional' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query is not None: - query_parameters["query"] = _SERIALIZER.query("query", query, "int") + query_parameters['query'] = _SERIALIZER.query("query", query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if custom_header is not None: - header_parameters["customHeader"] = _SERIALIZER.header("custom_header", custom_header, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_post_reserved_words_request( - *, from_parameter: Optional[str] = None, accept_parameter: Optional[str] = None, **kwargs: Any + *, + from_parameter: Optional[str] = None, + accept_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Post a grouped parameters with reserved words. @@ -141,20 +158,26 @@ def build_post_reserved_words_request( accept = "application/json" # Construct URL - url = "/parameterGrouping/postReservedWords" + url = '/parameterGrouping/postReservedWords' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if from_parameter is not None: - query_parameters["from"] = _SERIALIZER.query("from_parameter", from_parameter, "str") + query_parameters['from'] = _SERIALIZER.query("from_parameter", from_parameter, 'str') if accept_parameter is not None: - query_parameters["accept"] = _SERIALIZER.query("accept_parameter", accept_parameter, "str") + query_parameters['accept'] = _SERIALIZER.query("accept_parameter", accept_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_post_multi_param_groups_request( @@ -186,28 +209,37 @@ def build_post_multi_param_groups_request( accept = "application/json" # Construct URL - url = "/parameterGrouping/postMultipleParameterGroups" + url = '/parameterGrouping/postMultipleParameterGroups' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query_one is not None: - query_parameters["query-one"] = _SERIALIZER.query("query_one", query_one, "int") + query_parameters['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') if query_two is not None: - query_parameters["query-two"] = _SERIALIZER.query("query_two", query_two, "int") + query_parameters['query-two'] = _SERIALIZER.query("query_two", query_two, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_one is not None: - header_parameters["header-one"] = _SERIALIZER.header("header_one", header_one, "str") + header_parameters['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') if header_two is not None: - header_parameters["header-two"] = _SERIALIZER.header("header_two", header_two, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['header-two'] = _SERIALIZER.header("header_two", header_two, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_post_shared_parameter_group_object_request( - *, header_one: Optional[str] = None, query_one: Optional[int] = 30, **kwargs: Any + *, + header_one: Optional[str] = None, + query_one: Optional[int] = 30, + **kwargs: Any ) -> HttpRequest: """Post parameters with a shared parameter group object. @@ -226,17 +258,24 @@ def build_post_shared_parameter_group_object_request( accept = "application/json" # Construct URL - url = "/parameterGrouping/sharedParameterGroupObject" + url = '/parameterGrouping/sharedParameterGroupObject' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query_one is not None: - query_parameters["query-one"] = _SERIALIZER.query("query_one", query_one, "int") + query_parameters['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_one is not None: - header_parameters["header-one"] = _SERIALIZER.header("header_one", header_one, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/setup.py index 5b4af33fe8a..999d5456e09 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/__init__.py index f41ac75f784..f93c711020e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestReportServiceForAzure"] +__all__ = ['AutoRestReportServiceForAzure'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_auto_rest_report_service_for_azure.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_auto_rest_report_service_for_azure.py index 0a8258c1830..3f75dcd12d5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_auto_rest_report_service_for_azure.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_auto_rest_report_service_for_azure.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportServiceForAzure: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestReportServiceForAzure: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestReportServiceForAzureConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_configuration.py index 6f9c38083eb..175c44970b6 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestReportServiceForAzureConfiguration(Configuration): +class AutoRestReportServiceForAzureConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportServiceForAzure. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceForAzureConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportserviceforazure/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportserviceforazure/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/__init__.py index da79a2dd3bd..13808e726c2 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_report_service_for_azure import AutoRestReportServiceForAzure - -__all__ = ["AutoRestReportServiceForAzure"] +__all__ = ['AutoRestReportServiceForAzure'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_auto_rest_report_service_for_azure.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_auto_rest_report_service_for_azure.py index 7ce34075c56..743c2671923 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_auto_rest_report_service_for_azure.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_auto_rest_report_service_for_azure.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportServiceForAzure: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestReportServiceForAzure: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestReportServiceForAzureConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `azurereportlowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_configuration.py index 0a75f8ad29c..5bb752f3da4 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestReportServiceForAzureConfiguration(Configuration): +class AutoRestReportServiceForAzureConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportServiceForAzure. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceForAzureConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportserviceforazure/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportserviceforazure/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py index 47e8a3b88d4..2a513781bb2 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_report_request # type: ignore __all__ = [ - "build_get_report_request", + 'build_get_report_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py index 9636440f902..8b88ae5caa9 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py @@ -68,3 +68,4 @@ def build_get_report_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py index c7ff65244e7..50f85ec5e7a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py @@ -14,7 +14,11 @@ _SERIALIZER.client_side_validation = False -def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_get_report_request( + *, + qualifier: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get test coverage report. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -40,15 +44,22 @@ def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) accept = "application/json" # Construct URL - url = "/report/azure" + url = '/report/azure' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if qualifier is not None: - query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/setup.py index 94333e8e5a3..b8884760fd7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/__init__.py index a556ef949db..9ddba899fc1 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestAzureSpecialParametersTestClient"] +__all__ = ['AutoRestAzureSpecialParametersTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_auto_rest_azure_special_parameters_test_client.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_auto_rest_azure_special_parameters_test_client.py index 2d808d6e40a..88376cd9636 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_auto_rest_azure_special_parameters_test_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_auto_rest_azure_special_parameters_test_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials import TokenCredential - class AutoRestAzureSpecialParametersTestClient: """Test Infrastructure for AutoRest. @@ -45,15 +44,14 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + + self._config = AutoRestAzureSpecialParametersTestClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_configuration.py index 1a7d16bb1f6..9b7ad26b889 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_configuration.py @@ -19,23 +19,30 @@ from azure.core.credentials import TokenCredential -class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): +class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestAzureSpecialParametersTestClient. Note that all parameters used to create this instance are saved as instance attributes. - :param subscription_id: The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + :param subscription_id: The subscription id, which appears in the path, always modeled in + credentials. The value is always '1234-5678-9012-3456'. :type subscription_id: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestAzureSpecialParametersTestClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -45,24 +52,23 @@ def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestazurespecialparameterstestclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestazurespecialparameterstestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_vendor.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_vendor.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/__init__.py index 2c807d773e3..71365d65258 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_azure_special_parameters_test_client import AutoRestAzureSpecialParametersTestClient - -__all__ = ["AutoRestAzureSpecialParametersTestClient"] +__all__ = ['AutoRestAzureSpecialParametersTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_auto_rest_azure_special_parameters_test_client.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_auto_rest_azure_special_parameters_test_client.py index 8dc484edcaf..b0bd0e19b29 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_auto_rest_azure_special_parameters_test_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_auto_rest_azure_special_parameters_test_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestAzureSpecialParametersTestClient: """Test Infrastructure for AutoRest. @@ -45,15 +44,18 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + self._config = AutoRestAzureSpecialParametersTestClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `azurespecialpropertieslowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_configuration.py index aa7af6a3ba8..35733672be2 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/aio/_configuration.py @@ -19,23 +19,30 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): +class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestAzureSpecialParametersTestClient. Note that all parameters used to create this instance are saved as instance attributes. - :param subscription_id: The subscription id, which appears in the path, always modeled in credentials. The value is always '1234-5678-9012-3456'. + :param subscription_id: The subscription id, which appears in the path, always modeled in + credentials. The value is always '1234-5678-9012-3456'. :type subscription_id: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-07-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestAzureSpecialParametersTestClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -45,21 +52,22 @@ def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **k self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestazurespecialparameterstestclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestazurespecialparameterstestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py index 2de384d5760..57d0053d180 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_get_swagger_global_valid_request # type: ignore __all__ = [ - "build_get_method_global_valid_request", - "build_get_method_global_not_provided_valid_request", - "build_get_path_global_valid_request", - "build_get_swagger_global_valid_request", + 'build_get_method_global_valid_request', + 'build_get_method_global_not_provided_valid_request', + 'build_get_path_global_valid_request', + 'build_get_swagger_global_valid_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py index cb082bf3566..492563602f0 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py @@ -168,3 +168,4 @@ def build_get_swagger_global_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py index 9b6db9bde8a..47ca6c2e3cd 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py @@ -13,7 +13,9 @@ _SERIALIZER = Serializer() -def build_get_method_global_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_method_global_valid_request( + **kwargs: Any +) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -25,24 +27,32 @@ def build_get_method_global_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview" + url = '/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_method_global_not_provided_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_method_global_not_provided_valid_request( + **kwargs: Any +) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -54,24 +64,32 @@ def build_get_method_global_not_provided_valid_request(**kwargs: Any) -> HttpReq :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview" + url = '/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_path_global_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_path_global_valid_request( + **kwargs: Any +) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -83,24 +101,32 @@ def build_get_path_global_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview" + url = '/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_swagger_global_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_swagger_global_valid_request( + **kwargs: Any +) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -112,18 +138,25 @@ def build_get_swagger_global_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview" + url = '/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py index 1b0edf68897..aa513d98d90 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_get_swagger_local_valid_request # type: ignore __all__ = [ - "build_get_method_local_valid_request", - "build_get_method_local_null_request", - "build_get_path_local_valid_request", - "build_get_swagger_local_valid_request", + 'build_get_method_local_valid_request', + 'build_get_method_local_null_request', + 'build_get_path_local_valid_request', + 'build_get_swagger_local_valid_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py index 700efe45457..9754aa7c7c1 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py @@ -182,3 +182,4 @@ def build_get_swagger_local_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py index 80fb6acb0c2..9907359c8da 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py @@ -13,7 +13,9 @@ _SERIALIZER = Serializer() -def build_get_method_local_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_method_local_valid_request( + **kwargs: Any +) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -28,24 +30,34 @@ def build_get_method_local_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/local/2.0" + url = '/azurespecials/apiVersion/method/string/none/query/local/2.0' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_get_method_local_null_request(*, api_version: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_method_local_null_request( + *, + api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = null to succeed. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -62,21 +74,29 @@ def build_get_method_local_null_request(*, api_version: Optional[str] = None, ** accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/local/null" + url = '/azurespecials/apiVersion/method/string/none/query/local/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if api_version is not None: - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_path_local_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_path_local_valid_request( + **kwargs: Any +) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -91,24 +111,32 @@ def build_get_path_local_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/path/string/none/query/local/2.0" + url = '/azurespecials/apiVersion/path/string/none/query/local/2.0' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_swagger_local_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_swagger_local_valid_request( + **kwargs: Any +) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -124,18 +152,25 @@ def build_get_swagger_local_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/swagger/string/none/query/local/2.0" + url = '/azurespecials/apiVersion/swagger/string/none/query/local/2.0' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py index 9482c75db3a..fda9456f714 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_custom_named_request_id_head_request # type: ignore __all__ = [ - "build_custom_named_request_id_request", - "build_custom_named_request_id_param_grouping_request", - "build_custom_named_request_id_head_request", + 'build_custom_named_request_id_request', + 'build_custom_named_request_id_param_grouping_request', + 'build_custom_named_request_id_head_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py index 7122fcc2168..725159cdd3a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py @@ -125,3 +125,4 @@ def build_custom_named_request_id_head_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py index 0014f2a9bab..932a348aa62 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py @@ -13,7 +13,11 @@ _SERIALIZER = Serializer() -def build_custom_named_request_id_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: +def build_custom_named_request_id_request( + *, + foo_client_request_id: str, + **kwargs: Any +) -> HttpRequest: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -29,19 +33,26 @@ def build_custom_named_request_id_request(*, foo_client_request_id: str, **kwarg accept = "application/json" # Construct URL - url = "/azurespecials/customNamedRequestId" + url = '/azurespecials/customNamedRequestId' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["foo-client-request-id"] = _SERIALIZER.header( - "foo_client_request_id", foo_client_request_id, "str" + header_parameters['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - -def build_custom_named_request_id_param_grouping_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: +def build_custom_named_request_id_param_grouping_request( + *, + foo_client_request_id: str, + **kwargs: Any +) -> HttpRequest: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. @@ -58,19 +69,26 @@ def build_custom_named_request_id_param_grouping_request(*, foo_client_request_i accept = "application/json" # Construct URL - url = "/azurespecials/customNamedRequestIdParamGrouping" + url = '/azurespecials/customNamedRequestIdParamGrouping' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["foo-client-request-id"] = _SERIALIZER.header( - "foo_client_request_id", foo_client_request_id, "str" + header_parameters['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) -def build_custom_named_request_id_head_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: +def build_custom_named_request_id_head_request( + *, + foo_client_request_id: str, + **kwargs: Any +) -> HttpRequest: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -86,13 +104,17 @@ def build_custom_named_request_id_head_request(*, foo_client_request_id: str, ** accept = "application/json" # Construct URL - url = "/azurespecials/customNamedRequestIdHead" + url = '/azurespecials/customNamedRequestIdHead' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["foo-client-request-id"] = _SERIALIZER.header( - "foo_client_request_id", foo_client_request_id, "str" + header_parameters['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py index ed7f4a99f12..2afc7de910e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_with_filter_request # type: ignore __all__ = [ - "build_get_with_filter_request", + 'build_get_with_filter_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py index ca2a4cb792c..216abe06668 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py @@ -67,3 +67,4 @@ def build_get_with_filter_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py index ab83be993b0..0ab769733c6 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py @@ -14,7 +14,11 @@ def build_get_with_filter_request( - *, filter: Optional[str] = None, top: Optional[int] = None, orderby: Optional[str] = None, **kwargs: Any + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. @@ -35,19 +39,26 @@ def build_get_with_filter_request( accept = "application/json" # Construct URL - url = "/azurespecials/odata/filter" + url = '/azurespecials/odata/filter' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters["$filter"] = _SERIALIZER.query("filter", filter, "str") + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters["$top"] = _SERIALIZER.query("top", top, "int") + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') if orderby is not None: - query_parameters["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py index 75de623f002..c8289773501 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py @@ -24,11 +24,11 @@ from ._request_builders import build_get_swagger_query_valid_request # type: ignore __all__ = [ - "build_get_method_path_valid_request", - "build_get_path_valid_request", - "build_get_swagger_path_valid_request", - "build_get_method_query_valid_request", - "build_get_method_query_null_request", - "build_get_path_query_valid_request", - "build_get_swagger_query_valid_request", + 'build_get_method_path_valid_request', + 'build_get_path_valid_request', + 'build_get_swagger_path_valid_request', + 'build_get_method_query_valid_request', + 'build_get_method_query_null_request', + 'build_get_path_query_valid_request', + 'build_get_swagger_query_valid_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py index 36b6f40e317..6c0ea98751e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py @@ -301,3 +301,4 @@ def build_get_swagger_query_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py index e2f7ad004c8..e30911cd944 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py @@ -15,7 +15,10 @@ _SERIALIZER = Serializer() -def build_get_method_path_valid_request(unencoded_path_param: str, **kwargs: Any) -> HttpRequest: +def build_get_method_path_valid_request( + unencoded_path_param: str, + **kwargs: Any +) -> HttpRequest: """Get method with unencoded path parameter with value 'path1/path2/path3'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,21 +34,29 @@ def build_get_method_path_valid_request(unencoded_path_param: str, **kwargs: Any accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}" + url = '/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}' path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_path_valid_request(unencoded_path_param: str, **kwargs: Any) -> HttpRequest: +def build_get_path_valid_request( + unencoded_path_param: str, + **kwargs: Any +) -> HttpRequest: """Get method with unencoded path parameter with value 'path1/path2/path3'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -61,21 +72,28 @@ def build_get_path_valid_request(unencoded_path_param: str, **kwargs: Any) -> Ht accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}" + url = '/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}' path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_swagger_path_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_swagger_path_valid_request( + **kwargs: Any +) -> HttpRequest: """Get method with unencoded path parameter with value 'path1/path2/path3'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -91,25 +109,34 @@ def build_get_swagger_path_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - unencoded_path_param = kwargs.pop("unencoded_path_param", "path1/path2/path3") # type: str + unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}" + url = '/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}' path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_method_query_valid_request(*, q1: str, **kwargs: Any) -> HttpRequest: +def build_get_method_query_valid_request( + *, + q1: str, + **kwargs: Any +) -> HttpRequest: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -125,20 +152,30 @@ def build_get_method_query_valid_request(*, q1: str, **kwargs: Any) -> HttpReque accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/method/query/valid" + url = '/azurespecials/skipUrlEncoding/method/query/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_get_method_query_null_request(*, q1: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_method_query_null_request( + *, + q1: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get method with unencoded query parameter with value null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -154,21 +191,31 @@ def build_get_method_query_null_request(*, q1: Optional[str] = None, **kwargs: A accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/method/query/null" + url = '/azurespecials/skipUrlEncoding/method/query/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if q1 is not None: - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_get_path_query_valid_request(*, q1: str, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_path_query_valid_request( + *, + q1: str, + **kwargs: Any +) -> HttpRequest: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -184,20 +231,28 @@ def build_get_path_query_valid_request(*, q1: str, **kwargs: Any) -> HttpRequest accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/path/query/valid" + url = '/azurespecials/skipUrlEncoding/path/query/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_swagger_query_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_swagger_query_valid_request( + **kwargs: Any +) -> HttpRequest: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -213,18 +268,25 @@ def build_get_swagger_query_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - q1 = kwargs.pop("q1", "value1&q2=value2&q3=value3") # type: str + q1 = kwargs.pop('q1', "value1&q2=value2&q3=value3") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/swagger/query/valid" + url = '/azurespecials/skipUrlEncoding/swagger/query/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py index 037aec6cb67..19e0c064cbd 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py @@ -20,9 +20,9 @@ from ._request_builders import build_post_swagger_global_valid_request # type: ignore __all__ = [ - "build_post_method_global_valid_request", - "build_post_method_global_null_request", - "build_post_method_global_not_provided_valid_request", - "build_post_path_global_valid_request", - "build_post_swagger_global_valid_request", + 'build_post_method_global_valid_request', + 'build_post_method_global_null_request', + 'build_post_method_global_not_provided_valid_request', + 'build_post_path_global_valid_request', + 'build_post_swagger_global_valid_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py index 61f20cd03ad..61425ce11aa 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py @@ -230,3 +230,4 @@ def build_post_swagger_global_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py index ebf28b645f6..993f342fa11 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py @@ -15,7 +15,10 @@ _SERIALIZER = Serializer() -def build_post_method_global_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_method_global_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -33,21 +36,29 @@ def build_post_method_global_valid_request(subscription_id: str, **kwargs: Any) accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_method_global_null_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_method_global_null_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. @@ -65,21 +76,29 @@ def build_post_method_global_null_request(subscription_id: str, **kwargs: Any) - accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_method_global_not_provided_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_method_global_not_provided_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -95,29 +114,38 @@ def build_post_method_global_not_provided_valid_request(subscription_id: str, ** :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_post_path_global_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_path_global_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -135,21 +163,29 @@ def build_post_path_global_valid_request(subscription_id: str, **kwargs: Any) -> accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_swagger_global_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_swagger_global_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -167,15 +203,21 @@ def build_post_swagger_global_valid_request(subscription_id: str, **kwargs: Any) accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py index f9e02296e01..2e4fc9dbac5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_post_swagger_local_valid_request # type: ignore __all__ = [ - "build_post_method_local_valid_request", - "build_post_method_local_null_request", - "build_post_path_local_valid_request", - "build_post_swagger_local_valid_request", + 'build_post_method_local_valid_request', + 'build_post_method_local_null_request', + 'build_post_path_local_valid_request', + 'build_post_swagger_local_valid_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py index 9b206521484..9897b18d9d0 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py @@ -181,3 +181,4 @@ def build_post_swagger_local_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py index 8e99ee28212..f61c67515c7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py @@ -15,7 +15,10 @@ _SERIALIZER = Serializer() -def build_post_method_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_method_local_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -33,21 +36,29 @@ def build_post_method_local_valid_request(subscription_id: str, **kwargs: Any) - accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_method_local_null_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_method_local_null_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. @@ -65,21 +76,29 @@ def build_post_method_local_null_request(subscription_id: str, **kwargs: Any) -> accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_path_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_path_local_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -96,21 +115,29 @@ def build_post_path_local_valid_request(subscription_id: str, **kwargs: Any) -> accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_swagger_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_post_swagger_local_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -128,15 +155,21 @@ def build_post_swagger_local_valid_request(subscription_id: str, **kwargs: Any) accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py index d91016b544c..05eb3780ac5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_param_get_request # type: ignore __all__ = [ - "build_get_request", - "build_param_get_request", + 'build_get_request', + 'build_param_get_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py index 27373c38b73..fc0bbc7ecc5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py @@ -80,3 +80,4 @@ def build_param_get_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py index 3d6dfeee4cc..d4c28780291 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py @@ -13,7 +13,9 @@ _SERIALIZER = Serializer() -def build_get_request(**kwargs: Any) -> HttpRequest: +def build_get_request( + **kwargs: Any +) -> HttpRequest: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -27,12 +29,20 @@ def build_get_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/azurespecials/overwrite/x-ms-client-request-id/method/" + url = '/azurespecials/overwrite/x-ms-client-request-id/method/' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_param_get_request(*, x_ms_client_request_id: str, **kwargs: Any) -> HttpRequest: +def build_param_get_request( + *, + x_ms_client_request_id: str, + **kwargs: Any +) -> HttpRequest: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -50,13 +60,17 @@ def build_param_get_request(*, x_ms_client_request_id: str, **kwargs: Any) -> Ht accept = "application/json" # Construct URL - url = "/azurespecials/overwrite/x-ms-client-request-id/via-param/method/" + url = '/azurespecials/overwrite/x-ms-client-request-id/via-param/method/' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["x-ms-client-request-id"] = _SERIALIZER.header( - "x_ms_client_request_id", x_ms_client_request_id, "str" + header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("x_ms_client_request_id", x_ms_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/setup.py index 4bf95843e93..2b423533987 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py index bcd7bcd9fec..6ef996852a7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py index 9f064aca224..91a77b59b4c 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -27,14 +26,19 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest @@ -62,7 +66,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py index 128274f962d..840dcb8cfa4 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -24,25 +24,30 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py index 0fe5782d645..3b422c27c1d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient - -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py index b0a9260303c..abe7ade42be 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -27,15 +26,24 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `custombaseurllowlevel.rest`. @@ -58,7 +66,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py index cf7cbb01aaf..789b6e8a4d7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py index 5daa0aa077d..aa0aa1f1613 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_empty_request # type: ignore __all__ = [ - "build_get_empty_request", + 'build_get_empty_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py index 718db040ff1..3bf53989133 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py @@ -47,3 +47,4 @@ def build_get_empty_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py index 728ef604371..957ad8a3f6a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py @@ -13,7 +13,9 @@ _SERIALIZER = Serializer() -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get a 200 to test a valid base uri. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -27,10 +29,16 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/customuri" + url = '/customuri' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py index c250c733c08..63bc16d691a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/__init__.py index 7ce1af93032..cd76db4da70 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestPagingClient"] +__all__ = ['AutoRestParameterizedHostTestPagingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_auto_rest_parameterized_host_test_paging_client.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_auto_rest_parameterized_host_test_paging_client.py index bb1a4bea0dc..58a989e66b5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_auto_rest_parameterized_host_test_paging_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_auto_rest_parameterized_host_test_paging_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestPagingClient: """Test Infrastructure for AutoRest. @@ -27,8 +26,12 @@ class AutoRestParameterizedHostTestPagingClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestPagingClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -36,6 +39,7 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest @@ -63,7 +67,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_configuration.py index 55c5481b291..e8c7573945e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): +class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestPagingClient. Note that all parameters used to create this instance are saved as instance @@ -24,25 +24,30 @@ class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestPagingClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestpagingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestpagingclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_vendor.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_vendor.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/__init__.py index fa406e9634b..d6de8164bf5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_paging_client import AutoRestParameterizedHostTestPagingClient - -__all__ = ["AutoRestParameterizedHostTestPagingClient"] +__all__ = ['AutoRestParameterizedHostTestPagingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_auto_rest_parameterized_host_test_paging_client.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_auto_rest_parameterized_host_test_paging_client.py index e3914edc8a8..d587febdb0a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_auto_rest_parameterized_host_test_paging_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_auto_rest_parameterized_host_test_paging_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestPagingClient: """Test Infrastructure for AutoRest. @@ -27,8 +26,12 @@ class AutoRestParameterizedHostTestPagingClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestPagingClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -36,7 +39,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `custombaseurlpaginglowlevel.rest`. @@ -59,7 +67,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_configuration.py index 6e56dacdfc7..bb844c63f9e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): +class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestPagingClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestPagingClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestpagingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestpagingclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py index 2bf67c01227..e9226116512 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_get_pages_partial_url_operation_next_request # type: ignore __all__ = [ - "build_get_pages_partial_url_request", - "build_get_pages_partial_url_operation_request", - "build_get_pages_partial_url_operation_next_request", + 'build_get_pages_partial_url_request', + 'build_get_pages_partial_url_operation_request', + 'build_get_pages_partial_url_operation_next_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py index 07b957b2d34..c00aefeb526 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py @@ -169,3 +169,4 @@ def build_get_pages_partial_url_operation_next_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py index e25f251e265..e3001267c2e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py @@ -16,7 +16,9 @@ _SERIALIZER.client_side_validation = False -def build_get_pages_partial_url_request(**kwargs: Any) -> HttpRequest: +def build_get_pages_partial_url_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that combines custom url, paging and partial URL and expect to concat after host. @@ -47,16 +49,23 @@ def build_get_pages_partial_url_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/customurl/partialnextlink" + url = '/paging/customurl/partialnextlink' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_pages_partial_url_operation_request(**kwargs: Any) -> HttpRequest: +def build_get_pages_partial_url_operation_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that combines custom url, paging and partial URL with next operation. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -86,16 +95,24 @@ def build_get_pages_partial_url_operation_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/customurl/partialnextlinkop" + url = '/paging/customurl/partialnextlinkop' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_pages_partial_url_operation_next_request(next_link: str, **kwargs: Any) -> HttpRequest: +def build_get_pages_partial_url_operation_next_request( + next_link: str, + **kwargs: Any +) -> HttpRequest: """A paging operation that combines custom url, paging and partial URL. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -127,15 +144,21 @@ def build_get_pages_partial_url_operation_next_request(next_link: str, **kwargs: accept = "application/json" # Construct URL - url = "/paging/customurl/{nextLink}" + url = '/paging/customurl/{nextLink}' path_format_arguments = { - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/setup.py index 8dd0ffbcbef..647deb3a8e6 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/__init__.py index 6064aa40bfd..407776c5bac 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHeadExceptionTestService"] +__all__ = ['AutoRestHeadExceptionTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_auto_rest_head_exception_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_auto_rest_head_exception_test_service.py index 11339939b50..3d7c682c1ea 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_auto_rest_head_exception_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_auto_rest_head_exception_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials import TokenCredential - class AutoRestHeadExceptionTestService: """Test Infrastructure for AutoRest. @@ -32,9 +31,13 @@ class AutoRestHeadExceptionTestService: """ def __init__( - self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "TokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: - + self._config = AutoRestHeadExceptionTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -42,6 +45,7 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_configuration.py index f5970e4decb..1c336e64447 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class AutoRestHeadExceptionTestServiceConfiguration(Configuration): +class AutoRestHeadExceptionTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadExceptionTestService. Note that all parameters used to create this instance are saved as instance @@ -29,30 +29,33 @@ class AutoRestHeadExceptionTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadExceptionTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadexceptiontestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadexceptiontestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/__init__.py index 828b2a86e01..7a28607d182 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_head_exception_test_service import AutoRestHeadExceptionTestService - -__all__ = ["AutoRestHeadExceptionTestService"] +__all__ = ['AutoRestHeadExceptionTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_auto_rest_head_exception_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_auto_rest_head_exception_test_service.py index bebfe30bc33..d89dd8d2fb4 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_auto_rest_head_exception_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_auto_rest_head_exception_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestHeadExceptionTestService: """Test Infrastructure for AutoRest. @@ -32,7 +31,11 @@ class AutoRestHeadExceptionTestService: """ def __init__( - self, credential: "AsyncTokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestHeadExceptionTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -41,7 +44,12 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `headexceptionslowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_configuration.py index ec5596c8202..b21528dab5f 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestHeadExceptionTestServiceConfiguration(Configuration): +class AutoRestHeadExceptionTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadExceptionTestService. Note that all parameters used to create this instance are saved as instance @@ -29,27 +29,32 @@ class AutoRestHeadExceptionTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadExceptionTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadexceptiontestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadexceptiontestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py index 5581e44ff36..5592646f4af 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_head404_request # type: ignore __all__ = [ - "build_head200_request", - "build_head204_request", - "build_head404_request", + 'build_head200_request', + 'build_head204_request', + 'build_head404_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py index 5b7d2895b12..a367045003e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py @@ -92,3 +92,4 @@ def build_head404_request( url=url, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py index 702f87a0eb9..fbd689142eb 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER.client_side_validation = False -def build_head200_request(**kwargs: Any) -> HttpRequest: +def build_head200_request( + **kwargs: Any +) -> HttpRequest: """Return 200 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -27,12 +29,18 @@ def build_head200_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/success/200" + url = '/http/success/200' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_head204_request(**kwargs: Any) -> HttpRequest: +def build_head204_request( + **kwargs: Any +) -> HttpRequest: """Return 204 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -45,12 +53,18 @@ def build_head204_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/success/204" + url = '/http/success/204' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_head404_request(**kwargs: Any) -> HttpRequest: +def build_head404_request( + **kwargs: Any +) -> HttpRequest: """Return 404 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -63,6 +77,11 @@ def build_head404_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/success/404" + url = '/http/success/404' + + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) - return HttpRequest(method="HEAD", url=url, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/setup.py index 70236538118..5914b6853f9 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/__init__.py index 2a478ab434d..821fa23f191 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_auto_rest_head_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_auto_rest_head_test_service.py index ea47aaca2d2..a135622217f 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_auto_rest_head_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_auto_rest_head_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials import TokenCredential - class AutoRestHeadTestService: """Test Infrastructure for AutoRest. @@ -32,9 +31,13 @@ class AutoRestHeadTestService: """ def __init__( - self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "TokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: - + self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -42,6 +45,7 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_configuration.py index 3752db5b729..04d1229907c 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance @@ -29,30 +29,33 @@ class AutoRestHeadTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/__init__.py index 6c3806fafee..c8c7dee1857 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_head_test_service import AutoRestHeadTestService - -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_auto_rest_head_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_auto_rest_head_test_service.py index 65cec258f9b..5cb8071cfe0 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_auto_rest_head_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_auto_rest_head_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestHeadTestService: """Test Infrastructure for AutoRest. @@ -32,7 +31,11 @@ class AutoRestHeadTestService: """ def __init__( - self, credential: "AsyncTokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -41,7 +44,12 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `headlowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_configuration.py index 39324636276..2d2fa5415ae 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestHeadTestServiceConfiguration(Configuration): +class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. Note that all parameters used to create this instance are saved as instance @@ -29,27 +29,32 @@ class AutoRestHeadTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py index 5581e44ff36..5592646f4af 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_head404_request # type: ignore __all__ = [ - "build_head200_request", - "build_head204_request", - "build_head404_request", + 'build_head200_request', + 'build_head204_request', + 'build_head404_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py index 5b7d2895b12..a367045003e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py @@ -92,3 +92,4 @@ def build_head404_request( url=url, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py index 702f87a0eb9..fbd689142eb 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER.client_side_validation = False -def build_head200_request(**kwargs: Any) -> HttpRequest: +def build_head200_request( + **kwargs: Any +) -> HttpRequest: """Return 200 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -27,12 +29,18 @@ def build_head200_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/success/200" + url = '/http/success/200' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_head204_request(**kwargs: Any) -> HttpRequest: +def build_head204_request( + **kwargs: Any +) -> HttpRequest: """Return 204 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -45,12 +53,18 @@ def build_head204_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/success/204" + url = '/http/success/204' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_head404_request(**kwargs: Any) -> HttpRequest: +def build_head404_request( + **kwargs: Any +) -> HttpRequest: """Return 404 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -63,6 +77,11 @@ def build_head404_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/success/404" + url = '/http/success/404' + + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) - return HttpRequest(method="HEAD", url=url, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/setup.py index 131cedf730b..cd62e3d4daa 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/__init__.py index 7ece5ec6c91..fa45fce0e43 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestLongRunningOperationTestService"] +__all__ = ['AutoRestLongRunningOperationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_auto_rest_long_running_operation_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_auto_rest_long_running_operation_test_service.py index c0a9a4715a6..b7d4aebfaab 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_auto_rest_long_running_operation_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_auto_rest_long_running_operation_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials import TokenCredential - class AutoRestLongRunningOperationTestService: """Long-running Operation for AutoRest. @@ -32,9 +31,13 @@ class AutoRestLongRunningOperationTestService: """ def __init__( - self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "TokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: - + self._config = AutoRestLongRunningOperationTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -42,6 +45,7 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_configuration.py index 5384d3da397..5af259c0e92 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): +class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestLongRunningOperationTestService. Note that all parameters used to create this instance are saved as instance @@ -29,30 +29,33 @@ class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestLongRunningOperationTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestlongrunningoperationtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestlongrunningoperationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/__init__.py index 059561b117f..662ae8ef026 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_long_running_operation_test_service import AutoRestLongRunningOperationTestService - -__all__ = ["AutoRestLongRunningOperationTestService"] +__all__ = ['AutoRestLongRunningOperationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_auto_rest_long_running_operation_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_auto_rest_long_running_operation_test_service.py index 0fa03ef2229..d15636f4830 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_auto_rest_long_running_operation_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_auto_rest_long_running_operation_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestLongRunningOperationTestService: """Long-running Operation for AutoRest. @@ -32,7 +31,11 @@ class AutoRestLongRunningOperationTestService: """ def __init__( - self, credential: "AsyncTokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestLongRunningOperationTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -41,7 +44,12 @@ def __init__( self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `lrolowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_configuration.py index 1fc0cf77ca3..d4d5e011886 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): +class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestLongRunningOperationTestService. Note that all parameters used to create this instance are saved as instance @@ -29,27 +29,32 @@ class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestLongRunningOperationTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestlongrunningoperationtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestlongrunningoperationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py index b9d80b78ba2..62c971561b3 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_post_async_retry_succeeded_request # type: ignore __all__ = [ - "build_put_async_retry_succeeded_request", - "build_put201_creating_succeeded200_request", - "build_post202_retry200_request", - "build_post_async_retry_succeeded_request", + 'build_put_async_retry_succeeded_request', + 'build_put201_creating_succeeded200_request', + 'build_post202_retry200_request', + 'build_post_async_retry_succeeded_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py index 53621dfb644..672b69b8d83 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -55,10 +54,13 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -70,10 +72,13 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -132,10 +137,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -147,10 +155,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -208,10 +219,13 @@ def build_post202_retry200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -270,10 +284,13 @@ def build_post_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -297,3 +314,4 @@ def build_post_async_retry_succeeded_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py index a9d83e9b5c5..ddabeb2111b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py @@ -9,8 +9,7 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -18,7 +17,10 @@ def build_put_async_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an @@ -49,10 +51,13 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -64,32 +69,45 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/putasync/retry/succeeded" + url = '/lro/customheader/putasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put201_creating_succeeded200_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an @@ -120,10 +138,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -135,31 +156,46 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/put/201/creating/succeeded/200" + url = '/lro/customheader/put/201/creating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post202_retry200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -188,32 +224,45 @@ def build_post202_retry200_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/post/202/retry/200" + url = '/lro/customheader/post/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_async_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an @@ -244,25 +293,36 @@ def build_post_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/postasync/retry/succeeded" + url = '/lro/customheader/postasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py index 5adea5a6e47..88beebdfe60 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py @@ -24,11 +24,11 @@ from ._request_builders import build_post_async_relative_retry_succeeded_request # type: ignore __all__ = [ - "build_put201_creating_succeeded200_request", - "build_put_async_relative_retry_succeeded_request", - "build_delete_provisioning202_accepted200_succeeded_request", - "build_delete202_retry200_request", - "build_delete_async_relative_retry_succeeded_request", - "build_post202_retry200_request", - "build_post_async_relative_retry_succeeded_request", + 'build_put201_creating_succeeded200_request', + 'build_put_async_relative_retry_succeeded_request', + 'build_delete_provisioning202_accepted200_succeeded_request', + 'build_delete202_retry200_request', + 'build_delete_async_relative_retry_succeeded_request', + 'build_post202_retry200_request', + 'build_post_async_relative_retry_succeeded_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py index 34f851e8c84..55fd42e4f9d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -54,10 +53,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -69,10 +71,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -130,10 +135,13 @@ def build_put_async_relative_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -145,10 +153,13 @@ def build_put_async_relative_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -200,10 +211,13 @@ def build_delete_provisioning202_accepted200_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -320,10 +334,13 @@ def build_post202_retry200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -381,10 +398,13 @@ def build_post_async_relative_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -408,3 +428,4 @@ def build_post_async_relative_retry_succeeded_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py index 1247369158f..2960a8bd3f1 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py @@ -9,8 +9,7 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -18,7 +17,10 @@ def build_put201_creating_succeeded200_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -48,10 +50,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -63,32 +68,45 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/put/201/creating/succeeded/200" + url = '/lro/retryerror/put/201/creating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_relative_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -118,10 +136,13 @@ def build_put_async_relative_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -133,31 +154,43 @@ def build_put_async_relative_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/putasync/retry/succeeded" + url = '/lro/retryerror/putasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> HttpRequest: +def build_delete_provisioning202_accepted200_succeeded_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -180,10 +213,13 @@ def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -191,16 +227,23 @@ def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> accept = "application/json" # Construct URL - url = "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded" + url = '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete202_retry200_request(**kwargs: Any) -> HttpRequest: +def build_delete202_retry200_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -215,16 +258,23 @@ def build_delete202_retry200_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/retryerror/delete/202/retry/200" + url = '/lro/retryerror/delete/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_relative_retry_succeeded_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_relative_retry_succeeded_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -239,16 +289,26 @@ def build_delete_async_relative_retry_succeeded_request(**kwargs: Any) -> HttpRe accept = "application/json" # Construct URL - url = "/lro/retryerror/deleteasync/retry/succeeded" + url = '/lro/retryerror/deleteasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_retry200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -276,32 +336,45 @@ def build_post202_retry200_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/post/202/retry/200" + url = '/lro/retryerror/post/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_async_relative_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -331,25 +404,36 @@ def build_post_async_relative_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/postasync/retry/succeeded" + url = '/lro/retryerror/postasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py index 28fcc79d717..37d63517ede 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py @@ -98,48 +98,48 @@ from ._request_builders import build_post_async_retrycanceled_request # type: ignore __all__ = [ - "build_put200_succeeded_request", - "build_patch200_succeeded_ignore_headers_request", - "build_patch201_retry_with_async_header_request", - "build_patch202_retry_with_async_and_location_header_request", - "build_put201_succeeded_request", - "build_post202_list_request", - "build_put200_succeeded_no_state_request", - "build_put202_retry200_request", - "build_put201_creating_succeeded200_request", - "build_put200_updating_succeeded204_request", - "build_put201_creating_failed200_request", - "build_put200_acceptedcanceled200_request", - "build_put_no_header_in_retry_request", - "build_put_async_retry_succeeded_request", - "build_put_async_no_retry_succeeded_request", - "build_put_async_retry_failed_request", - "build_put_async_no_retrycanceled_request", - "build_put_async_no_header_in_retry_request", - "build_put_non_resource_request", - "build_put_async_non_resource_request", - "build_put_sub_resource_request", - "build_put_async_sub_resource_request", - "build_delete_provisioning202_accepted200_succeeded_request", - "build_delete_provisioning202_deleting_failed200_request", - "build_delete_provisioning202_deletingcanceled200_request", - "build_delete204_succeeded_request", - "build_delete202_retry200_request", - "build_delete202_no_retry204_request", - "build_delete_no_header_in_retry_request", - "build_delete_async_no_header_in_retry_request", - "build_delete_async_retry_succeeded_request", - "build_delete_async_no_retry_succeeded_request", - "build_delete_async_retry_failed_request", - "build_delete_async_retrycanceled_request", - "build_post200_with_payload_request", - "build_post202_retry200_request", - "build_post202_no_retry204_request", - "build_post_double_headers_final_location_get_request", - "build_post_double_headers_final_azure_header_get_request", - "build_post_double_headers_final_azure_header_get_default_request", - "build_post_async_retry_succeeded_request", - "build_post_async_no_retry_succeeded_request", - "build_post_async_retry_failed_request", - "build_post_async_retrycanceled_request", + 'build_put200_succeeded_request', + 'build_patch200_succeeded_ignore_headers_request', + 'build_patch201_retry_with_async_header_request', + 'build_patch202_retry_with_async_and_location_header_request', + 'build_put201_succeeded_request', + 'build_post202_list_request', + 'build_put200_succeeded_no_state_request', + 'build_put202_retry200_request', + 'build_put201_creating_succeeded200_request', + 'build_put200_updating_succeeded204_request', + 'build_put201_creating_failed200_request', + 'build_put200_acceptedcanceled200_request', + 'build_put_no_header_in_retry_request', + 'build_put_async_retry_succeeded_request', + 'build_put_async_no_retry_succeeded_request', + 'build_put_async_retry_failed_request', + 'build_put_async_no_retrycanceled_request', + 'build_put_async_no_header_in_retry_request', + 'build_put_non_resource_request', + 'build_put_async_non_resource_request', + 'build_put_sub_resource_request', + 'build_put_async_sub_resource_request', + 'build_delete_provisioning202_accepted200_succeeded_request', + 'build_delete_provisioning202_deleting_failed200_request', + 'build_delete_provisioning202_deletingcanceled200_request', + 'build_delete204_succeeded_request', + 'build_delete202_retry200_request', + 'build_delete202_no_retry204_request', + 'build_delete_no_header_in_retry_request', + 'build_delete_async_no_header_in_retry_request', + 'build_delete_async_retry_succeeded_request', + 'build_delete_async_no_retry_succeeded_request', + 'build_delete_async_retry_failed_request', + 'build_delete_async_retrycanceled_request', + 'build_post200_with_payload_request', + 'build_post202_retry200_request', + 'build_post202_no_retry204_request', + 'build_post_double_headers_final_location_get_request', + 'build_post_double_headers_final_azure_header_get_request', + 'build_post_double_headers_final_azure_header_get_default_request', + 'build_post_async_retry_succeeded_request', + 'build_post_async_no_retry_succeeded_request', + 'build_post_async_retry_failed_request', + 'build_post_async_retrycanceled_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py index 6de4d55d0ea..c791141fec3 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -53,10 +52,13 @@ def build_put200_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -68,10 +70,13 @@ def build_put200_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -128,10 +133,13 @@ def build_patch200_succeeded_ignore_headers_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -143,10 +151,13 @@ def build_patch200_succeeded_ignore_headers_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -202,10 +213,13 @@ def build_patch201_retry_with_async_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -217,10 +231,13 @@ def build_patch201_retry_with_async_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -277,10 +294,13 @@ def build_patch202_retry_with_async_and_location_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -292,10 +312,13 @@ def build_patch202_retry_with_async_and_location_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -352,10 +375,13 @@ def build_put201_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -367,10 +393,13 @@ def build_put201_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -422,10 +451,13 @@ def build_post202_list_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -479,10 +511,13 @@ def build_put200_succeeded_no_state_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -494,10 +529,13 @@ def build_put200_succeeded_no_state_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -555,10 +593,13 @@ def build_put202_retry200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -570,10 +611,13 @@ def build_put202_retry200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -631,10 +675,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -646,10 +693,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -707,10 +757,13 @@ def build_put200_updating_succeeded204_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -722,10 +775,13 @@ def build_put200_updating_succeeded204_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -783,10 +839,13 @@ def build_put201_creating_failed200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -798,10 +857,13 @@ def build_put201_creating_failed200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -859,10 +921,13 @@ def build_put200_acceptedcanceled200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -874,10 +939,13 @@ def build_put200_acceptedcanceled200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -934,10 +1002,13 @@ def build_put_no_header_in_retry_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -949,10 +1020,13 @@ def build_put_no_header_in_retry_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1010,10 +1084,13 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1025,10 +1102,13 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1086,10 +1166,13 @@ def build_put_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1101,10 +1184,13 @@ def build_put_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1162,10 +1248,13 @@ def build_put_async_retry_failed_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1177,10 +1266,13 @@ def build_put_async_retry_failed_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1238,10 +1330,13 @@ def build_put_async_no_retrycanceled_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1253,10 +1348,13 @@ def build_put_async_no_retrycanceled_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1314,10 +1412,13 @@ def build_put_async_no_header_in_retry_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1329,10 +1430,13 @@ def build_put_async_no_header_in_retry_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1498,7 +1602,9 @@ def build_put_sub_resource_request( "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } @@ -1507,7 +1613,9 @@ def build_put_sub_resource_request( "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } """ @@ -1560,7 +1668,9 @@ def build_put_async_sub_resource_request( "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } @@ -1569,7 +1679,9 @@ def build_put_async_sub_resource_request( "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } """ @@ -1620,10 +1732,13 @@ def build_delete_provisioning202_accepted200_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1671,10 +1786,13 @@ def build_delete_provisioning202_deleting_failed200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1722,10 +1840,13 @@ def build_delete_provisioning202_deletingcanceled200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1803,10 +1924,13 @@ def build_delete202_retry200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1853,10 +1977,13 @@ def build_delete202_no_retry204_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2142,10 +2269,13 @@ def build_post202_retry200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2202,10 +2332,13 @@ def build_post202_no_retry204_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2217,10 +2350,13 @@ def build_post202_no_retry204_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2272,10 +2408,13 @@ def build_post_double_headers_final_location_get_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2323,10 +2462,13 @@ def build_post_double_headers_final_azure_header_get_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2374,10 +2516,13 @@ def build_post_double_headers_final_azure_header_get_default_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2431,10 +2576,13 @@ def build_post_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2446,10 +2594,13 @@ def build_post_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2507,10 +2658,13 @@ def build_post_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2522,10 +2676,13 @@ def build_post_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2583,10 +2740,13 @@ def build_post_async_retry_failed_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2644,10 +2804,13 @@ def build_post_async_retrycanceled_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2671,3 +2834,4 @@ def build_post_async_retrycanceled_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py index 023831d89cd..3fbc73ef853 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py @@ -9,15 +9,19 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_put200_succeeded_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put200_succeeded_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -45,10 +49,13 @@ def build_put200_succeeded_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -60,32 +67,45 @@ def build_put200_succeeded_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/succeeded" + url = '/lro/put/200/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_patch200_succeeded_ignore_headers_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -114,10 +134,13 @@ def build_patch200_succeeded_ignore_headers_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -129,32 +152,45 @@ def build_patch200_succeeded_ignore_headers_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/patch/200/succeeded/ignoreheaders" + url = '/lro/patch/200/succeeded/ignoreheaders' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_patch201_retry_with_async_header_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running patch request, service returns a 201 to the initial request with async header. @@ -182,10 +218,13 @@ def build_patch201_retry_with_async_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -197,32 +236,45 @@ def build_patch201_retry_with_async_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/patch/201/retry/onlyAsyncHeader" + url = '/lro/patch/201/retry/onlyAsyncHeader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_patch202_retry_with_async_and_location_header_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running patch request, service returns a 202 to the initial request with async and location header. @@ -251,10 +303,13 @@ def build_patch202_retry_with_async_and_location_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -266,31 +321,46 @@ def build_patch202_retry_with_async_and_location_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/patch/202/retry/asyncAndLocationHeader" + url = '/lro/patch/202/retry/asyncAndLocationHeader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put201_succeeded_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put201_succeeded_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -318,10 +388,13 @@ def build_put201_succeeded_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -333,31 +406,43 @@ def build_put201_succeeded_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/201/succeeded" + url = '/lro/put/201/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_post202_list_request(**kwargs: Any) -> HttpRequest: +def build_post202_list_request( + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -380,10 +465,13 @@ def build_post202_list_request(**kwargs: Any) -> HttpRequest: "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -392,17 +480,25 @@ def build_post202_list_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/list" + url = '/lro/list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_put200_succeeded_no_state_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -431,10 +527,13 @@ def build_put200_succeeded_no_state_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -446,31 +545,46 @@ def build_put200_succeeded_no_state_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/succeeded/nostate" + url = '/lro/put/200/succeeded/nostate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put202_retry200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -499,10 +613,13 @@ def build_put202_retry200_request(*, json: JSONType = None, content: Any = None, "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -514,32 +631,45 @@ def build_put202_retry200_request(*, json: JSONType = None, content: Any = None, "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/202/retry/200" + url = '/lro/put/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put201_creating_succeeded200_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a @@ -569,10 +699,13 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -584,32 +717,45 @@ def build_put201_creating_succeeded200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/201/creating/succeeded/200" + url = '/lro/put/201/creating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put200_updating_succeeded204_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a @@ -639,10 +785,13 @@ def build_put200_updating_succeeded204_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -654,32 +803,45 @@ def build_put200_updating_succeeded204_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/updating/succeeded/200" + url = '/lro/put/200/updating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put201_creating_failed200_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a @@ -709,10 +871,13 @@ def build_put201_creating_failed200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -724,32 +889,45 @@ def build_put201_creating_failed200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/201/created/failed/200" + url = '/lro/put/201/created/failed/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put200_acceptedcanceled200_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a @@ -779,10 +957,13 @@ def build_put200_acceptedcanceled200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -794,31 +975,46 @@ def build_put200_acceptedcanceled200_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/accepted/canceled/200" + url = '/lro/put/200/accepted/canceled/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_no_header_in_retry_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_no_header_in_retry_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -846,10 +1042,13 @@ def build_put_no_header_in_retry_request(*, json: JSONType = None, content: Any "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -861,32 +1060,45 @@ def build_put_no_header_in_retry_request(*, json: JSONType = None, content: Any "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/noheader/202/200" + url = '/lro/put/noheader/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -916,10 +1128,13 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -931,32 +1146,45 @@ def build_put_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/retry/succeeded" + url = '/lro/putasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_no_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -986,10 +1214,13 @@ def build_put_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1001,31 +1232,46 @@ def build_put_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/noretry/succeeded" + url = '/lro/putasync/noretry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_async_retry_failed_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_async_retry_failed_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1054,10 +1300,13 @@ def build_put_async_retry_failed_request(*, json: JSONType = None, content: Any "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1069,32 +1318,45 @@ def build_put_async_retry_failed_request(*, json: JSONType = None, content: Any "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/retry/failed" + url = '/lro/putasync/retry/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_no_retrycanceled_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1124,10 +1386,13 @@ def build_put_async_no_retrycanceled_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1139,32 +1404,45 @@ def build_put_async_no_retrycanceled_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/noretry/canceled" + url = '/lro/putasync/noretry/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_no_header_in_retry_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain @@ -1194,10 +1472,13 @@ def build_put_async_no_header_in_retry_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1209,31 +1490,46 @@ def build_put_async_no_header_in_retry_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/noheader/201/200" + url = '/lro/putasync/noheader/201/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_non_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_non_resource_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1266,22 +1562,34 @@ def build_put_non_resource_request(*, json: JSONType = None, content: Any = None } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putnonresource/202/200" + url = '/lro/putnonresource/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_async_non_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_async_non_resource_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1314,22 +1622,34 @@ def build_put_async_non_resource_request(*, json: JSONType = None, content: Any } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putnonresourceasync/202/200" + url = '/lro/putnonresourceasync/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_sub_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_sub_resource_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1354,7 +1674,9 @@ def build_put_sub_resource_request(*, json: JSONType = None, content: Any = None "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } @@ -1363,27 +1685,41 @@ def build_put_sub_resource_request(*, json: JSONType = None, content: Any = None "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putsubresource/202/200" + url = '/lro/putsubresource/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_async_sub_resource_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_async_sub_resource_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1408,7 +1744,9 @@ def build_put_async_sub_resource_request(*, json: JSONType = None, content: Any "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } @@ -1417,27 +1755,38 @@ def build_put_async_sub_resource_request(*, json: JSONType = None, content: Any "id": "str", # Optional. Sub Resource Id. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". } } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putsubresourceasync/202/200" + url = '/lro/putsubresourceasync/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> HttpRequest: +def build_delete_provisioning202_accepted200_succeeded_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -1460,10 +1809,13 @@ def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1471,16 +1823,23 @@ def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> accept = "application/json" # Construct URL - url = "/lro/delete/provisioning/202/accepted/200/succeeded" + url = '/lro/delete/provisioning/202/accepted/200/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_provisioning202_deleting_failed200_request(**kwargs: Any) -> HttpRequest: +def build_delete_provisioning202_deleting_failed200_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -1503,10 +1862,13 @@ def build_delete_provisioning202_deleting_failed200_request(**kwargs: Any) -> Ht "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1514,16 +1876,23 @@ def build_delete_provisioning202_deleting_failed200_request(**kwargs: Any) -> Ht accept = "application/json" # Construct URL - url = "/lro/delete/provisioning/202/deleting/200/failed" + url = '/lro/delete/provisioning/202/deleting/200/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_provisioning202_deletingcanceled200_request(**kwargs: Any) -> HttpRequest: +def build_delete_provisioning202_deletingcanceled200_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -1546,10 +1915,13 @@ def build_delete_provisioning202_deletingcanceled200_request(**kwargs: Any) -> H "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1557,16 +1929,23 @@ def build_delete_provisioning202_deletingcanceled200_request(**kwargs: Any) -> H accept = "application/json" # Construct URL - url = "/lro/delete/provisioning/202/deleting/200/canceled" + url = '/lro/delete/provisioning/202/deleting/200/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete204_succeeded_request(**kwargs: Any) -> HttpRequest: +def build_delete204_succeeded_request( + **kwargs: Any +) -> HttpRequest: """Long running delete succeeds and returns right away. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1580,16 +1959,23 @@ def build_delete204_succeeded_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/204/succeeded" + url = '/lro/delete/204/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete202_retry200_request(**kwargs: Any) -> HttpRequest: +def build_delete202_retry200_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -1611,10 +1997,13 @@ def build_delete202_retry200_request(**kwargs: Any) -> HttpRequest: "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1622,16 +2011,23 @@ def build_delete202_retry200_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/202/retry/200" + url = '/lro/delete/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete202_no_retry204_request(**kwargs: Any) -> HttpRequest: +def build_delete202_no_retry204_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -1653,10 +2049,13 @@ def build_delete202_no_retry204_request(**kwargs: Any) -> HttpRequest: "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1664,16 +2063,23 @@ def build_delete202_no_retry204_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/202/noretry/204" + url = '/lro/delete/202/noretry/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: +def build_delete_no_header_in_retry_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -1688,16 +2094,23 @@ def build_delete_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/noheader" + url = '/lro/delete/noheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_no_header_in_retry_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -1712,16 +2125,23 @@ def build_delete_async_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/noheader/202/204" + url = '/lro/deleteasync/noheader/202/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_retry_succeeded_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_retry_succeeded_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1736,16 +2156,23 @@ def build_delete_async_retry_succeeded_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/retry/succeeded" + url = '/lro/deleteasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_no_retry_succeeded_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_no_retry_succeeded_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1760,16 +2187,23 @@ def build_delete_async_no_retry_succeeded_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/noretry/succeeded" + url = '/lro/deleteasync/noretry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_retry_failed_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_retry_failed_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1784,16 +2218,23 @@ def build_delete_async_retry_failed_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/retry/failed" + url = '/lro/deleteasync/retry/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_retrycanceled_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_retrycanceled_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1808,16 +2249,23 @@ def build_delete_async_retrycanceled_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/retry/canceled" + url = '/lro/deleteasync/retry/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post200_with_payload_request(**kwargs: Any) -> HttpRequest: +def build_post200_with_payload_request( + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -1841,16 +2289,26 @@ def build_post200_with_payload_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/post/payload/200" + url = '/lro/post/payload/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post202_retry200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_retry200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -1878,31 +2336,46 @@ def build_post202_retry200_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/post/202/retry/200" + url = '/lro/post/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post202_no_retry204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post202_no_retry204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -1930,10 +2403,13 @@ def build_post202_no_retry204_request(*, json: JSONType = None, content: Any = N "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1945,31 +2421,43 @@ def build_post202_no_retry204_request(*, json: JSONType = None, content: Any = N "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/post/202/noretry/204" + url = '/lro/post/202/noretry/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_post_double_headers_final_location_get_request(**kwargs: Any) -> HttpRequest: +def build_post_double_headers_final_location_get_request( + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -1992,10 +2480,13 @@ def build_post_double_headers_final_location_get_request(**kwargs: Any) -> HttpR "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2003,16 +2494,23 @@ def build_post_double_headers_final_location_get_request(**kwargs: Any) -> HttpR accept = "application/json" # Construct URL - url = "/lro/LROPostDoubleHeadersFinalLocationGet" + url = '/lro/LROPostDoubleHeadersFinalLocationGet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_double_headers_final_azure_header_get_request(**kwargs: Any) -> HttpRequest: +def build_post_double_headers_final_azure_header_get_request( + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -2035,10 +2533,13 @@ def build_post_double_headers_final_azure_header_get_request(**kwargs: Any) -> H "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2046,16 +2547,23 @@ def build_post_double_headers_final_azure_header_get_request(**kwargs: Any) -> H accept = "application/json" # Construct URL - url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGet" + url = '/lro/LROPostDoubleHeadersFinalAzureHeaderGet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_double_headers_final_azure_header_get_default_request(**kwargs: Any) -> HttpRequest: +def build_post_double_headers_final_azure_header_get_default_request( + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -2078,10 +2586,13 @@ def build_post_double_headers_final_azure_header_get_default_request(**kwargs: A "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2089,17 +2600,25 @@ def build_post_double_headers_final_azure_header_get_default_request(**kwargs: A accept = "application/json" # Construct URL - url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault" + url = '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_post_async_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2129,10 +2648,13 @@ def build_post_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2144,32 +2666,45 @@ def build_post_async_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/retry/succeeded" + url = '/lro/postasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_async_no_retry_succeeded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2199,10 +2734,13 @@ def build_post_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -2214,31 +2752,46 @@ def build_post_async_no_retry_succeeded_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/noretry/succeeded" + url = '/lro/postasync/noretry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post_async_retry_failed_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post_async_retry_failed_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2267,31 +2820,46 @@ def build_post_async_retry_failed_request(*, json: JSONType = None, content: Any "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/retry/failed" + url = '/lro/postasync/retry/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post_async_retrycanceled_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post_async_retrycanceled_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2320,25 +2888,36 @@ def build_post_async_retrycanceled_request(*, json: JSONType = None, content: An "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/retry/canceled" + url = '/lro/postasync/retry/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py index 37765c4463f..ed407904193 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py @@ -62,30 +62,30 @@ from ._request_builders import build_post_async_relative_retry_invalid_json_polling_request # type: ignore __all__ = [ - "build_put_non_retry400_request", - "build_put_non_retry201_creating400_request", - "build_put_non_retry201_creating400_invalid_json_request", - "build_put_async_relative_retry400_request", - "build_delete_non_retry400_request", - "build_delete202_non_retry400_request", - "build_delete_async_relative_retry400_request", - "build_post_non_retry400_request", - "build_post202_non_retry400_request", - "build_post_async_relative_retry400_request", - "build_put_error201_no_provisioning_state_payload_request", - "build_put_async_relative_retry_no_status_request", - "build_put_async_relative_retry_no_status_payload_request", - "build_delete204_succeeded_request", - "build_delete_async_relative_retry_no_status_request", - "build_post202_no_location_request", - "build_post_async_relative_retry_no_payload_request", - "build_put200_invalid_json_request", - "build_put_async_relative_retry_invalid_header_request", - "build_put_async_relative_retry_invalid_json_polling_request", - "build_delete202_retry_invalid_header_request", - "build_delete_async_relative_retry_invalid_header_request", - "build_delete_async_relative_retry_invalid_json_polling_request", - "build_post202_retry_invalid_header_request", - "build_post_async_relative_retry_invalid_header_request", - "build_post_async_relative_retry_invalid_json_polling_request", + 'build_put_non_retry400_request', + 'build_put_non_retry201_creating400_request', + 'build_put_non_retry201_creating400_invalid_json_request', + 'build_put_async_relative_retry400_request', + 'build_delete_non_retry400_request', + 'build_delete202_non_retry400_request', + 'build_delete_async_relative_retry400_request', + 'build_post_non_retry400_request', + 'build_post202_non_retry400_request', + 'build_post_async_relative_retry400_request', + 'build_put_error201_no_provisioning_state_payload_request', + 'build_put_async_relative_retry_no_status_request', + 'build_put_async_relative_retry_no_status_payload_request', + 'build_delete204_succeeded_request', + 'build_delete_async_relative_retry_no_status_request', + 'build_post202_no_location_request', + 'build_post_async_relative_retry_no_payload_request', + 'build_put200_invalid_json_request', + 'build_put_async_relative_retry_invalid_header_request', + 'build_put_async_relative_retry_invalid_json_polling_request', + 'build_delete202_retry_invalid_header_request', + 'build_delete_async_relative_retry_invalid_header_request', + 'build_delete_async_relative_retry_invalid_json_polling_request', + 'build_post202_retry_invalid_header_request', + 'build_post_async_relative_retry_invalid_header_request', + 'build_post_async_relative_retry_invalid_json_polling_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py index b4788b834e1..e374b608f77 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -52,10 +51,13 @@ def build_put_non_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -67,10 +69,13 @@ def build_put_non_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -127,10 +132,13 @@ def build_put_non_retry201_creating400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -142,10 +150,13 @@ def build_put_non_retry201_creating400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -202,10 +213,13 @@ def build_put_non_retry201_creating400_invalid_json_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -217,10 +231,13 @@ def build_put_non_retry201_creating400_invalid_json_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -277,10 +294,13 @@ def build_put_async_relative_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -292,10 +312,13 @@ def build_put_async_relative_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -445,10 +468,13 @@ def build_post_non_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -504,10 +530,13 @@ def build_post202_non_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -564,10 +593,13 @@ def build_post_async_relative_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -623,10 +655,13 @@ def build_put_error201_no_provisioning_state_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -638,10 +673,13 @@ def build_put_error201_no_provisioning_state_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -699,10 +737,13 @@ def build_put_async_relative_retry_no_status_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -714,10 +755,13 @@ def build_put_async_relative_retry_no_status_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -775,10 +819,13 @@ def build_put_async_relative_retry_no_status_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -790,10 +837,13 @@ def build_put_async_relative_retry_no_status_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -913,10 +963,13 @@ def build_post202_no_location_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -974,10 +1027,13 @@ def build_post_async_relative_retry_no_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1034,10 +1090,13 @@ def build_put200_invalid_json_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1049,10 +1108,13 @@ def build_put200_invalid_json_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1110,10 +1172,13 @@ def build_put_async_relative_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1125,10 +1190,13 @@ def build_put_async_relative_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1186,10 +1254,13 @@ def build_put_async_relative_retry_invalid_json_polling_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1201,10 +1272,13 @@ def build_put_async_relative_retry_invalid_json_polling_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1357,10 +1431,13 @@ def build_post202_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1418,10 +1495,13 @@ def build_post_async_relative_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1479,10 +1559,13 @@ def build_post_async_relative_retry_invalid_json_polling_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1506,3 +1589,4 @@ def build_post_async_relative_retry_invalid_json_polling_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py index 155b6f65a78..6cc6b82e767 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py @@ -9,15 +9,19 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_put_non_retry400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_non_retry400_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 400 to the initial request. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -44,10 +48,13 @@ def build_put_non_retry400_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -59,32 +66,45 @@ def build_put_non_retry400_request(*, json: JSONType = None, content: Any = None "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/put/400" + url = '/lro/nonretryerror/put/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_non_retry201_creating400_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -113,10 +133,13 @@ def build_put_non_retry201_creating400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -128,32 +151,45 @@ def build_put_non_retry201_creating400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/put/201/creating/400" + url = '/lro/nonretryerror/put/201/creating/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_non_retry201_creating400_invalid_json_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -182,10 +218,13 @@ def build_put_non_retry201_creating400_invalid_json_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -197,32 +236,45 @@ def build_put_non_retry201_creating400_invalid_json_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/put/201/creating/400/invalidjson" + url = '/lro/nonretryerror/put/201/creating/400/invalidjson' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_relative_retry400_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -251,10 +303,13 @@ def build_put_async_relative_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -266,31 +321,43 @@ def build_put_async_relative_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/putasync/retry/400" + url = '/lro/nonretryerror/putasync/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_delete_non_retry400_request(**kwargs: Any) -> HttpRequest: +def build_delete_non_retry400_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 400 with an error body. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -304,16 +371,23 @@ def build_delete_non_retry400_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/nonretryerror/delete/400" + url = '/lro/nonretryerror/delete/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete202_non_retry400_request(**kwargs: Any) -> HttpRequest: +def build_delete202_non_retry400_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 with a location header. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -327,16 +401,23 @@ def build_delete202_non_retry400_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/nonretryerror/delete/202/retry/400" + url = '/lro/nonretryerror/delete/202/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_relative_retry400_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_relative_retry400_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -351,16 +432,26 @@ def build_delete_async_relative_retry400_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/nonretryerror/deleteasync/retry/400" + url = '/lro/nonretryerror/deleteasync/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_non_retry400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post_non_retry400_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 400 with no error body. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -387,31 +478,46 @@ def build_post_non_retry400_request(*, json: JSONType = None, content: Any = Non "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/post/400" + url = '/lro/nonretryerror/post/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post202_non_retry400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post202_non_retry400_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 with a location header. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -438,32 +544,45 @@ def build_post202_non_retry400_request(*, json: JSONType = None, content: Any = "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/post/202/retry/400" + url = '/lro/nonretryerror/post/202/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_async_relative_retry400_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -492,32 +611,45 @@ def build_post_async_relative_retry400_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/postasync/retry/400" + url = '/lro/nonretryerror/postasync/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_error201_no_provisioning_state_payload_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 201 to the initial request with no payload. @@ -545,10 +677,13 @@ def build_put_error201_no_provisioning_state_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -560,32 +695,45 @@ def build_put_error201_no_provisioning_state_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/put/201/noprovisioningstatepayload" + url = '/lro/error/put/201/noprovisioningstatepayload' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_relative_retry_no_status_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -615,10 +763,13 @@ def build_put_async_relative_retry_no_status_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -630,32 +781,45 @@ def build_put_async_relative_retry_no_status_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/nostatus" + url = '/lro/error/putasync/retry/nostatus' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_relative_retry_no_status_payload_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -685,10 +849,13 @@ def build_put_async_relative_retry_no_status_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -700,31 +867,43 @@ def build_put_async_relative_retry_no_status_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/nostatuspayload" + url = '/lro/error/putasync/retry/nostatuspayload' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_delete204_succeeded_request(**kwargs: Any) -> HttpRequest: +def build_delete204_succeeded_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 204 to the initial request, indicating success. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -738,16 +917,23 @@ def build_delete204_succeeded_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/error/delete/204/nolocation" + url = '/lro/error/delete/204/nolocation' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_relative_retry_no_status_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_relative_retry_no_status_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -762,16 +948,26 @@ def build_delete_async_relative_retry_no_status_request(**kwargs: Any) -> HttpRe accept = "application/json" # Construct URL - url = "/lro/error/deleteasync/retry/nostatus" + url = '/lro/error/deleteasync/retry/nostatus' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post202_no_location_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_post202_no_location_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -799,32 +995,45 @@ def build_post202_no_location_request(*, json: JSONType = None, content: Any = N "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/post/202/nolocation" + url = '/lro/error/post/202/nolocation' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_async_relative_retry_no_payload_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -854,31 +1063,46 @@ def build_post_async_relative_retry_no_payload_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/postasync/retry/nopayload" + url = '/lro/error/postasync/retry/nopayload' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put200_invalid_json_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put200_invalid_json_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -906,10 +1130,13 @@ def build_put200_invalid_json_request(*, json: JSONType = None, content: Any = N "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -921,32 +1148,45 @@ def build_put200_invalid_json_request(*, json: JSONType = None, content: Any = N "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/put/200/invalidjson" + url = '/lro/error/put/200/invalidjson' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_relative_retry_invalid_header_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -976,10 +1216,13 @@ def build_put_async_relative_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -991,32 +1234,45 @@ def build_put_async_relative_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/invalidheader" + url = '/lro/error/putasync/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_async_relative_retry_invalid_json_polling_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1046,10 +1302,13 @@ def build_put_async_relative_retry_invalid_json_polling_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -1061,31 +1320,43 @@ def build_put_async_relative_retry_invalid_json_polling_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/invalidjsonpolling" + url = '/lro/error/putasync/retry/invalidjsonpolling' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_delete202_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: +def build_delete202_retry_invalid_header_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -1100,16 +1371,23 @@ def build_delete202_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/error/delete/202/retry/invalidheader" + url = '/lro/error/delete/202/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_relative_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_relative_retry_invalid_header_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -1124,16 +1402,23 @@ def build_delete_async_relative_retry_invalid_header_request(**kwargs: Any) -> H accept = "application/json" # Construct URL - url = "/lro/error/deleteasync/retry/invalidheader" + url = '/lro/error/deleteasync/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_delete_async_relative_retry_invalid_json_polling_request(**kwargs: Any) -> HttpRequest: +def build_delete_async_relative_retry_invalid_json_polling_request( + **kwargs: Any +) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1148,17 +1433,25 @@ def build_delete_async_relative_retry_invalid_json_polling_request(**kwargs: Any accept = "application/json" # Construct URL - url = "/lro/error/deleteasync/retry/invalidjsonpolling" + url = '/lro/error/deleteasync/retry/invalidjsonpolling' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) def build_post202_retry_invalid_header_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -1187,32 +1480,45 @@ def build_post202_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/post/202/retry/invalidheader" + url = '/lro/error/post/202/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_async_relative_retry_invalid_header_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -1242,32 +1548,45 @@ def build_post_async_relative_retry_invalid_header_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/postasync/retry/invalidheader" + url = '/lro/error/postasync/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_async_relative_retry_invalid_json_polling_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1297,25 +1616,36 @@ def build_post_async_relative_retry_invalid_json_polling_request( "name": "str", # Optional. Resource Name. "properties": { "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str" # Optional. Possible values + include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", + "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/postasync/retry/invalidjsonpolling" + url = '/lro/error/postasync/retry/invalidjsonpolling' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/setup.py index 226e1d293dc..73e7389d758 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Long-running Operation for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/__init__.py index 20185994f95..f347f9b0b0d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["LROWithParamaterizedEndpoints"] +__all__ = ['LROWithParamaterizedEndpoints'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_configuration.py index ff1964c9363..2229138a594 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_configuration.py @@ -14,35 +14,41 @@ from ._version import VERSION -class LROWithParamaterizedEndpointsConfiguration(Configuration): +class LROWithParamaterizedEndpointsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LROWithParamaterizedEndpoints. Note that all parameters used to create this instance are saved as instance attributes. - :param host: A string value that is used as a global part of the parameterized host. Pass in 'host:3000' to pass test. + :param host: A string value that is used as a global part of the parameterized host. Pass in + 'host:3000' to pass test. :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(LROWithParamaterizedEndpointsConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "lrowithparamaterizedendpoints/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'lrowithparamaterizedendpoints/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_lro_with_paramaterized_endpoints.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_lro_with_paramaterized_endpoints.py index b95f59bd263..88f17787974 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_lro_with_paramaterized_endpoints.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_lro_with_paramaterized_endpoints.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LROWithParamaterizedEndpoints: """Test Infrastructure for AutoRest. @@ -28,8 +27,12 @@ class LROWithParamaterizedEndpoints: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = LROWithParamaterizedEndpointsConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -37,6 +40,7 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest @@ -64,7 +68,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_vendor.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_vendor.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/__init__.py index c083144aca2..53484dfaccb 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._lro_with_paramaterized_endpoints import LROWithParamaterizedEndpoints - -__all__ = ["LROWithParamaterizedEndpoints"] +__all__ = ['LROWithParamaterizedEndpoints'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_configuration.py index 1b2efaf32f1..1aeee6aaf3d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_configuration.py @@ -14,32 +14,40 @@ from .._version import VERSION -class LROWithParamaterizedEndpointsConfiguration(Configuration): +class LROWithParamaterizedEndpointsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LROWithParamaterizedEndpoints. Note that all parameters used to create this instance are saved as instance attributes. - :param host: A string value that is used as a global part of the parameterized host. Pass in 'host:3000' to pass test. + :param host: A string value that is used as a global part of the parameterized host. Pass in + 'host:3000' to pass test. :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(LROWithParamaterizedEndpointsConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "lrowithparamaterizedendpoints/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'lrowithparamaterizedendpoints/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_lro_with_paramaterized_endpoints.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_lro_with_paramaterized_endpoints.py index bbc79062424..53e152f4c2c 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_lro_with_paramaterized_endpoints.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/aio/_lro_with_paramaterized_endpoints.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LROWithParamaterizedEndpoints: """Test Infrastructure for AutoRest. @@ -28,8 +27,12 @@ class LROWithParamaterizedEndpoints: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = LROWithParamaterizedEndpointsConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `lrowithparameterizedendpointslowlevel.rest`. @@ -60,7 +68,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py index 6819157cc98..7fd5968d9ec 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_poll_with_constant_parameterized_endpoints_request # type: ignore __all__ = [ - "build_poll_with_parameterized_endpoints_request", - "build_poll_with_constant_parameterized_endpoints_request", + 'build_poll_with_parameterized_endpoints_request', + 'build_poll_with_constant_parameterized_endpoints_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py index f9a9bd950ab..e903839a833 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py @@ -91,3 +91,4 @@ def build_poll_with_constant_parameterized_endpoints_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py index 10bd5b5e4a6..3cd9e0c6264 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py @@ -16,7 +16,9 @@ _SERIALIZER.client_side_validation = False -def build_poll_with_parameterized_endpoints_request(**kwargs: Any) -> HttpRequest: +def build_poll_with_parameterized_endpoints_request( + **kwargs: Any +) -> HttpRequest: """Poll with method and client level parameters in endpoint. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -30,16 +32,23 @@ def build_poll_with_parameterized_endpoints_request(**kwargs: Any) -> HttpReques accept = "application/json" # Construct URL - url = "/lroParameterizedEndpoints" + url = '/lroParameterizedEndpoints' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_poll_with_constant_parameterized_endpoints_request(**kwargs: Any) -> HttpRequest: +def build_poll_with_constant_parameterized_endpoints_request( + **kwargs: Any +) -> HttpRequest: """Poll with method and client level parameters in endpoint, with a constant value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -54,19 +63,25 @@ def build_poll_with_constant_parameterized_endpoints_request(**kwargs: Any) -> H :rtype: ~azure.core.rest.HttpRequest """ - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str accept = "application/json" # Construct URL - url = "/lroConstantParameterizedEndpoints/{constantParameter}" + url = '/lroConstantParameterizedEndpoints/{constantParameter}' path_format_arguments = { - "constantParameter": _SERIALIZER.url("constant_parameter", constant_parameter, "str", skip_quote=True), + "constantParameter": _SERIALIZER.url("constant_parameter", constant_parameter, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/setup.py index c0c7a324c37..17f17459445 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/__init__.py index e8e67b959c7..f0189aa1367 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_auto_rest_paging_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_auto_rest_paging_test_service.py index 1a7cc6c5401..2a5d253a821 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_auto_rest_paging_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_auto_rest_paging_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestPagingTestService: """Long-running Operation for AutoRest. @@ -27,8 +26,13 @@ class AutoRestPagingTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestPagingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_configuration.py index cde18ff9969..f44985e74ca 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestPagingTestServiceConfiguration(Configuration): +class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestPagingTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestpagingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestpagingtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_vendor.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_vendor.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/__init__.py index deb5dd54332..f9327b479e8 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_paging_test_service import AutoRestPagingTestService - -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_auto_rest_paging_test_service.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_auto_rest_paging_test_service.py index 44a7b97e919..b96e764e2e0 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_auto_rest_paging_test_service.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_auto_rest_paging_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestPagingTestService: """Long-running Operation for AutoRest. @@ -27,7 +26,12 @@ class AutoRestPagingTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestPagingTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `paginglowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_configuration.py index e39ce7a3614..5b32ba327e5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestPagingTestServiceConfiguration(Configuration): +class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestPagingTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestpagingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestpagingtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py index 94cb2afe469..fe9d52576b3 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py @@ -50,24 +50,24 @@ from ._request_builders import build_get_paging_model_with_item_name_with_xms_client_name_request # type: ignore __all__ = [ - "build_get_no_item_name_pages_request", - "build_get_null_next_link_name_pages_request", - "build_get_single_pages_request", - "build_first_response_empty_request", - "build_get_multiple_pages_request", - "build_get_with_query_params_request", - "build_next_operation_with_query_params_request", - "build_get_odata_multiple_pages_request", - "build_get_multiple_pages_with_offset_request", - "build_get_multiple_pages_retry_first_request", - "build_get_multiple_pages_retry_second_request", - "build_get_single_pages_failure_request", - "build_get_multiple_pages_failure_request", - "build_get_multiple_pages_failure_uri_request", - "build_get_multiple_pages_fragment_next_link_request", - "build_get_multiple_pages_fragment_with_grouping_next_link_request", - "build_get_multiple_pages_lro_request", - "build_next_fragment_request", - "build_next_fragment_with_grouping_request", - "build_get_paging_model_with_item_name_with_xms_client_name_request", + 'build_get_no_item_name_pages_request', + 'build_get_null_next_link_name_pages_request', + 'build_get_single_pages_request', + 'build_first_response_empty_request', + 'build_get_multiple_pages_request', + 'build_get_with_query_params_request', + 'build_next_operation_with_query_params_request', + 'build_get_odata_multiple_pages_request', + 'build_get_multiple_pages_with_offset_request', + 'build_get_multiple_pages_retry_first_request', + 'build_get_multiple_pages_retry_second_request', + 'build_get_single_pages_failure_request', + 'build_get_multiple_pages_failure_request', + 'build_get_multiple_pages_failure_uri_request', + 'build_get_multiple_pages_fragment_next_link_request', + 'build_get_multiple_pages_fragment_with_grouping_next_link_request', + 'build_get_multiple_pages_lro_request', + 'build_next_fragment_request', + 'build_next_fragment_with_grouping_request', + 'build_get_paging_model_with_item_name_with_xms_client_name_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py index 4281a4148d8..1c2d038775e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py @@ -1142,3 +1142,4 @@ def build_get_paging_model_with_item_name_with_xms_client_name_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py index 4a3a1d2ea05..d27addf959d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py @@ -16,7 +16,9 @@ _SERIALIZER.client_side_validation = False -def build_get_no_item_name_pages_request(**kwargs: Any) -> HttpRequest: +def build_get_no_item_name_pages_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that must return result of the default 'value' node. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -46,16 +48,23 @@ def build_get_no_item_name_pages_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/noitemname" + url = '/paging/noitemname' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_null_next_link_name_pages_request(**kwargs: Any) -> HttpRequest: +def build_get_null_next_link_name_pages_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that must ignore any kind of nextLink, and stop after page 1. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -85,16 +94,23 @@ def build_get_null_next_link_name_pages_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/nullnextlink" + url = '/paging/nullnextlink' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_single_pages_request(**kwargs: Any) -> HttpRequest: +def build_get_single_pages_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that finishes on the first call without a nextlink. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -124,16 +140,23 @@ def build_get_single_pages_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/single" + url = '/paging/single' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_first_response_empty_request(**kwargs: Any) -> HttpRequest: +def build_first_response_empty_request( + **kwargs: Any +) -> HttpRequest: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. @@ -164,13 +187,18 @@ def build_first_response_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/firstResponseEmpty/1" + url = '/paging/firstResponseEmpty/1' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_get_multiple_pages_request( @@ -216,22 +244,31 @@ def build_get_multiple_pages_request( accept = "application/json" # Construct URL - url = "/paging/multiple" + url = '/paging/multiple' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_with_query_params_request(*, required_query_parameter: int, **kwargs: Any) -> HttpRequest: +def build_get_with_query_params_request( + *, + required_query_parameter: int, + **kwargs: Any +) -> HttpRequest: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -267,27 +304,33 @@ def build_get_with_query_params_request(*, required_query_parameter: int, **kwar } """ - query_constant = kwargs.pop("query_constant", True) # type: bool + query_constant = kwargs.pop('query_constant', True) # type: bool accept = "application/json" # Construct URL - url = "/paging/multiple/getWithQueryParams" + url = '/paging/multiple/getWithQueryParams' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["requiredQueryParameter"] = _SERIALIZER.query( - "required_query_parameter", required_query_parameter, "int" - ) - query_parameters["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") + query_parameters['requiredQueryParameter'] = _SERIALIZER.query("required_query_parameter", required_query_parameter, 'int') + query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_next_operation_with_query_params_request(**kwargs: Any) -> HttpRequest: +def build_next_operation_with_query_params_request( + **kwargs: Any +) -> HttpRequest: """Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -318,21 +361,27 @@ def build_next_operation_with_query_params_request(**kwargs: Any) -> HttpRequest } """ - query_constant = kwargs.pop("query_constant", True) # type: bool + query_constant = kwargs.pop('query_constant', True) # type: bool accept = "application/json" # Construct URL - url = "/paging/multiple/nextOperationWithQueryParams" + url = '/paging/multiple/nextOperationWithQueryParams' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") + query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_get_odata_multiple_pages_request( @@ -378,19 +427,24 @@ def build_get_odata_multiple_pages_request( accept = "application/json" # Construct URL - url = "/paging/multiple/odata" + url = '/paging/multiple/odata' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_get_multiple_pages_with_offset_request( @@ -439,9 +493,9 @@ def build_get_multiple_pages_with_offset_request( accept = "application/json" # Construct URL - url = "/paging/multiple/withpath/{offset}" + url = '/paging/multiple/withpath/{offset}' path_format_arguments = { - "offset": _SERIALIZER.url("offset", offset, "int"), + "offset": _SERIALIZER.url("offset", offset, 'int'), } url = _format_url_section(url, **path_format_arguments) @@ -449,17 +503,24 @@ def build_get_multiple_pages_with_offset_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_multiple_pages_retry_first_request(**kwargs: Any) -> HttpRequest: +def build_get_multiple_pages_retry_first_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. @@ -490,16 +551,23 @@ def build_get_multiple_pages_retry_first_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/retryfirst" + url = '/paging/multiple/retryfirst' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_multiple_pages_retry_second_request(**kwargs: Any) -> HttpRequest: +def build_get_multiple_pages_retry_second_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. @@ -530,16 +598,23 @@ def build_get_multiple_pages_retry_second_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/retrysecond" + url = '/paging/multiple/retrysecond' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_single_pages_failure_request(**kwargs: Any) -> HttpRequest: +def build_get_single_pages_failure_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that receives a 400 on the first call. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -569,16 +644,23 @@ def build_get_single_pages_failure_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/single/failure" + url = '/paging/single/failure' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_multiple_pages_failure_request(**kwargs: Any) -> HttpRequest: +def build_get_multiple_pages_failure_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that receives a 400 on the second call. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -608,16 +690,23 @@ def build_get_multiple_pages_failure_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/failure" + url = '/paging/multiple/failure' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_multiple_pages_failure_uri_request(**kwargs: Any) -> HttpRequest: +def build_get_multiple_pages_failure_uri_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that receives an invalid nextLink. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -647,16 +736,26 @@ def build_get_multiple_pages_failure_uri_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/failureuri" + url = '/paging/multiple/failureuri' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_multiple_pages_fragment_next_link_request(tenant: str, *, api_version: str, **kwargs: Any) -> HttpRequest: +def build_get_multiple_pages_fragment_next_link_request( + tenant: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -690,26 +789,35 @@ def build_get_multiple_pages_fragment_next_link_request(tenant: str, *, api_vers accept = "application/json" # Construct URL - url = "/paging/multiple/fragment/{tenant}" + url = '/paging/multiple/fragment/{tenant}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_get_multiple_pages_fragment_with_grouping_next_link_request( - tenant: str, *, api_version: str, **kwargs: Any + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. @@ -744,22 +852,28 @@ def build_get_multiple_pages_fragment_with_grouping_next_link_request( accept = "application/json" # Construct URL - url = "/paging/multiple/fragmentwithgrouping/{tenant}" + url = '/paging/multiple/fragmentwithgrouping/{tenant}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_get_multiple_pages_lro_request( @@ -805,22 +919,33 @@ def build_get_multiple_pages_lro_request( accept = "application/json" # Construct URL - url = "/paging/multiple/lro" + url = '/paging/multiple/lro' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_next_fragment_request(tenant: str, next_link: str, *, api_version: str, **kwargs: Any) -> HttpRequest: +def build_next_fragment_request( + tenant: str, + next_link: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -856,27 +981,37 @@ def build_next_fragment_request(tenant: str, next_link: str, *, api_version: str accept = "application/json" # Construct URL - url = "/paging/multiple/fragment/{tenant}/{nextLink}" + url = '/paging/multiple/fragment/{tenant}/{nextLink}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_next_fragment_with_grouping_request( - tenant: str, next_link: str, *, api_version: str, **kwargs: Any + tenant: str, + next_link: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment. @@ -913,26 +1048,34 @@ def build_next_fragment_with_grouping_request( accept = "application/json" # Construct URL - url = "/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}" + url = '/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_paging_model_with_item_name_with_xms_client_name_request(**kwargs: Any) -> HttpRequest: +def build_get_paging_model_with_item_name_with_xms_client_name_request( + **kwargs: Any +) -> HttpRequest: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. @@ -963,10 +1106,16 @@ def build_get_paging_model_with_item_name_with_xms_client_name_request(**kwargs: accept = "application/json" # Construct URL - url = "/paging/itemNameWithXMSClientName" + url = '/paging/itemNameWithXMSClientName' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/setup.py index 3e9c4b351e5..6bdb38f58a7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Long-running Operation for AutoRest. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/setup.py index a553c7263e5..7b497d82d97 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ StorageManagementClient. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/__init__.py index 46519cbf943..1072dc10316 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["StorageManagementClient"] +__all__ = ['StorageManagementClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_configuration.py index 4edc7f6989a..affc0760c24 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_configuration.py @@ -19,23 +19,30 @@ from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration(Configuration): +class StorageManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(StorageManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -45,24 +52,23 @@ def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "storagemanagementclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'storagemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_storage_management_client.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_storage_management_client.py index c55d2cdefd8..41867a89f97 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_storage_management_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_storage_management_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials import TokenCredential - class StorageManagementClient: """StorageManagementClient. @@ -45,16 +44,15 @@ def __init__( endpoint: str = "https://management.azure.com", **kwargs: Any ) -> None: - - self._config = StorageManagementClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + + self._config = StorageManagementClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_vendor.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_vendor.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/__init__.py index bba070179f2..3b85e3279ea 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._storage_management_client import StorageManagementClient - -__all__ = ["StorageManagementClient"] +__all__ = ['StorageManagementClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_configuration.py index a567555bf98..f65df3561c1 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_configuration.py @@ -19,23 +19,30 @@ from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration(Configuration): +class StorageManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance attributes. - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2015-05-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(StorageManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -45,21 +52,22 @@ def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **k self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "storagemanagementclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'storagemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_storage_management_client.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_storage_management_client.py index 2ea5786f6c6..67da9d8f4ba 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_storage_management_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/aio/_storage_management_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class StorageManagementClient: """StorageManagementClient. @@ -45,16 +44,19 @@ def __init__( endpoint: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = StorageManagementClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + self._config = StorageManagementClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `storagelowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py index 553b7460908..7739f3d529e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py @@ -28,13 +28,13 @@ from ._request_builders import build_regenerate_key_request # type: ignore __all__ = [ - "build_check_name_availability_request", - "build_create_request", - "build_delete_request", - "build_get_properties_request", - "build_update_request", - "build_list_keys_request", - "build_list_request", - "build_list_by_resource_group_request", - "build_regenerate_key_request", + 'build_check_name_availability_request', + 'build_create_request', + 'build_delete_request', + 'build_get_properties_request', + 'build_update_request', + 'build_list_keys_request', + 'build_list_request', + 'build_list_by_resource_group_request', + 'build_regenerate_key_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py index eb89788aa7b..c406b6bea79 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py @@ -15,8 +15,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -57,15 +56,21 @@ def build_check_name_availability_request( # JSON input template you can fill out and use as your body input. json = { - "name": "str", # Required. - "type": "Microsoft.Storage/storageAccounts" # Optional. Default value is "Microsoft.Storage/storageAccounts". + "name": "str", # Required. + "type": "Microsoft.Storage/storageAccounts" # Optional. Default value is + "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200 response.json() == { - "message": "str", # Optional. Gets an error message explaining the Reason value in more detail. - "nameAvailable": bool, # Optional. Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. - "reason": "str" # Optional. Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", "AlreadyExists". + "message": "str", # Optional. Gets an error message explaining the Reason + value in more detail. + "nameAvailable": bool, # Optional. Gets a boolean value that indicates + whether the name is available for you to use. If true, the name is available. If + false, the name has already been taken or invalid and cannot be used. + "reason": "str" # Optional. Gets the reason that a storage account name + could not be used. The Reason element is only returned if NameAvailable is false. + Possible values include: "AccountNameInvalid", "AlreadyExists". } """ @@ -144,7 +149,9 @@ def build_create_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str" # Optional. Gets or sets the account type. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "accountType": "str" # Optional. Gets or sets the account type. + Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", + "Standard_RAGRS", "Premium_LRS". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -158,13 +165,23 @@ def build_create_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of the storage + account. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation + date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the + timestamp of the most recent instance of a failover to the secondary + location. Only the most recent timestamp is retained. This element is not + returned if there has never been a failover instance. Only available if the + accountType is StandardGRS or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -176,8 +193,11 @@ def build_create_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the location of the + primary for the storage account. + "provisioningState": "str", # Optional. Gets the status of the + storage account at the time the operation was called. Possible values + include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -189,9 +209,16 @@ def build_create_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the location of the geo + replicated secondary for the storage account. Only available if the + accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the status indicating + whether the primary location of the storage account is available or + unavailable. Possible values include: "Available", "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the status indicating + whether the secondary location of the storage account is available or + unavailable. Only available if the accountType is StandardGRS or + StandardRAGRS. Possible values include: "Available", "Unavailable". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -205,7 +232,7 @@ def build_create_request( accept = "application/json, text/json" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -263,7 +290,7 @@ def build_delete_request( api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -321,13 +348,23 @@ def build_get_properties_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of the storage + account. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation + date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the + timestamp of the most recent instance of a failover to the secondary + location. Only the most recent timestamp is retained. This element is not + returned if there has never been a failover instance. Only available if the + accountType is StandardGRS or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -339,8 +376,11 @@ def build_get_properties_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the location of the + primary for the storage account. + "provisioningState": "str", # Optional. Gets the status of the + storage account at the time the operation was called. Possible values + include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -352,9 +392,16 @@ def build_get_properties_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the location of the geo + replicated secondary for the storage account. Only available if the + accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the status indicating + whether the primary location of the storage account is available or + unavailable. Possible values include: "Available", "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the status indicating + whether the secondary location of the storage account is available or + unavailable. Only available if the accountType is StandardGRS or + StandardRAGRS. Possible values include: "Available", "Unavailable". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -367,7 +414,7 @@ def build_get_properties_request( accept = "application/json, text/json" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -442,10 +489,17 @@ def build_update_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets or sets the account type. Note that StandardZRS and PremiumLRS accounts cannot be changed to other account types, and other account types cannot be changed to StandardZRS or PremiumLRS. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "accountType": "str", # Optional. Gets or sets the account type. + Note that StandardZRS and PremiumLRS accounts cannot be changed to other + account types, and other account types cannot be changed to StandardZRS or + PremiumLRS. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. } }, "tags": { @@ -460,13 +514,23 @@ def build_update_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of the storage + account. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation + date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the + timestamp of the most recent instance of a failover to the secondary + location. Only the most recent timestamp is retained. This element is not + returned if there has never been a failover instance. Only available if the + accountType is StandardGRS or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -478,8 +542,11 @@ def build_update_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the location of the + primary for the storage account. + "provisioningState": "str", # Optional. Gets the status of the + storage account at the time the operation was called. Possible values + include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -491,9 +558,16 @@ def build_update_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the location of the geo + replicated secondary for the storage account. Only available if the + accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the status indicating + whether the primary location of the storage account is available or + unavailable. Possible values include: "Available", "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the status indicating + whether the secondary location of the storage account is available or + unavailable. Only available if the accountType is StandardGRS or + StandardRAGRS. Possible values include: "Available", "Unavailable". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -507,7 +581,7 @@ def build_update_request( accept = "application/json, text/json" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -573,7 +647,7 @@ def build_list_keys_request( accept = "application/json, text/json" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys' # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -623,50 +697,81 @@ def build_list_request( # response body for status code(s): 200 response.json() == { - "nextLink": "str", # Optional. Gets the link to the next set of results. Currently this will always be empty as the API does not support pagination. + "nextLink": "str", # Optional. Gets the link to the next set of results. + Currently this will always be empty as the API does not support pagination. "value": [ { "id": "str", # Optional. Resource Id. "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of + the storage account. Possible values include: "Standard_LRS", + "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. + Gets the creation date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the + custom domain name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates + whether indirect CName validation is enabled. Default value is + false. This should only be set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # + Optional. Gets the timestamp of the most recent instance of a + failover to the secondary location. Only the most recent timestamp is + retained. This element is not returned if there has never been a + failover instance. Only available if the accountType is StandardGRS + or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the + location of the primary for the storage account. + "provisioningState": "str", # Optional. Gets the + status of the storage account at the time the operation was called. + Possible values include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the + location of the geo replicated secondary for the storage account. + Only available if the accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the + status indicating whether the primary location of the storage account + is available or unavailable. Possible values include: "Available", + "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the + status indicating whether the secondary location of the storage + account is available or unavailable. Only available if the + accountType is StandardGRS or StandardRAGRS. Possible values include: + "Available", "Unavailable". }, "tags": { - "str": "str" # Optional. A set of tags. Resource tags. + "str": "str" # Optional. A set of tags. Resource + tags. }, "type": "str" # Optional. Resource type. } @@ -729,50 +834,81 @@ def build_list_by_resource_group_request( # response body for status code(s): 200 response.json() == { - "nextLink": "str", # Optional. Gets the link to the next set of results. Currently this will always be empty as the API does not support pagination. + "nextLink": "str", # Optional. Gets the link to the next set of results. + Currently this will always be empty as the API does not support pagination. "value": [ { "id": "str", # Optional. Resource Id. "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of + the storage account. Possible values include: "Standard_LRS", + "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. + Gets the creation date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the + custom domain name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates + whether indirect CName validation is enabled. Default value is + false. This should only be set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # + Optional. Gets the timestamp of the most recent instance of a + failover to the secondary location. Only the most recent timestamp is + retained. This element is not returned if there has never been a + failover instance. Only available if the accountType is StandardGRS + or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the + location of the primary for the storage account. + "provisioningState": "str", # Optional. Gets the + status of the storage account at the time the operation was called. + Possible values include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the + location of the geo replicated secondary for the storage account. + Only available if the accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the + status indicating whether the primary location of the storage account + is available or unavailable. Possible values include: "Available", + "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the + status indicating whether the secondary location of the storage + account is available or unavailable. Only available if the + accountType is StandardGRS or StandardRAGRS. Possible values include: + "Available", "Unavailable". }, "tags": { - "str": "str" # Optional. A set of tags. Resource tags. + "str": "str" # Optional. A set of tags. Resource + tags. }, "type": "str" # Optional. Resource type. } @@ -861,7 +997,7 @@ def build_regenerate_key_request( accept = "application/json, text/json" # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey' # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "accountName": _SERIALIZER.url("account_name", account_name, 'str'), @@ -887,3 +1023,4 @@ def build_regenerate_key_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py index bca43bd8716..00955b5c68e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py @@ -11,8 +11,7 @@ from msrest import Serializer from ..._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -20,7 +19,11 @@ def build_check_name_availability_request( - subscription_id: str, *, json: JSONType = None, content: Any = None, **kwargs: Any + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Checks that account name is valid and is not in use. @@ -51,41 +54,53 @@ def build_check_name_availability_request( # JSON input template you can fill out and use as your body input. json = { "name": "str", # Required. - "type": "Microsoft.Storage/storageAccounts" # Optional. Default value is "Microsoft.Storage/storageAccounts". + "type": "Microsoft.Storage/storageAccounts" # Optional. Default value is + "Microsoft.Storage/storageAccounts". } # response body for status code(s): 200 response.json() == { - "message": "str", # Optional. Gets an error message explaining the Reason value in more detail. - "nameAvailable": bool, # Optional. Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. - "reason": "str" # Optional. Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: "AccountNameInvalid", "AlreadyExists". + "message": "str", # Optional. Gets an error message explaining the Reason + value in more detail. + "nameAvailable": bool, # Optional. Gets a boolean value that indicates + whether the name is available for you to use. If true, the name is available. If + false, the name has already been taken or invalid and cannot be used. + "reason": "str" # Optional. Gets the reason that a storage account name + could not be used. The Reason element is only returned if NameAvailable is false. + Possible values include: "AccountNameInvalid", "AlreadyExists". } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability" + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) @@ -135,7 +150,9 @@ def build_create_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str" # Optional. Gets or sets the account type. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "accountType": "str" # Optional. Gets or sets the account type. + Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", + "Standard_RAGRS", "Premium_LRS". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -149,13 +166,23 @@ def build_create_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of the storage + account. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation + date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the + timestamp of the most recent instance of a failover to the secondary + location. Only the most recent timestamp is retained. This element is not + returned if there has never been a failover instance. Only available if the + accountType is StandardGRS or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -167,8 +194,11 @@ def build_create_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the location of the + primary for the storage account. + "provisioningState": "str", # Optional. Gets the status of the + storage account at the time the operation was called. Possible values + include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -180,9 +210,16 @@ def build_create_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the location of the geo + replicated secondary for the storage account. Only available if the + accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the status indicating + whether the primary location of the storage account is available or + unavailable. Possible values include: "Available", "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the status indicating + whether the secondary location of the storage account is available or + unavailable. Only available if the accountType is StandardGRS or + StandardRAGRS. Possible values include: "Available", "Unavailable". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -191,37 +228,46 @@ def build_create_request( } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) def build_delete_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: """Deletes a storage account in Microsoft Azure. @@ -243,27 +289,35 @@ def build_delete_request( :rtype: ~azure.core.rest.HttpRequest """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - return HttpRequest(method="DELETE", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) def build_get_properties_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: """Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve @@ -295,13 +349,23 @@ def build_get_properties_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of the storage + account. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation + date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the + timestamp of the most recent instance of a failover to the secondary + location. Only the most recent timestamp is retained. This element is not + returned if there has never been a failover instance. Only available if the + accountType is StandardGRS or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -313,8 +377,11 @@ def build_get_properties_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the location of the + primary for the storage account. + "provisioningState": "str", # Optional. Gets the status of the + storage account at the time the operation was called. Possible values + include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -326,9 +393,16 @@ def build_get_properties_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the location of the geo + replicated secondary for the storage account. Only available if the + accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the status indicating + whether the primary location of the storage account is available or + unavailable. Possible values include: "Available", "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the status indicating + whether the secondary location of the storage account is available or + unavailable. Only available if the accountType is StandardGRS or + StandardRAGRS. Possible values include: "Available", "Unavailable". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -337,28 +411,34 @@ def build_get_properties_request( } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_update_request( @@ -412,10 +492,17 @@ def build_update_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets or sets the account type. Note that StandardZRS and PremiumLRS accounts cannot be changed to other account types, and other account types cannot be changed to StandardZRS or PremiumLRS. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "accountType": "str", # Optional. Gets or sets the account type. + Note that StandardZRS and PremiumLRS accounts cannot be changed to other + account types, and other account types cannot be changed to StandardZRS or + PremiumLRS. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. } }, "tags": { @@ -430,13 +517,23 @@ def build_update_request( "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of the storage + account. Possible values include: "Standard_LRS", "Standard_ZRS", + "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation + date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the custom domain + name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates whether indirect + CName validation is enabled. Default value is false. This should only be + set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the + timestamp of the most recent instance of a failover to the secondary + location. Only the most recent timestamp is retained. This element is not + returned if there has never been a failover instance. Only available if the + accountType is StandardGRS or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -448,8 +545,11 @@ def build_update_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the location of the + primary for the storage account. + "provisioningState": "str", # Optional. Gets the status of the + storage account at the time the operation was called. Possible values + include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { @@ -461,9 +561,16 @@ def build_update_request( "queue": "str", # Optional. Gets the queue endpoint. "table": "str" # Optional. Gets the table endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the location of the geo + replicated secondary for the storage account. Only available if the + accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the status indicating + whether the primary location of the storage account is available or + unavailable. Possible values include: "Available", "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the status indicating + whether the secondary location of the storage account is available or + unavailable. Only available if the accountType is StandardGRS or + StandardRAGRS. Possible values include: "Available", "Unavailable". }, "tags": { "str": "str" # Optional. A set of tags. Resource tags. @@ -472,29 +579,29 @@ def build_update_request( } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", @@ -508,7 +615,10 @@ def build_update_request( def build_list_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: """Lists the access keys for the specified storage account. @@ -537,31 +647,40 @@ def build_list_keys_request( } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys" + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -581,50 +700,81 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "nextLink": "str", # Optional. Gets the link to the next set of results. Currently this will always be empty as the API does not support pagination. + "nextLink": "str", # Optional. Gets the link to the next set of results. + Currently this will always be empty as the API does not support pagination. "value": [ { "id": "str", # Optional. Resource Id. "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of + the storage account. Possible values include: "Standard_LRS", + "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. + Gets the creation date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the + custom domain name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates + whether indirect CName validation is enabled. Default value is + false. This should only be set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # + Optional. Gets the timestamp of the most recent instance of a + failover to the secondary location. Only the most recent timestamp is + retained. This element is not returned if there has never been a + failover instance. Only available if the accountType is StandardGRS + or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the + location of the primary for the storage account. + "provisioningState": "str", # Optional. Gets the + status of the storage account at the time the operation was called. + Possible values include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the + location of the geo replicated secondary for the storage account. + Only available if the accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the + status indicating whether the primary location of the storage account + is available or unavailable. Possible values include: "Available", + "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the + status indicating whether the secondary location of the storage + account is available or unavailable. Only available if the + accountType is StandardGRS or StandardRAGRS. Possible values include: + "Available", "Unavailable". }, "tags": { - "str": "str" # Optional. A set of tags. Resource tags. + "str": "str" # Optional. A set of tags. Resource + tags. }, "type": "str" # Optional. Resource type. } @@ -632,29 +782,39 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts" + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -676,50 +836,81 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ # response body for status code(s): 200 response.json() == { - "nextLink": "str", # Optional. Gets the link to the next set of results. Currently this will always be empty as the API does not support pagination. + "nextLink": "str", # Optional. Gets the link to the next set of results. + Currently this will always be empty as the API does not support pagination. "value": [ { "id": "str", # Optional. Resource Id. "location": "str", # Required. Resource location. "name": "str", # Optional. Resource name. "properties": { - "accountType": "str", # Optional. Gets the type of the storage account. Possible values include: "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". - "creationTime": "2020-02-20 00:00:00", # Optional. Gets the creation date and time of the storage account in UTC. + "accountType": "str", # Optional. Gets the type of + the storage account. Possible values include: "Standard_LRS", + "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS". + "creationTime": "2020-02-20 00:00:00", # Optional. + Gets the creation date and time of the storage account in UTC. "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + "name": "str", # Optional. Gets or sets the + custom domain name. Name is the CNAME source. + "useSubDomain": bool # Optional. Indicates + whether indirect CName validation is enabled. Default value is + false. This should only be set on updates. }, - "lastGeoFailoverTime": "2020-02-20 00:00:00", # Optional. Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is StandardGRS or StandardRAGRS. + "lastGeoFailoverTime": "2020-02-20 00:00:00", # + Optional. Gets the timestamp of the most recent instance of a + failover to the secondary location. Only the most recent timestamp is + retained. This element is not returned if there has never been a + failover instance. Only available if the accountType is StandardGRS + or StandardRAGRS. "primaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "primaryLocation": "str", # Optional. Gets the location of the primary for the storage account. - "provisioningState": "str", # Optional. Gets the status of the storage account at the time the operation was called. Possible values include: "Creating", "ResolvingDNS", "Succeeded". + "primaryLocation": "str", # Optional. Gets the + location of the primary for the storage account. + "provisioningState": "str", # Optional. Gets the + status of the storage account at the time the operation was called. + Possible values include: "Creating", "ResolvingDNS", "Succeeded". "secondaryEndpoints": { "FooPoint": { "Bar.Point": { "RecursivePoint": ... } }, - "blob": "str", # Optional. Gets the blob endpoint. + "blob": "str", # Optional. Gets the blob + endpoint. "dummyEndPoint": ..., - "queue": "str", # Optional. Gets the queue endpoint. - "table": "str" # Optional. Gets the table endpoint. + "queue": "str", # Optional. Gets the queue + endpoint. + "table": "str" # Optional. Gets the table + endpoint. }, - "secondaryLocation": "str", # Optional. Gets the location of the geo replicated secondary for the storage account. Only available if the accountType is StandardGRS or StandardRAGRS. - "statusOfPrimary": "str", # Optional. Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: "Available", "Unavailable". - "statusOfSecondary": "str" # Optional. Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: "Available", "Unavailable". + "secondaryLocation": "str", # Optional. Gets the + location of the geo replicated secondary for the storage account. + Only available if the accountType is StandardGRS or StandardRAGRS. + "statusOfPrimary": "str", # Optional. Gets the + status indicating whether the primary location of the storage account + is available or unavailable. Possible values include: "Available", + "Unavailable". + "statusOfSecondary": "str" # Optional. Gets the + status indicating whether the secondary location of the storage + account is available or unavailable. Only available if the + accountType is StandardGRS or StandardRAGRS. Possible values include: + "Available", "Unavailable". }, "tags": { - "str": "str" # Optional. A set of tags. Resource tags. + "str": "str" # Optional. A set of tags. Resource + tags. }, "type": "str" # Optional. Resource type. } @@ -727,29 +918,33 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = ( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts" - ) + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts' path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_regenerate_key_request( @@ -801,30 +996,37 @@ def build_regenerate_key_request( } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey" + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py index fbe313bf81a..c1b19b7971e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_list_request # type: ignore __all__ = [ - "build_list_request", + 'build_list_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py index 5f04bd532f6..80a0e32eb2c 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py @@ -46,13 +46,19 @@ def build_list_request( response.json() == { "value": [ { - "currentValue": 0, # Optional. Gets the current count of the allocated resources in the subscription. - "limit": 0, # Optional. Gets the maximum count of the resources that can be allocated in the subscription. + "currentValue": 0, # Optional. Gets the current count of the + allocated resources in the subscription. + "limit": 0, # Optional. Gets the maximum count of the + resources that can be allocated in the subscription. "name": { - "localizedValue": "str", # Optional. Gets a localized string describing the resource name. - "value": "str" # Optional. Gets a string describing the resource name. + "localizedValue": "str", # Optional. Gets a + localized string describing the resource name. + "value": "str" # Optional. Gets a string describing + the resource name. }, - "unit": "str" # Optional. Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", "Percent", "CountsPerSecond", "BytesPerSecond". + "unit": "str" # Optional. Gets the unit of measurement. + Possible values include: "Count", "Bytes", "Seconds", "Percent", + "CountsPerSecond", "BytesPerSecond". } ] } @@ -84,3 +90,4 @@ def build_list_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py index 0d9bf3accd0..383059b42b6 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py @@ -16,7 +16,10 @@ _SERIALIZER.client_side_validation = False -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: """Gets the current usage count and the limit for the resources under the subscription. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -37,35 +40,48 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: response.json() == { "value": [ { - "currentValue": 0, # Optional. Gets the current count of the allocated resources in the subscription. - "limit": 0, # Optional. Gets the maximum count of the resources that can be allocated in the subscription. + "currentValue": 0, # Optional. Gets the current count of the + allocated resources in the subscription. + "limit": 0, # Optional. Gets the maximum count of the + resources that can be allocated in the subscription. "name": { - "localizedValue": "str", # Optional. Gets a localized string describing the resource name. - "value": "str" # Optional. Gets a string describing the resource name. + "localizedValue": "str", # Optional. Gets a + localized string describing the resource name. + "value": "str" # Optional. Gets a string describing + the resource name. }, - "unit": "str" # Optional. Gets the unit of measurement. Possible values include: "Count", "Bytes", "Seconds", "Percent", "CountsPerSecond", "BytesPerSecond". + "unit": "str" # Optional. Gets the unit of measurement. + Possible values include: "Count", "Bytes", "Seconds", "Percent", + "CountsPerSecond", "BytesPerSecond". } ] } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages" + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/setup.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/setup.py index 134ed19236e..76028e221e7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/setup.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Some cool documentation. - """, + """ ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/__init__.py index 5516098e010..83558158f3d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MicrosoftAzureTestUrl"] +__all__ = ['MicrosoftAzureTestUrl'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_configuration.py index b4cf87c9459..04a56e33132 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class MicrosoftAzureTestUrlConfiguration(Configuration): +class MicrosoftAzureTestUrlConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MicrosoftAzureTestUrl. Note that all parameters used to create this instance are saved as instance @@ -29,13 +29,19 @@ class MicrosoftAzureTestUrlConfiguration(Configuration): :type subscription_id: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(MicrosoftAzureTestUrlConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -45,24 +51,23 @@ def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "microsoftazuretesturl/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftazuretesturl/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_microsoft_azure_test_url.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_microsoft_azure_test_url.py index 91c2bc8e89f..51bb5d662dc 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_microsoft_azure_test_url.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_microsoft_azure_test_url.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials import TokenCredential - class MicrosoftAzureTestUrl: """Some cool documentation. @@ -44,16 +43,15 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = MicrosoftAzureTestUrlConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + + self._config = MicrosoftAzureTestUrlConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_vendor.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_vendor.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/__init__.py index 5595d4583ad..b02e25a00c5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._microsoft_azure_test_url import MicrosoftAzureTestUrl - -__all__ = ["MicrosoftAzureTestUrl"] +__all__ = ['MicrosoftAzureTestUrl'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_configuration.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_configuration.py index 0f36b5ad581..29a95157580 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_configuration.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftAzureTestUrlConfiguration(Configuration): +class MicrosoftAzureTestUrlConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MicrosoftAzureTestUrl. Note that all parameters used to create this instance are saved as instance @@ -29,13 +29,19 @@ class MicrosoftAzureTestUrlConfiguration(Configuration): :type subscription_id: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2014-04-01-preview". Note that + overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(MicrosoftAzureTestUrlConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -45,21 +51,22 @@ def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **k self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "microsoftazuretesturl/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftazuretesturl/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_microsoft_azure_test_url.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_microsoft_azure_test_url.py index 57302663f01..5cb9377280f 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_microsoft_azure_test_url.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/aio/_microsoft_azure_test_url.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient @@ -21,7 +21,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class MicrosoftAzureTestUrl: """Some cool documentation. @@ -44,16 +43,19 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = MicrosoftAzureTestUrlConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + self._config = MicrosoftAzureTestUrlConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `subscriptionidapiversionlowlevel.rest`. diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py index 8b64bc9508a..6b0131e77e4 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_sample_resource_group_request # type: ignore __all__ = [ - "build_get_sample_resource_group_request", + 'build_get_sample_resource_group_request', ] diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py index a48788dfe0c..6e8c564dfcc 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py @@ -78,3 +78,4 @@ def build_get_sample_resource_group_request( headers=header_parameters, **kwargs ) + diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py index 640a7bec21a..4ecb67fd99c 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py @@ -17,7 +17,9 @@ def build_get_sample_resource_group_request( - subscription_id: str, resource_group_name: str, **kwargs: Any + subscription_id: str, + resource_group_name: str, + **kwargs: Any ) -> HttpRequest: """Provides a resouce group with name 'testgroup101' and location 'West US'. @@ -43,24 +45,31 @@ def build_get_sample_resource_group_request( } """ - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str accept = "application/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" + url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py index 623e438eb9c..48ac23f1972 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py index ff49498be27..a66288e2684 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py index d3e575e957c..b9017b0ff7b 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py index ecd1d021c33..2db0a55fdb1 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_duration_test_service import AutoRestDurationTestService - -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py index b12477e9c96..2ac6d5777b0 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py index 029a04192bc..5994e663a71 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py index c1711cf5b56..5de425fb108 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index 93b3398bd61..967a5c51fe8 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -9,30 +9,17 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_duration_get_invalid_request, - build_duration_get_null_request, - build_duration_get_positive_duration_request, - build_duration_put_positive_duration_request, -) - -T = TypeVar("T") +from ...operations._operations import build_duration_get_invalid_request, build_duration_get_null_request, build_duration_get_positive_duration_request, build_duration_put_positive_duration_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DurationOperations: """DurationOperations async operations. @@ -52,22 +39,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.timedelta]: """Get null duration value. :return: timedelta or None :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -85,8 +81,14 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: return deserialized + + @distributed_trace_async - async def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any) -> None: + async def put_positive_duration( + self, + duration_body: datetime.timedelta, + **kwargs: Any + ) -> None: """Put a positive duration value. :param duration_body: duration body. @@ -95,11 +97,13 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = duration_body @@ -110,7 +114,9 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -121,23 +127,34 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: + async def get_positive_duration( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get a positive duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_positive_duration_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_positive_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -155,23 +172,34 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get an invalid duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -188,3 +216,5 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py index c1711cf5b56..5de425fb108 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index 5c41609c940..fafe745b84e 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -9,80 +9,102 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_duration_get_null_request(**kwargs: Any) -> HttpRequest: +def build_duration_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/null" + url = '/duration/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_duration_put_positive_duration_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_duration_get_positive_duration_request(**kwargs: Any) -> HttpRequest: +def build_duration_get_positive_duration_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_duration_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_duration_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/invalid" + url = '/duration/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class DurationOperations(object): """DurationOperations operations. @@ -103,22 +125,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: + def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.timedelta]: """Get null duration value. :return: timedelta or None :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -136,8 +167,14 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: return deserialized + + @distributed_trace - def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any) -> None: + def put_positive_duration( + self, + duration_body: datetime.timedelta, + **kwargs: Any + ) -> None: """Put a positive duration value. :param duration_body: duration body. @@ -146,11 +183,13 @@ def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = duration_body @@ -161,7 +200,9 @@ def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -172,23 +213,34 @@ def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: + def get_positive_duration( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get a positive duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_positive_duration_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_positive_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -206,23 +258,34 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> datetime.timedelta: + def get_invalid( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get an invalid duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -239,3 +302,5 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py index 385afe6573c..05c0d98d9d2 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/__init__.py index 56e647414e7..4b4eb6c2361 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterGroupingTestService"] +__all__ = ['AutoRestParameterGroupingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_auto_rest_parameter_grouping_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_auto_rest_parameter_grouping_test_service.py index 9150d586851..e6d1773c1d1 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_auto_rest_parameter_grouping_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_auto_rest_parameter_grouping_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterGroupingTestService: """Test Infrastructure for AutoRest. @@ -31,16 +30,20 @@ class AutoRestParameterGroupingTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestParameterGroupingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - self.parameter_grouping = ParameterGroupingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.parameter_grouping = ParameterGroupingOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_configuration.py index c623295dd8c..e26c79294ea 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestParameterGroupingTestServiceConfiguration(Configuration): # pylin attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterGroupingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparametergroupingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparametergroupingtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/__init__.py index 925eefd8198..43644446d42 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameter_grouping_test_service import AutoRestParameterGroupingTestService - -__all__ = ["AutoRestParameterGroupingTestService"] +__all__ = ['AutoRestParameterGroupingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_auto_rest_parameter_grouping_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_auto_rest_parameter_grouping_test_service.py index f48061a4f1d..f2f68c4e08a 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_auto_rest_parameter_grouping_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_auto_rest_parameter_grouping_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterGroupingTestService: """Test Infrastructure for AutoRest. @@ -31,17 +30,25 @@ class AutoRestParameterGroupingTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestParameterGroupingTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - self.parameter_grouping = ParameterGroupingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.parameter_grouping = ParameterGroupingOperations(self._client, self._config, self._serialize, self._deserialize) + - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_configuration.py index 86d1c745c39..b29d04da057 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestParameterGroupingTestServiceConfiguration(Configuration): # pylin attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterGroupingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparametergroupingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparametergroupingtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/__init__.py index 571d4a82bf9..965f10cfc23 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParameterGroupingOperations __all__ = [ - "ParameterGroupingOperations", + 'ParameterGroupingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py index 4c991ae87a1..3574995a004 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py @@ -8,31 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_parameter_grouping_post_multi_param_groups_request, - build_parameter_grouping_post_optional_request, - build_parameter_grouping_post_required_request, - build_parameter_grouping_post_reserved_words_request, - build_parameter_grouping_post_shared_parameter_group_object_request, -) - -T = TypeVar("T") +from ...operations._operations import build_parameter_grouping_post_multi_param_groups_request, build_parameter_grouping_post_optional_request, build_parameter_grouping_post_required_request, build_parameter_grouping_post_reserved_words_request, build_parameter_grouping_post_shared_parameter_group_object_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ParameterGroupingOperations: """ParameterGroupingOperations async operations. @@ -53,7 +39,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: @distributed_trace_async async def post_required( - self, path: str, body: int, *, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs: Any + self, + path: str, + body: int, + *, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs: Any ) -> None: """Post a bunch of required parameters grouped. @@ -69,11 +61,13 @@ async def post_required( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body @@ -87,7 +81,9 @@ async def post_required( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -98,9 +94,15 @@ async def post_required( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def post_optional( - self, *, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs: Any + self, + *, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs: Any ) -> None: """Post a bunch of optional parameters grouped. @@ -112,10 +114,13 @@ async def post_optional( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_parameter_grouping_post_optional_request( custom_header=custom_header, query=query, @@ -123,7 +128,9 @@ async def post_optional( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -134,9 +141,15 @@ async def post_optional( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def post_reserved_words( - self, *, from_parameter: Optional[str] = None, accept_parameter: Optional[str] = None, **kwargs: Any + self, + *, + from_parameter: Optional[str] = None, + accept_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """Post a grouped parameters with reserved words. @@ -148,10 +161,13 @@ async def post_reserved_words( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_parameter_grouping_post_reserved_words_request( from_parameter=from_parameter, accept_parameter=accept_parameter, @@ -159,7 +175,9 @@ async def post_reserved_words( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -170,6 +188,8 @@ async def post_reserved_words( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def post_multi_param_groups( self, @@ -194,10 +214,13 @@ async def post_multi_param_groups( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_parameter_grouping_post_multi_param_groups_request( header_one=header_one, query_one=query_one, @@ -207,7 +230,9 @@ async def post_multi_param_groups( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -218,9 +243,15 @@ async def post_multi_param_groups( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def post_shared_parameter_group_object( - self, *, header_one: Optional[str] = None, query_one: Optional[int] = 30, **kwargs: Any + self, + *, + header_one: Optional[str] = None, + query_one: Optional[int] = 30, + **kwargs: Any ) -> None: """Post parameters with a shared parameter group object. @@ -232,10 +263,13 @@ async def post_shared_parameter_group_object( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_parameter_grouping_post_shared_parameter_group_object_request( header_one=header_one, query_one=query_one, @@ -243,7 +277,9 @@ async def post_shared_parameter_group_object( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -253,3 +289,5 @@ async def post_shared_parameter_group_object( if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/__init__.py index 571d4a82bf9..965f10cfc23 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParameterGroupingOperations __all__ = [ - "ParameterGroupingOperations", + 'ParameterGroupingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py index eeeedb211bf..c58c6ee38f3 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,14 +16,12 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - def build_parameter_grouping_post_required_request( path: str, *, @@ -39,13 +31,13 @@ def build_parameter_grouping_post_required_request( query: Optional[int] = 30, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/parameterGrouping/postRequired/{path}" + url = '/parameterGrouping/postRequired/{path}' path_format_arguments = { - "path": _SERIALIZER.url("path", path, "str"), + "path": _SERIALIZER.url("path", path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -53,61 +45,85 @@ def build_parameter_grouping_post_required_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query is not None: - query_parameters["query"] = _SERIALIZER.query("query", query, "int") + query_parameters['query'] = _SERIALIZER.query("query", query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if custom_header is not None: - header_parameters["customHeader"] = _SERIALIZER.header("custom_header", custom_header, "str") + header_parameters['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) def build_parameter_grouping_post_optional_request( - *, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs: Any + *, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/parameterGrouping/postOptional" + url = '/parameterGrouping/postOptional' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query is not None: - query_parameters["query"] = _SERIALIZER.query("query", query, "int") + query_parameters['query'] = _SERIALIZER.query("query", query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if custom_header is not None: - header_parameters["customHeader"] = _SERIALIZER.header("custom_header", custom_header, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_parameter_grouping_post_reserved_words_request( - *, from_parameter: Optional[str] = None, accept_parameter: Optional[str] = None, **kwargs: Any + *, + from_parameter: Optional[str] = None, + accept_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/parameterGrouping/postReservedWords" + url = '/parameterGrouping/postReservedWords' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if from_parameter is not None: - query_parameters["from"] = _SERIALIZER.query("from_parameter", from_parameter, "str") + query_parameters['from'] = _SERIALIZER.query("from_parameter", from_parameter, 'str') if accept_parameter is not None: - query_parameters["accept"] = _SERIALIZER.query("accept_parameter", accept_parameter, "str") + query_parameters['accept'] = _SERIALIZER.query("accept_parameter", accept_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_parameter_grouping_post_multi_param_groups_request( @@ -120,46 +136,60 @@ def build_parameter_grouping_post_multi_param_groups_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/parameterGrouping/postMultipleParameterGroups" + url = '/parameterGrouping/postMultipleParameterGroups' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query_one is not None: - query_parameters["query-one"] = _SERIALIZER.query("query_one", query_one, "int") + query_parameters['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') if query_two is not None: - query_parameters["query-two"] = _SERIALIZER.query("query_two", query_two, "int") + query_parameters['query-two'] = _SERIALIZER.query("query_two", query_two, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_one is not None: - header_parameters["header-one"] = _SERIALIZER.header("header_one", header_one, "str") + header_parameters['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') if header_two is not None: - header_parameters["header-two"] = _SERIALIZER.header("header_two", header_two, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['header-two'] = _SERIALIZER.header("header_two", header_two, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_parameter_grouping_post_shared_parameter_group_object_request( - *, header_one: Optional[str] = None, query_one: Optional[int] = 30, **kwargs: Any + *, + header_one: Optional[str] = None, + query_one: Optional[int] = 30, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/parameterGrouping/sharedParameterGroupObject" + url = '/parameterGrouping/sharedParameterGroupObject' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query_one is not None: - query_parameters["query-one"] = _SERIALIZER.query("query_one", query_one, "int") + query_parameters['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_one is not None: - header_parameters["header-one"] = _SERIALIZER.header("header_one", header_one, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ParameterGroupingOperations(object): """ParameterGroupingOperations operations. @@ -181,7 +211,13 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def post_required( - self, path: str, body: int, *, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs: Any + self, + path: str, + body: int, + *, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs: Any ) -> None: """Post a bunch of required parameters grouped. @@ -197,11 +233,13 @@ def post_required( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body @@ -215,7 +253,9 @@ def post_required( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -226,8 +266,16 @@ def post_required( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional(self, *, custom_header: Optional[str] = None, query: Optional[int] = 30, **kwargs: Any) -> None: + def post_optional( + self, + *, + custom_header: Optional[str] = None, + query: Optional[int] = 30, + **kwargs: Any + ) -> None: """Post a bunch of optional parameters grouped. :keyword custom_header: @@ -238,10 +286,14 @@ def post_optional(self, *, custom_header: Optional[str] = None, query: Optional[ :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_parameter_grouping_post_optional_request( custom_header=custom_header, query=query, @@ -249,7 +301,9 @@ def post_optional(self, *, custom_header: Optional[str] = None, query: Optional[ request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -260,9 +314,15 @@ def post_optional(self, *, custom_header: Optional[str] = None, query: Optional[ if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def post_reserved_words( - self, *, from_parameter: Optional[str] = None, accept_parameter: Optional[str] = None, **kwargs: Any + self, + *, + from_parameter: Optional[str] = None, + accept_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """Post a grouped parameters with reserved words. @@ -274,10 +334,14 @@ def post_reserved_words( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_parameter_grouping_post_reserved_words_request( from_parameter=from_parameter, accept_parameter=accept_parameter, @@ -285,7 +349,9 @@ def post_reserved_words( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -296,6 +362,8 @@ def post_reserved_words( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def post_multi_param_groups( self, @@ -320,10 +388,14 @@ def post_multi_param_groups( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_parameter_grouping_post_multi_param_groups_request( header_one=header_one, query_one=query_one, @@ -333,7 +405,9 @@ def post_multi_param_groups( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -344,9 +418,15 @@ def post_multi_param_groups( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def post_shared_parameter_group_object( - self, *, header_one: Optional[str] = None, query_one: Optional[int] = 30, **kwargs: Any + self, + *, + header_one: Optional[str] = None, + query_one: Optional[int] = 30, + **kwargs: Any ) -> None: """Post parameters with a shared parameter group object. @@ -358,10 +438,14 @@ def post_shared_parameter_group_object( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_parameter_grouping_post_shared_parameter_group_object_request( header_one=header_one, query_one=query_one, @@ -369,7 +453,9 @@ def post_shared_parameter_group_object( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -379,3 +465,5 @@ def post_shared_parameter_group_object( if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py index 5b4af33fe8a..999d5456e09 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/__init__.py index f41ac75f784..f93c711020e 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestReportServiceForAzure"] +__all__ = ['AutoRestReportServiceForAzure'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_auto_rest_report_service_for_azure.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_auto_rest_report_service_for_azure.py index 77886123413..3adfd5883e3 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_auto_rest_report_service_for_azure.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_auto_rest_report_service_for_azure.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportServiceForAzure(AutoRestReportServiceForAzureOperationsMixin): """Test Infrastructure for AutoRest. @@ -28,8 +27,13 @@ class AutoRestReportServiceForAzure(AutoRestReportServiceForAzureOperationsMixin :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestReportServiceForAzureConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_configuration.py index ca4c15656d6..175c44970b6 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestReportServiceForAzureConfiguration(Configuration): # pylint: disa attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceForAzureConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportserviceforazure/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportserviceforazure/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/__init__.py index 0258ed894c1..f2327f0ddc2 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestReportServiceForAzureOperationsMixin __all__ = [ - "AutoRestReportServiceForAzureOperationsMixin", + 'AutoRestReportServiceForAzureOperationsMixin', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py index 42b8ab92e85..e2de1602787 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py @@ -8,47 +8,54 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_get_report_request( + *, + qualifier: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/report/azure" + url = '/report/azure' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if qualifier is not None: - query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AutoRestReportServiceForAzureOperationsMixin(object): + @distributed_trace - def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + def get_report( + self, + *, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get test coverage report. :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' @@ -67,17 +74,23 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_report_request( qualifier=qualifier, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -94,3 +107,5 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/__init__.py index da79a2dd3bd..13808e726c2 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_report_service_for_azure import AutoRestReportServiceForAzure - -__all__ = ["AutoRestReportServiceForAzure"] +__all__ = ['AutoRestReportServiceForAzure'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_auto_rest_report_service_for_azure.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_auto_rest_report_service_for_azure.py index 884ff812a21..442716eed71 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_auto_rest_report_service_for_azure.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_auto_rest_report_service_for_azure.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportServiceForAzure(AutoRestReportServiceForAzureOperationsMixin): """Test Infrastructure for AutoRest. @@ -28,7 +27,12 @@ class AutoRestReportServiceForAzure(AutoRestReportServiceForAzureOperationsMixin :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestReportServiceForAzureConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_configuration.py index d5789eafc0d..5bb752f3da4 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestReportServiceForAzureConfiguration(Configuration): # pylint: disa attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceForAzureConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportserviceforazure/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportserviceforazure/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/__init__.py index 0258ed894c1..f2327f0ddc2 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestReportServiceForAzureOperationsMixin __all__ = [ - "AutoRestReportServiceForAzureOperationsMixin", + 'AutoRestReportServiceForAzureOperationsMixin', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py index e415c0c2d3b..7250a2f2400 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py @@ -8,28 +8,26 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ..._operations._operations import build_get_report_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestReportServiceForAzureOperationsMixin: + @distributed_trace_async - async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + async def get_report( + self, + *, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get test coverage report. :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' @@ -48,17 +46,22 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_report_request( qualifier=qualifier, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -75,3 +78,5 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py index 94333e8e5a3..b8884760fd7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/__init__.py index a556ef949db..9ddba899fc1 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestAzureSpecialParametersTestClient"] +__all__ = ['AutoRestAzureSpecialParametersTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_auto_rest_azure_special_parameters_test_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_auto_rest_azure_special_parameters_test_client.py index cf98b37706e..21142e96453 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_auto_rest_azure_special_parameters_test_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_auto_rest_azure_special_parameters_test_client.py @@ -14,16 +14,7 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestAzureSpecialParametersTestClientConfiguration -from .operations import ( - ApiVersionDefaultOperations, - ApiVersionLocalOperations, - HeaderOperations, - OdataOperations, - SkipUrlEncodingOperations, - SubscriptionInCredentialsOperations, - SubscriptionInMethodOperations, - XMsClientRequestIdOperations, -) +from .operations import ApiVersionDefaultOperations, ApiVersionLocalOperations, HeaderOperations, OdataOperations, SkipUrlEncodingOperations, SubscriptionInCredentialsOperations, SubscriptionInMethodOperations, XMsClientRequestIdOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,8 +22,7 @@ from azure.core.credentials import TokenCredential - -class AutoRestAzureSpecialParametersTestClient: # pylint: disable=too-many-instance-attributes +class AutoRestAzureSpecialParametersTestClient: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar xms_client_request_id: XMsClientRequestIdOperations operations @@ -77,35 +67,22 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + + self._config = AutoRestAzureSpecialParametersTestClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - self.xms_client_request_id = XMsClientRequestIdOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_credentials = SubscriptionInCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_method = SubscriptionInMethodOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_default = ApiVersionDefaultOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_local = ApiVersionLocalOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.skip_url_encoding = SkipUrlEncodingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.xms_client_request_id = XMsClientRequestIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_credentials = SubscriptionInCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_method = SubscriptionInMethodOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_default = ApiVersionDefaultOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_local = ApiVersionLocalOperations(self._client, self._config, self._serialize, self._deserialize) + self.skip_url_encoding = SkipUrlEncodingOperations(self._client, self._config, self._serialize, self._deserialize) self.odata = OdataOperations(self._client, self._config, self._serialize, self._deserialize) self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_configuration.py index 2bc6b72d724..9b7ad26b889 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_configuration.py @@ -19,9 +19,7 @@ from azure.core.credentials import TokenCredential -class AutoRestAzureSpecialParametersTestClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestAzureSpecialParametersTestClient. Note that all parameters used to create this instance are saved as instance @@ -37,9 +35,14 @@ class AutoRestAzureSpecialParametersTestClientConfiguration( :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestAzureSpecialParametersTestClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -49,24 +52,23 @@ def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestazurespecialparameterstestclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestazurespecialparameterstestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/__init__.py index 2c807d773e3..71365d65258 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_azure_special_parameters_test_client import AutoRestAzureSpecialParametersTestClient - -__all__ = ["AutoRestAzureSpecialParametersTestClient"] +__all__ = ['AutoRestAzureSpecialParametersTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_auto_rest_azure_special_parameters_test_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_auto_rest_azure_special_parameters_test_client.py index 815627a8632..f16f2148ecd 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_auto_rest_azure_special_parameters_test_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_auto_rest_azure_special_parameters_test_client.py @@ -14,16 +14,7 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestAzureSpecialParametersTestClientConfiguration -from .operations import ( - ApiVersionDefaultOperations, - ApiVersionLocalOperations, - HeaderOperations, - OdataOperations, - SkipUrlEncodingOperations, - SubscriptionInCredentialsOperations, - SubscriptionInMethodOperations, - XMsClientRequestIdOperations, -) +from .operations import ApiVersionDefaultOperations, ApiVersionLocalOperations, HeaderOperations, OdataOperations, SkipUrlEncodingOperations, SubscriptionInCredentialsOperations, SubscriptionInMethodOperations, XMsClientRequestIdOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,8 +22,7 @@ from azure.core.credentials_async import AsyncTokenCredential - -class AutoRestAzureSpecialParametersTestClient: # pylint: disable=too-many-instance-attributes +class AutoRestAzureSpecialParametersTestClient: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar xms_client_request_id: XMsClientRequestIdOperations operations @@ -77,35 +67,26 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + self._config = AutoRestAzureSpecialParametersTestClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - self.xms_client_request_id = XMsClientRequestIdOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_credentials = SubscriptionInCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_in_method = SubscriptionInMethodOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_default = ApiVersionDefaultOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.api_version_local = ApiVersionLocalOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.skip_url_encoding = SkipUrlEncodingOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.xms_client_request_id = XMsClientRequestIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_credentials = SubscriptionInCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.subscription_in_method = SubscriptionInMethodOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_default = ApiVersionDefaultOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_version_local = ApiVersionLocalOperations(self._client, self._config, self._serialize, self._deserialize) + self.skip_url_encoding = SkipUrlEncodingOperations(self._client, self._config, self._serialize, self._deserialize) self.odata = OdataOperations(self._client, self._config, self._serialize, self._deserialize) self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_configuration.py index 28b8bc89697..35733672be2 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_configuration.py @@ -19,9 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestAzureSpecialParametersTestClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestAzureSpecialParametersTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestAzureSpecialParametersTestClient. Note that all parameters used to create this instance are saved as instance @@ -37,9 +35,14 @@ class AutoRestAzureSpecialParametersTestClientConfiguration( :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestAzureSpecialParametersTestClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -49,21 +52,22 @@ def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **k self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestazurespecialparameterstestclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestazurespecialparameterstestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/__init__.py index ff6b6bc76e5..0149fc97620 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/__init__.py @@ -16,12 +16,12 @@ from ._operations import HeaderOperations __all__ = [ - "XMsClientRequestIdOperations", - "SubscriptionInCredentialsOperations", - "SubscriptionInMethodOperations", - "ApiVersionDefaultOperations", - "ApiVersionLocalOperations", - "SkipUrlEncodingOperations", - "OdataOperations", - "HeaderOperations", + 'XMsClientRequestIdOperations', + 'SubscriptionInCredentialsOperations', + 'SubscriptionInMethodOperations', + 'ApiVersionDefaultOperations', + 'ApiVersionLocalOperations', + 'SkipUrlEncodingOperations', + 'OdataOperations', + 'HeaderOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py index d6465511918..5da5f4dc8f0 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py @@ -8,56 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ...operations._operations import ( - build_api_version_default_get_method_global_not_provided_valid_request, - build_api_version_default_get_method_global_valid_request, - build_api_version_default_get_path_global_valid_request, - build_api_version_default_get_swagger_global_valid_request, - build_api_version_local_get_method_local_null_request, - build_api_version_local_get_method_local_valid_request, - build_api_version_local_get_path_local_valid_request, - build_api_version_local_get_swagger_local_valid_request, - build_header_custom_named_request_id_head_request, - build_header_custom_named_request_id_param_grouping_request, - build_header_custom_named_request_id_request, - build_odata_get_with_filter_request, - build_skip_url_encoding_get_method_path_valid_request, - build_skip_url_encoding_get_method_query_null_request, - build_skip_url_encoding_get_method_query_valid_request, - build_skip_url_encoding_get_path_query_valid_request, - build_skip_url_encoding_get_path_valid_request, - build_skip_url_encoding_get_swagger_path_valid_request, - build_skip_url_encoding_get_swagger_query_valid_request, - build_subscription_in_credentials_post_method_global_not_provided_valid_request, - build_subscription_in_credentials_post_method_global_null_request, - build_subscription_in_credentials_post_method_global_valid_request, - build_subscription_in_credentials_post_path_global_valid_request, - build_subscription_in_credentials_post_swagger_global_valid_request, - build_subscription_in_method_post_method_local_null_request, - build_subscription_in_method_post_method_local_valid_request, - build_subscription_in_method_post_path_local_valid_request, - build_subscription_in_method_post_swagger_local_valid_request, - build_xms_client_request_id_get_request, - build_xms_client_request_id_param_get_request, -) - -T = TypeVar("T") +from ...operations._operations import build_api_version_default_get_method_global_not_provided_valid_request, build_api_version_default_get_method_global_valid_request, build_api_version_default_get_path_global_valid_request, build_api_version_default_get_swagger_global_valid_request, build_api_version_local_get_method_local_null_request, build_api_version_local_get_method_local_valid_request, build_api_version_local_get_path_local_valid_request, build_api_version_local_get_swagger_local_valid_request, build_header_custom_named_request_id_head_request, build_header_custom_named_request_id_param_grouping_request, build_header_custom_named_request_id_request, build_odata_get_with_filter_request, build_skip_url_encoding_get_method_path_valid_request, build_skip_url_encoding_get_method_query_null_request, build_skip_url_encoding_get_method_query_valid_request, build_skip_url_encoding_get_path_query_valid_request, build_skip_url_encoding_get_path_valid_request, build_skip_url_encoding_get_swagger_path_valid_request, build_skip_url_encoding_get_swagger_query_valid_request, build_subscription_in_credentials_post_method_global_not_provided_valid_request, build_subscription_in_credentials_post_method_global_null_request, build_subscription_in_credentials_post_method_global_valid_request, build_subscription_in_credentials_post_path_global_valid_request, build_subscription_in_credentials_post_swagger_global_valid_request, build_subscription_in_method_post_method_local_null_request, build_subscription_in_method_post_method_local_valid_request, build_subscription_in_method_post_path_local_valid_request, build_subscription_in_method_post_swagger_local_valid_request, build_xms_client_request_id_get_request, build_xms_client_request_id_param_get_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class XMsClientRequestIdOperations: """XMsClientRequestIdOperations async operations. @@ -77,7 +38,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get(self, **kwargs: Any) -> None: + async def get( + self, + **kwargs: Any + ) -> None: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -85,15 +49,21 @@ async def get(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xms_client_request_id_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xms_client_request_id_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -104,8 +74,15 @@ async def get(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def param_get(self, *, x_ms_client_request_id: str, **kwargs: Any) -> None: + async def param_get( + self, + *, + x_ms_client_request_id: str, + **kwargs: Any + ) -> None: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -116,17 +93,22 @@ async def param_get(self, *, x_ms_client_request_id: str, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_xms_client_request_id_param_get_request( x_ms_client_request_id=x_ms_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -157,7 +139,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def post_method_global_valid(self, **kwargs: Any) -> None: + async def post_method_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -165,17 +150,22 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_method_global_valid_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -186,8 +176,13 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_method_global_null(self, **kwargs: Any) -> None: + async def post_method_global_null( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. @@ -195,17 +190,22 @@ async def post_method_global_null(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_method_global_null_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -216,8 +216,13 @@ async def post_method_global_null(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: + async def post_method_global_not_provided_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -225,12 +230,15 @@ async def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_subscription_in_credentials_post_method_global_not_provided_valid_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -238,7 +246,9 @@ async def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -249,8 +259,13 @@ async def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_path_global_valid(self, **kwargs: Any) -> None: + async def post_path_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -258,17 +273,22 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_path_global_valid_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -279,8 +299,13 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_swagger_global_valid(self, **kwargs: Any) -> None: + async def post_swagger_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -288,17 +313,22 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_swagger_global_valid_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -329,7 +359,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + async def post_method_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -340,17 +374,22 @@ async def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_method_local_valid_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -361,8 +400,14 @@ async def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> None: + async def post_method_local_null( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. @@ -373,17 +418,22 @@ async def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_method_local_null_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -394,8 +444,14 @@ async def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + async def post_path_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -405,17 +461,22 @@ async def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_path_local_valid_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -426,8 +487,14 @@ async def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_swagger_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + async def post_swagger_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -438,17 +505,22 @@ async def post_swagger_local_valid(self, subscription_id: str, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_swagger_local_valid_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -479,26 +551,34 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_method_global_valid(self, **kwargs: Any) -> None: + async def get_method_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_method_global_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -509,27 +589,37 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_method_global_not_provided_valid(self, **kwargs: Any) -> None: + async def get_method_global_not_provided_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_method_global_not_provided_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -540,27 +630,37 @@ async def get_method_global_not_provided_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_path_global_valid(self, **kwargs: Any) -> None: + async def get_path_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_path_global_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -571,27 +671,37 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_swagger_global_valid(self, **kwargs: Any) -> None: + async def get_swagger_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_swagger_global_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -622,7 +732,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_method_local_valid(self, **kwargs: Any) -> None: + async def get_method_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: This should appear as a method parameter, use value '2.0'. The default @@ -632,19 +745,24 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_api_version_local_get_method_local_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -655,8 +773,15 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_method_local_null(self, *, api_version: Optional[str] = None, **kwargs: Any) -> None: + async def get_method_local_null( + self, + *, + api_version: Optional[str] = None, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = null to succeed. :keyword api_version: This should appear as a method parameter, use value null, this should @@ -666,17 +791,22 @@ async def get_method_local_null(self, *, api_version: Optional[str] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_api_version_local_get_method_local_null_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -687,8 +817,13 @@ async def get_method_local_null(self, *, api_version: Optional[str] = None, **kw if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_path_local_valid(self, **kwargs: Any) -> None: + async def get_path_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: This should appear as a method parameter, use value '2.0'. The default @@ -698,19 +833,24 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_api_version_local_get_path_local_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -721,8 +861,13 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_swagger_local_valid(self, **kwargs: Any) -> None: + async def get_swagger_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: The api version, which appears in the query, the value is always '2.0'. @@ -733,19 +878,24 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_api_version_local_get_swagger_local_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -776,7 +926,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: + async def get_method_path_valid( + self, + unencoded_path_param: str, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. @@ -785,17 +939,22 @@ async def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_skip_url_encoding_get_method_path_valid_request( unencoded_path_param=unencoded_path_param, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -806,8 +965,14 @@ async def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: + async def get_path_valid( + self, + unencoded_path_param: str, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. @@ -816,17 +981,22 @@ async def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_skip_url_encoding_get_path_valid_request( unencoded_path_param=unencoded_path_param, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -837,8 +1007,13 @@ async def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_swagger_path_valid(self, **kwargs: Any) -> None: + async def get_swagger_path_valid( + self, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :keyword unencoded_path_param: An unencoded path parameter with value 'path1/path2/path3'. The @@ -849,19 +1024,24 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - unencoded_path_param = kwargs.pop("unencoded_path_param", "path1/path2/path3") # type: str + unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str + request = build_skip_url_encoding_get_swagger_path_valid_request( unencoded_path_param=unencoded_path_param, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -872,8 +1052,15 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_method_query_valid(self, *, q1: str, **kwargs: Any) -> None: + async def get_method_query_valid( + self, + *, + q1: str, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :keyword q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. @@ -882,17 +1069,22 @@ async def get_method_query_valid(self, *, q1: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_skip_url_encoding_get_method_query_valid_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -903,8 +1095,15 @@ async def get_method_query_valid(self, *, q1: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_method_query_null(self, *, q1: Optional[str] = None, **kwargs: Any) -> None: + async def get_method_query_null( + self, + *, + q1: Optional[str] = None, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value null. :keyword q1: Unencoded query parameter with value null. @@ -913,17 +1112,22 @@ async def get_method_query_null(self, *, q1: Optional[str] = None, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_skip_url_encoding_get_method_query_null_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -934,8 +1138,15 @@ async def get_method_query_null(self, *, q1: Optional[str] = None, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: + async def get_path_query_valid( + self, + *, + q1: str, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :keyword q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. @@ -944,17 +1155,22 @@ async def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_skip_url_encoding_get_path_query_valid_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -965,8 +1181,13 @@ async def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_swagger_query_valid(self, **kwargs: Any) -> None: + async def get_swagger_query_valid( + self, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :keyword q1: An unencoded query parameter with value 'value1&q2=value2&q3=value3'. The default @@ -977,19 +1198,24 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - q1 = kwargs.pop("q1", "value1&q2=value2&q3=value3") # type: str + q1 = kwargs.pop('q1', "value1&q2=value2&q3=value3") # type: str + request = build_skip_url_encoding_get_swagger_query_valid_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1021,7 +1247,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: @distributed_trace_async async def get_with_filter( - self, *, filter: Optional[str] = None, top: Optional[int] = None, orderby: Optional[str] = None, **kwargs: Any + self, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any ) -> None: """Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. @@ -1035,10 +1266,13 @@ async def get_with_filter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_odata_get_with_filter_request( filter=filter, top=top, @@ -1047,7 +1281,9 @@ async def get_with_filter( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1078,7 +1314,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def custom_named_request_id(self, *, foo_client_request_id: str, **kwargs: Any) -> None: + async def custom_named_request_id( + self, + *, + foo_client_request_id: str, + **kwargs: Any + ) -> None: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. :keyword foo_client_request_id: The fooRequestId. @@ -1087,17 +1328,22 @@ async def custom_named_request_id(self, *, foo_client_request_id: str, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_custom_named_request_id_request( foo_client_request_id=foo_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1106,13 +1352,21 @@ async def custom_named_request_id(self, *, foo_client_request_id: str, **kwargs: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def custom_named_request_id_param_grouping(self, *, foo_client_request_id: str, **kwargs: Any) -> None: + async def custom_named_request_id_param_grouping( + self, + *, + foo_client_request_id: str, + **kwargs: Any + ) -> None: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. @@ -1122,17 +1376,22 @@ async def custom_named_request_id_param_grouping(self, *, foo_client_request_id: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_custom_named_request_id_param_grouping_request( foo_client_request_id=foo_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1141,13 +1400,21 @@ async def custom_named_request_id_param_grouping(self, *, foo_client_request_id: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def custom_named_request_id_head(self, *, foo_client_request_id: str, **kwargs: Any) -> bool: + async def custom_named_request_id_head( + self, + *, + foo_client_request_id: str, + **kwargs: Any + ) -> bool: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. :keyword foo_client_request_id: The fooRequestId. @@ -1156,17 +1423,22 @@ async def custom_named_request_id_head(self, *, foo_client_request_id: str, **kw :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_custom_named_request_id_head_request( foo_client_request_id=foo_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1176,8 +1448,11 @@ async def custom_named_request_id_head(self, *, foo_client_request_id: str, **kw response_headers = {} if response.status_code == 200: - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/__init__.py index ff6b6bc76e5..0149fc97620 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/__init__.py @@ -16,12 +16,12 @@ from ._operations import HeaderOperations __all__ = [ - "XMsClientRequestIdOperations", - "SubscriptionInCredentialsOperations", - "SubscriptionInMethodOperations", - "ApiVersionDefaultOperations", - "ApiVersionLocalOperations", - "SkipUrlEncodingOperations", - "OdataOperations", - "HeaderOperations", + 'XMsClientRequestIdOperations', + 'SubscriptionInCredentialsOperations', + 'SubscriptionInMethodOperations', + 'ApiVersionDefaultOperations', + 'ApiVersionLocalOperations', + 'SkipUrlEncodingOperations', + 'OdataOperations', + 'HeaderOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py index a9a2ebc2eb5..2cb7302f237 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -23,538 +17,765 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - -def build_xms_client_request_id_get_request(**kwargs: Any) -> HttpRequest: +def build_xms_client_request_id_get_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/azurespecials/overwrite/x-ms-client-request-id/method/" + url = '/azurespecials/overwrite/x-ms-client-request-id/method/' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_xms_client_request_id_param_get_request(*, x_ms_client_request_id: str, **kwargs: Any) -> HttpRequest: +def build_xms_client_request_id_param_get_request( + *, + x_ms_client_request_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/overwrite/x-ms-client-request-id/via-param/method/" + url = '/azurespecials/overwrite/x-ms-client-request-id/via-param/method/' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["x-ms-client-request-id"] = _SERIALIZER.header( - "x_ms_client_request_id", x_ms_client_request_id, "str" + header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("x_ms_client_request_id", x_ms_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) def build_subscription_in_credentials_post_method_global_valid_request( - subscription_id: str, **kwargs: Any + subscription_id: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_subscription_in_credentials_post_method_global_null_request( - subscription_id: str, **kwargs: Any + subscription_id: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_subscription_in_credentials_post_method_global_not_provided_valid_request( - subscription_id: str, **kwargs: Any + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_subscription_in_credentials_post_path_global_valid_request( - subscription_id: str, **kwargs: Any + subscription_id: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_subscription_in_credentials_post_swagger_global_valid_request( - subscription_id: str, **kwargs: Any + subscription_id: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_subscription_in_method_post_method_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_subscription_in_method_post_method_local_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_subscription_in_method_post_method_local_null_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_subscription_in_method_post_method_local_null_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}" + url = '/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_subscription_in_method_post_path_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_subscription_in_method_post_path_local_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_subscription_in_method_post_swagger_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_subscription_in_method_post_swagger_local_valid_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" + url = '/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_api_version_default_get_method_global_valid_request(**kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str +def build_api_version_default_get_method_global_valid_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview" + url = '/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_api_version_default_get_method_global_not_provided_valid_request(**kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str +def build_api_version_default_get_method_global_not_provided_valid_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview" + url = '/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_api_version_default_get_path_global_valid_request(**kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str +def build_api_version_default_get_path_global_valid_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview" + url = '/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_api_version_default_get_swagger_global_valid_request(**kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str +def build_api_version_default_get_swagger_global_valid_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview" + url = '/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_api_version_local_get_method_local_valid_request(**kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2.0") # type: str +def build_api_version_local_get_method_local_valid_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2.0") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/local/2.0" + url = '/azurespecials/apiVersion/method/string/none/query/local/2.0' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_api_version_local_get_method_local_null_request( - *, api_version: Optional[str] = None, **kwargs: Any + *, + api_version: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/method/string/none/query/local/null" + url = '/azurespecials/apiVersion/method/string/none/query/local/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if api_version is not None: - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_api_version_local_get_path_local_valid_request(**kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2.0") # type: str +def build_api_version_local_get_path_local_valid_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2.0") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/path/string/none/query/local/2.0" + url = '/azurespecials/apiVersion/path/string/none/query/local/2.0' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_api_version_local_get_swagger_local_valid_request(**kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2.0") # type: str +def build_api_version_local_get_swagger_local_valid_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2.0") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/apiVersion/swagger/string/none/query/local/2.0" + url = '/azurespecials/apiVersion/swagger/string/none/query/local/2.0' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_skip_url_encoding_get_method_path_valid_request(unencoded_path_param: str, **kwargs: Any) -> HttpRequest: +def build_skip_url_encoding_get_method_path_valid_request( + unencoded_path_param: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}" + url = '/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}' path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_skip_url_encoding_get_path_valid_request(unencoded_path_param: str, **kwargs: Any) -> HttpRequest: +def build_skip_url_encoding_get_path_valid_request( + unencoded_path_param: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}" + url = '/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}' path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_skip_url_encoding_get_swagger_path_valid_request(**kwargs: Any) -> HttpRequest: - unencoded_path_param = kwargs.pop("unencoded_path_param", "path1/path2/path3") # type: str +def build_skip_url_encoding_get_swagger_path_valid_request( + **kwargs: Any +) -> HttpRequest: + unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}" + url = '/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}' path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_skip_url_encoding_get_method_query_valid_request(*, q1: str, **kwargs: Any) -> HttpRequest: +def build_skip_url_encoding_get_method_query_valid_request( + *, + q1: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/method/query/valid" + url = '/azurespecials/skipUrlEncoding/method/query/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_skip_url_encoding_get_method_query_null_request(*, q1: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_skip_url_encoding_get_method_query_null_request( + *, + q1: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/method/query/null" + url = '/azurespecials/skipUrlEncoding/method/query/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if q1 is not None: - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_skip_url_encoding_get_path_query_valid_request(*, q1: str, **kwargs: Any) -> HttpRequest: +def build_skip_url_encoding_get_path_query_valid_request( + *, + q1: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/path/query/valid" + url = '/azurespecials/skipUrlEncoding/path/query/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_skip_url_encoding_get_swagger_query_valid_request(**kwargs: Any) -> HttpRequest: - q1 = kwargs.pop("q1", "value1&q2=value2&q3=value3") # type: str +def build_skip_url_encoding_get_swagger_query_valid_request( + **kwargs: Any +) -> HttpRequest: + q1 = kwargs.pop('q1', "value1&q2=value2&q3=value3") # type: str accept = "application/json" # Construct URL - url = "/azurespecials/skipUrlEncoding/swagger/query/valid" + url = '/azurespecials/skipUrlEncoding/swagger/query/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) + query_parameters['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_odata_get_with_filter_request( - *, filter: Optional[str] = None, top: Optional[int] = None, orderby: Optional[str] = None, **kwargs: Any + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/odata/filter" + url = '/azurespecials/odata/filter' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters["$filter"] = _SERIALIZER.query("filter", filter, "str") + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters["$top"] = _SERIALIZER.query("top", top, "int") + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') if orderby is not None: - query_parameters["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_header_custom_named_request_id_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: +def build_header_custom_named_request_id_request( + *, + foo_client_request_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/customNamedRequestId" + url = '/azurespecials/customNamedRequestId' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["foo-client-request-id"] = _SERIALIZER.header( - "foo_client_request_id", foo_client_request_id, "str" + header_parameters['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) def build_header_custom_named_request_id_param_grouping_request( - *, foo_client_request_id: str, **kwargs: Any + *, + foo_client_request_id: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/customNamedRequestIdParamGrouping" + url = '/azurespecials/customNamedRequestIdParamGrouping' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["foo-client-request-id"] = _SERIALIZER.header( - "foo_client_request_id", foo_client_request_id, "str" + header_parameters['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) -def build_header_custom_named_request_id_head_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: +def build_header_custom_named_request_id_head_request( + *, + foo_client_request_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/azurespecials/customNamedRequestIdHead" + url = '/azurespecials/customNamedRequestIdHead' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["foo-client-request-id"] = _SERIALIZER.header( - "foo_client_request_id", foo_client_request_id, "str" + header_parameters['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) - class XMsClientRequestIdOperations(object): """XMsClientRequestIdOperations operations. @@ -575,7 +796,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get(self, **kwargs: Any) -> None: + def get( + self, + **kwargs: Any + ) -> None: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -583,15 +807,21 @@ def get(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xms_client_request_id_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xms_client_request_id_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -602,8 +832,15 @@ def get(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def param_get(self, *, x_ms_client_request_id: str, **kwargs: Any) -> None: + def param_get( + self, + *, + x_ms_client_request_id: str, + **kwargs: Any + ) -> None: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -614,17 +851,23 @@ def param_get(self, *, x_ms_client_request_id: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xms_client_request_id_param_get_request( x_ms_client_request_id=x_ms_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -655,7 +898,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def post_method_global_valid(self, **kwargs: Any) -> None: + def post_method_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -663,17 +909,22 @@ def post_method_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_method_global_valid_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -684,8 +935,13 @@ def post_method_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_method_global_null(self, **kwargs: Any) -> None: + def post_method_global_null( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. @@ -693,17 +949,22 @@ def post_method_global_null(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_method_global_null_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -714,8 +975,13 @@ def post_method_global_null(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: + def post_method_global_not_provided_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -723,12 +989,15 @@ def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_subscription_in_credentials_post_method_global_not_provided_valid_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -736,7 +1005,9 @@ def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -747,8 +1018,13 @@ def post_method_global_not_provided_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_path_global_valid(self, **kwargs: Any) -> None: + def post_path_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -756,17 +1032,22 @@ def post_path_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_path_global_valid_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -777,8 +1058,13 @@ def post_path_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_swagger_global_valid(self, **kwargs: Any) -> None: + def post_swagger_global_valid( + self, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -786,17 +1072,22 @@ def post_swagger_global_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_credentials_post_swagger_global_valid_request( subscription_id=self._config.subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -827,7 +1118,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + def post_method_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -838,17 +1133,22 @@ def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_method_local_valid_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -859,8 +1159,14 @@ def post_method_local_valid(self, subscription_id: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> None: + def post_method_local_null( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. @@ -871,17 +1177,22 @@ def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_method_local_null_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -892,8 +1203,14 @@ def post_method_local_null(self, subscription_id: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + def post_path_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -903,17 +1220,22 @@ def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_path_local_valid_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -924,8 +1246,14 @@ def post_path_local_valid(self, subscription_id: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_swagger_local_valid(self, subscription_id: str, **kwargs: Any) -> None: + def post_swagger_local_valid( + self, + subscription_id: str, + **kwargs: Any + ) -> None: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -936,17 +1264,22 @@ def post_swagger_local_valid(self, subscription_id: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_subscription_in_method_post_swagger_local_valid_request( subscription_id=subscription_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -977,26 +1310,34 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_method_global_valid(self, **kwargs: Any) -> None: + def get_method_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_method_global_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1007,27 +1348,37 @@ def get_method_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_method_global_not_provided_valid(self, **kwargs: Any) -> None: + def get_method_global_not_provided_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_method_global_not_provided_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1038,27 +1389,37 @@ def get_method_global_not_provided_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_path_global_valid(self, **kwargs: Any) -> None: + def get_path_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_path_global_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1069,27 +1430,37 @@ def get_path_global_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_swagger_global_valid(self, **kwargs: Any) -> None: + def get_swagger_global_valid( + self, + **kwargs: Any + ) -> None: """GET method with api-version modeled in global settings. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-07-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-07-01-preview") # type: str + request = build_api_version_default_get_swagger_global_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1120,7 +1491,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_method_local_valid(self, **kwargs: Any) -> None: + def get_method_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: This should appear as a method parameter, use value '2.0'. The default @@ -1130,19 +1504,24 @@ def get_method_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_api_version_local_get_method_local_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1153,8 +1532,15 @@ def get_method_local_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_method_local_null(self, *, api_version: Optional[str] = None, **kwargs: Any) -> None: + def get_method_local_null( + self, + *, + api_version: Optional[str] = None, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = null to succeed. :keyword api_version: This should appear as a method parameter, use value null, this should @@ -1164,17 +1550,23 @@ def get_method_local_null(self, *, api_version: Optional[str] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_api_version_local_get_method_local_null_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1185,8 +1577,13 @@ def get_method_local_null(self, *, api_version: Optional[str] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_path_local_valid(self, **kwargs: Any) -> None: + def get_path_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: This should appear as a method parameter, use value '2.0'. The default @@ -1196,19 +1593,24 @@ def get_path_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_api_version_local_get_path_local_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1219,8 +1621,13 @@ def get_path_local_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_swagger_local_valid(self, **kwargs: Any) -> None: + def get_swagger_local_valid( + self, + **kwargs: Any + ) -> None: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. :keyword api_version: The api version, which appears in the query, the value is always '2.0'. @@ -1231,19 +1638,24 @@ def get_swagger_local_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2.0") # type: str + api_version = kwargs.pop('api_version', "2.0") # type: str + request = build_api_version_local_get_swagger_local_valid_request( api_version=api_version, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1274,7 +1686,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: + def get_method_path_valid( + self, + unencoded_path_param: str, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. @@ -1283,17 +1699,22 @@ def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_skip_url_encoding_get_method_path_valid_request( unencoded_path_param=unencoded_path_param, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1304,8 +1725,14 @@ def get_method_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: + def get_path_valid( + self, + unencoded_path_param: str, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. @@ -1314,17 +1741,22 @@ def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_skip_url_encoding_get_path_valid_request( unencoded_path_param=unencoded_path_param, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1335,8 +1767,13 @@ def get_path_valid(self, unencoded_path_param: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_swagger_path_valid(self, **kwargs: Any) -> None: + def get_swagger_path_valid( + self, + **kwargs: Any + ) -> None: """Get method with unencoded path parameter with value 'path1/path2/path3'. :keyword unencoded_path_param: An unencoded path parameter with value 'path1/path2/path3'. The @@ -1347,19 +1784,24 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - unencoded_path_param = kwargs.pop("unencoded_path_param", "path1/path2/path3") # type: str + unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str + request = build_skip_url_encoding_get_swagger_path_valid_request( unencoded_path_param=unencoded_path_param, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1370,8 +1812,15 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_method_query_valid(self, *, q1: str, **kwargs: Any) -> None: + def get_method_query_valid( + self, + *, + q1: str, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :keyword q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. @@ -1380,17 +1829,23 @@ def get_method_query_valid(self, *, q1: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_skip_url_encoding_get_method_query_valid_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1401,8 +1856,15 @@ def get_method_query_valid(self, *, q1: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_method_query_null(self, *, q1: Optional[str] = None, **kwargs: Any) -> None: + def get_method_query_null( + self, + *, + q1: Optional[str] = None, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value null. :keyword q1: Unencoded query parameter with value null. @@ -1411,17 +1873,23 @@ def get_method_query_null(self, *, q1: Optional[str] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_skip_url_encoding_get_method_query_null_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1432,8 +1900,15 @@ def get_method_query_null(self, *, q1: Optional[str] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: + def get_path_query_valid( + self, + *, + q1: str, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :keyword q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. @@ -1442,17 +1917,23 @@ def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_skip_url_encoding_get_path_query_valid_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1463,8 +1944,13 @@ def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_swagger_query_valid(self, **kwargs: Any) -> None: + def get_swagger_query_valid( + self, + **kwargs: Any + ) -> None: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. :keyword q1: An unencoded query parameter with value 'value1&q2=value2&q3=value3'. The default @@ -1475,19 +1961,24 @@ def get_swagger_query_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - q1 = kwargs.pop("q1", "value1&q2=value2&q3=value3") # type: str + q1 = kwargs.pop('q1', "value1&q2=value2&q3=value3") # type: str + request = build_skip_url_encoding_get_swagger_query_valid_request( q1=q1, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1519,7 +2010,12 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_with_filter( - self, *, filter: Optional[str] = None, top: Optional[int] = None, orderby: Optional[str] = None, **kwargs: Any + self, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any ) -> None: """Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. @@ -1533,10 +2029,14 @@ def get_with_filter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_odata_get_with_filter_request( filter=filter, top=top, @@ -1545,7 +2045,9 @@ def get_with_filter( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1576,7 +2078,12 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def custom_named_request_id(self, *, foo_client_request_id: str, **kwargs: Any) -> None: + def custom_named_request_id( + self, + *, + foo_client_request_id: str, + **kwargs: Any + ) -> None: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. :keyword foo_client_request_id: The fooRequestId. @@ -1585,17 +2092,23 @@ def custom_named_request_id(self, *, foo_client_request_id: str, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_custom_named_request_id_request( foo_client_request_id=foo_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1604,13 +2117,21 @@ def custom_named_request_id(self, *, foo_client_request_id: str, **kwargs: Any) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def custom_named_request_id_param_grouping(self, *, foo_client_request_id: str, **kwargs: Any) -> None: + def custom_named_request_id_param_grouping( + self, + *, + foo_client_request_id: str, + **kwargs: Any + ) -> None: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. @@ -1620,17 +2141,23 @@ def custom_named_request_id_param_grouping(self, *, foo_client_request_id: str, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_custom_named_request_id_param_grouping_request( foo_client_request_id=foo_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1639,13 +2166,21 @@ def custom_named_request_id_param_grouping(self, *, foo_client_request_id: str, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def custom_named_request_id_head(self, *, foo_client_request_id: str, **kwargs: Any) -> bool: + def custom_named_request_id_head( + self, + *, + foo_client_request_id: str, + **kwargs: Any + ) -> bool: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. :keyword foo_client_request_id: The fooRequestId. @@ -1654,17 +2189,23 @@ def custom_named_request_id_head(self, *, foo_client_request_id: str, **kwargs: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_custom_named_request_id_head_request( foo_client_request_id=foo_client_request_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1674,8 +2215,11 @@ def custom_named_request_id_head(self, *, foo_client_request_id: str, **kwargs: response_headers = {} if response.status_code == 200: - response_headers["foo-request-id"] = self._deserialize("str", response.headers.get("foo-request-id")) + response_headers['foo-request-id']=self._deserialize('str', response.headers.get('foo-request-id')) + if cls: return cls(pipeline_response, None, response_headers) return 200 <= response.status_code <= 299 + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py index 4bf95843e93..2b423533987 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py index bcd7bcd9fec..6ef996852a7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py index 33592190623..9e0e4796e72 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -30,8 +29,12 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -39,6 +42,7 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest @@ -63,7 +67,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py index 8d1336c7464..840dcb8cfa4 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py @@ -24,25 +24,30 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py index 0fe5782d645..3b422c27c1d 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient - -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py index 11fa28c9bd9..16da86035d5 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -30,8 +29,12 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -39,7 +42,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -59,7 +67,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py index 54699ce96b9..789b6e8a4d7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py index 43999a2ac80..d8955720c96 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py index 0af3687d327..b65dab33b42 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py @@ -8,24 +8,16 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ...operations._operations import build_paths_get_empty_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathsOperations: """PathsOperations async operations. @@ -45,7 +37,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_empty(self, account_name: str, **kwargs: Any) -> None: + async def get_empty( + self, + account_name: str, + **kwargs: Any + ) -> None: """Get a 200 to test a valid base uri. :param account_name: Account Name. @@ -54,19 +50,25 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_paths_get_empty_request() + + request = build_paths_get_empty_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -76,3 +78,5 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py index 43999a2ac80..d8955720c96 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py index 0d8c5f76933..5a93eea3f25 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py @@ -8,36 +8,34 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - -def build_paths_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_paths_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/customuri" + url = '/customuri' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class PathsOperations(object): """PathsOperations operations. @@ -58,7 +56,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_empty(self, account_name: str, **kwargs: Any) -> None: + def get_empty( + self, + account_name: str, + **kwargs: Any + ) -> None: """Get a 200 to test a valid base uri. :param account_name: Account Name. @@ -67,19 +69,25 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_paths_get_empty_request() + + request = build_paths_get_empty_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -89,3 +97,5 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index c250c733c08..63bc16d691a 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/__init__.py index e8e67b959c7..f0189aa1367 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_auto_rest_paging_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_auto_rest_paging_test_service.py index 62335efb18e..88595ba42de 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_auto_rest_paging_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_auto_rest_paging_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials import TokenCredential - class AutoRestPagingTestService: """Long-running Operation for AutoRest. @@ -37,9 +36,13 @@ class AutoRestPagingTestService: """ def __init__( - self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "TokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: - + self._config = AutoRestPagingTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -48,6 +51,7 @@ def __init__( self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_configuration.py index e63a0320267..76e660bf8ff 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_configuration.py @@ -29,30 +29,33 @@ class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable= :type credential: ~azure.core.credentials.TokenCredential """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "custompollerpagerversiontolerant/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'custompollerpagerversiontolerant/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/__init__.py index deb5dd54332..f9327b479e8 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_paging_test_service import AutoRestPagingTestService - -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_auto_rest_paging_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_auto_rest_paging_test_service.py index 3a15f2f133d..248f92afd5f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_auto_rest_paging_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_auto_rest_paging_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestPagingTestService: """Long-running Operation for AutoRest. @@ -37,7 +36,11 @@ class AutoRestPagingTestService: """ def __init__( - self, credential: "AsyncTokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestPagingTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -47,7 +50,12 @@ def __init__( self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_configuration.py index b1193ce69aa..48d61fb86f7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_configuration.py @@ -29,27 +29,32 @@ class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable= :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "custompollerpagerversiontolerant/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'custompollerpagerversiontolerant/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/__init__.py index 6ede331119b..221e79311bc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py index 258f4ff1b1a..3c0ddaf465e 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py @@ -9,13 +9,7 @@ from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncNoPolling, AsyncPollingMethod @@ -26,34 +20,11 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from custompollerpagerdefinitions.aio import AsyncCustomPager, AsyncCustomPoller -from ...operations._operations import ( - build_paging_first_response_empty_request, - build_paging_get_multiple_pages_failure_request, - build_paging_get_multiple_pages_failure_uri_request, - build_paging_get_multiple_pages_fragment_next_link_request, - build_paging_get_multiple_pages_fragment_with_grouping_next_link_request, - build_paging_get_multiple_pages_lro_request_initial, - build_paging_get_multiple_pages_request, - build_paging_get_multiple_pages_retry_first_request, - build_paging_get_multiple_pages_retry_second_request, - build_paging_get_multiple_pages_with_offset_request, - build_paging_get_no_item_name_pages_request, - build_paging_get_null_next_link_name_pages_request, - build_paging_get_odata_multiple_pages_request, - build_paging_get_paging_model_with_item_name_with_xms_client_name_request, - build_paging_get_single_pages_failure_request, - build_paging_get_single_pages_request, - build_paging_get_with_query_params_request, - build_paging_next_fragment_request, - build_paging_next_fragment_with_grouping_request, - build_paging_next_operation_with_query_params_request, -) - -T = TypeVar("T") +from ...operations._operations import build_paging_first_response_empty_request, build_paging_get_multiple_pages_failure_request, build_paging_get_multiple_pages_failure_uri_request, build_paging_get_multiple_pages_fragment_next_link_request, build_paging_get_multiple_pages_fragment_with_grouping_next_link_request, build_paging_get_multiple_pages_lro_request_initial, build_paging_get_multiple_pages_request, build_paging_get_multiple_pages_retry_first_request, build_paging_get_multiple_pages_retry_second_request, build_paging_get_multiple_pages_with_offset_request, build_paging_get_no_item_name_pages_request, build_paging_get_null_next_link_name_pages_request, build_paging_get_odata_multiple_pages_request, build_paging_get_paging_model_with_item_name_with_xms_client_name_request, build_paging_get_single_pages_failure_request, build_paging_get_single_pages_request, build_paging_get_with_query_params_request, build_paging_next_fragment_request, build_paging_next_fragment_with_grouping_request, build_paging_next_operation_with_query_params_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PagingOperations: """PagingOperations async operations. @@ -73,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace - def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_no_item_name_pages( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object @@ -96,19 +70,22 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -124,7 +101,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -134,10 +113,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_null_next_link_name_pages( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object @@ -160,19 +146,22 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -188,7 +177,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -198,10 +189,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_single_pages( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object @@ -224,19 +222,22 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -252,7 +253,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -262,10 +265,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncCustomPager(get_next, extract_data) + + return AsyncCustomPager( + get_next, extract_data + ) + @distributed_trace - def first_response_empty(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def first_response_empty( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. @@ -289,19 +299,22 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -317,7 +330,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -327,7 +342,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages( @@ -367,13 +386,14 @@ def get_multiple_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -382,7 +402,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -403,7 +423,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -413,10 +435,19 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_with_query_params( + self, + *, + required_query_parameter: int, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -447,15 +478,16 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) ] } """ - query_constant = kwargs.pop("query_constant", True) # type: bool - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + query_constant = kwargs.pop('query_constant', True) # type: bool + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_with_query_params_request( query_constant=query_constant, required_query_parameter=required_query_parameter, @@ -463,7 +495,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_operation_with_query_params_request( query_constant=query_constant, ) @@ -482,7 +514,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -492,7 +526,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_odata_multiple_pages( @@ -532,13 +570,14 @@ def get_odata_multiple_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -547,7 +586,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -568,7 +607,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -578,7 +619,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_with_offset( @@ -621,13 +666,14 @@ def get_multiple_pages_with_offset( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -637,7 +683,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -659,7 +705,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -669,10 +717,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_retry_first( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. @@ -696,19 +751,22 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[JSONTyp ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -724,7 +782,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -734,10 +794,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_retry_second( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. @@ -761,19 +828,22 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[JSONTy ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -789,7 +859,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -799,10 +871,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_single_pages_failure( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object @@ -825,19 +904,22 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -853,7 +935,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -863,10 +947,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_failure( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object @@ -889,19 +980,22 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -917,7 +1011,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -927,10 +1023,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_failure_uri( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object @@ -953,19 +1056,22 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[JSONTyp ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -981,7 +1087,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -991,11 +1099,19 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment. @@ -1023,13 +1139,14 @@ def get_multiple_pages_fragment_next_link( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_next_link_request( tenant=tenant, api_version=api_version, @@ -1037,7 +1154,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_request( tenant=tenant, next_link=next_link, @@ -1058,7 +1175,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1068,11 +1187,19 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_with_grouping_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. @@ -1100,13 +1227,14 @@ def get_multiple_pages_fragment_with_grouping_next_link( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_with_grouping_next_link_request( tenant=tenant, api_version=api_version, @@ -1114,7 +1242,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_with_grouping_request( tenant=tenant, next_link=next_link, @@ -1135,7 +1263,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1145,7 +1275,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + async def _get_multiple_pages_lro_initial( self, @@ -1155,10 +1289,13 @@ async def _get_multiple_pages_lro_initial( timeout: Optional[int] = 30, **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1167,7 +1304,9 @@ async def _get_multiple_pages_lro_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1185,6 +1324,8 @@ async def _get_multiple_pages_lro_initial( return deserialized + + @distributed_trace_async async def begin_get_multiple_pages_lro( self, @@ -1216,13 +1357,14 @@ async def begin_get_multiple_pages_lro( :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1231,7 +1373,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1252,7 +1394,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1262,19 +1406,23 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._get_multiple_pages_lro_initial( client_request_id=client_request_id, maxresults=maxresults, timeout=timeout, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): @@ -1282,25 +1430,29 @@ async def internal_get_next(next_link=None): return pipeline_response return await get_next(next_link) - return AsyncItemPaged(internal_get_next, extract_data) + return AsyncItemPaged( + internal_get_next, extract_data + ) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncCustomPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncCustomPoller(self._client, raw_result, get_long_running_output, polling_method) + + @distributed_trace - def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_paging_model_with_item_name_with_xms_client_name( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. @@ -1324,19 +1476,22 @@ def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1352,7 +1507,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1362,4 +1519,8 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/__init__.py index 6ede331119b..221e79311bc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py index f532112e858..f8b80467162 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -27,61 +21,87 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_paging_get_no_item_name_pages_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_no_item_name_pages_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/noitemname" + url = '/paging/noitemname' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_null_next_link_name_pages_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_null_next_link_name_pages_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/nullnextlink" + url = '/paging/nullnextlink' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_single_pages_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_single_pages_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/single" + url = '/paging/single' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_first_response_empty_request(**kwargs: Any) -> HttpRequest: +def build_paging_first_response_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/firstResponseEmpty/1" + url = '/paging/firstResponseEmpty/1' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_request( @@ -93,58 +113,79 @@ def build_paging_get_multiple_pages_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple" + url = '/paging/multiple' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_with_query_params_request(*, required_query_parameter: int, **kwargs: Any) -> HttpRequest: - query_constant = kwargs.pop("query_constant", True) # type: bool +def build_paging_get_with_query_params_request( + *, + required_query_parameter: int, + **kwargs: Any +) -> HttpRequest: + query_constant = kwargs.pop('query_constant', True) # type: bool accept = "application/json" # Construct URL - url = "/paging/multiple/getWithQueryParams" + url = '/paging/multiple/getWithQueryParams' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["requiredQueryParameter"] = _SERIALIZER.query( - "required_query_parameter", required_query_parameter, "int" - ) - query_parameters["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") + query_parameters['requiredQueryParameter'] = _SERIALIZER.query("required_query_parameter", required_query_parameter, 'int') + query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_paging_next_operation_with_query_params_request(**kwargs: Any) -> HttpRequest: - query_constant = kwargs.pop("query_constant", True) # type: bool +def build_paging_next_operation_with_query_params_request( + **kwargs: Any +) -> HttpRequest: + query_constant = kwargs.pop('query_constant', True) # type: bool accept = "application/json" # Construct URL - url = "/paging/multiple/nextOperationWithQueryParams" + url = '/paging/multiple/nextOperationWithQueryParams' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") + query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_get_odata_multiple_pages_request( @@ -156,19 +197,24 @@ def build_paging_get_odata_multiple_pages_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/odata" + url = '/paging/multiple/odata' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_with_offset_request( @@ -181,9 +227,9 @@ def build_paging_get_multiple_pages_with_offset_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/withpath/{offset}" + url = '/paging/multiple/withpath/{offset}' path_format_arguments = { - "offset": _SERIALIZER.url("offset", offset, "int"), + "offset": _SERIALIZER.url("offset", offset, 'int'), } url = _format_url_section(url, **path_format_arguments) @@ -191,120 +237,178 @@ def build_paging_get_multiple_pages_with_offset_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_retry_first_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_retry_first_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/retryfirst" + url = '/paging/multiple/retryfirst' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_retry_second_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_retry_second_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/retrysecond" + url = '/paging/multiple/retrysecond' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_single_pages_failure_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_single_pages_failure_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/single/failure" + url = '/paging/single/failure' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_failure_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_failure_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/failure" + url = '/paging/multiple/failure' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_failure_uri_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_failure_uri_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/failureuri" + url = '/paging/multiple/failureuri' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_fragment_next_link_request( - tenant: str, *, api_version: str, **kwargs: Any + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragment/{tenant}" + url = '/paging/multiple/fragment/{tenant}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_fragment_with_grouping_next_link_request( - tenant: str, *, api_version: str, **kwargs: Any + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragmentwithgrouping/{tenant}" + url = '/paging/multiple/fragmentwithgrouping/{tenant}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_lro_request_initial( @@ -316,78 +420,111 @@ def build_paging_get_multiple_pages_lro_request_initial( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/lro" + url = '/paging/multiple/lro' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_next_fragment_request(tenant: str, next_link: str, *, api_version: str, **kwargs: Any) -> HttpRequest: +def build_paging_next_fragment_request( + tenant: str, + next_link: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragment/{tenant}/{nextLink}" + url = '/paging/multiple/fragment/{tenant}/{nextLink}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_next_fragment_with_grouping_request( - tenant: str, next_link: str, *, api_version: str, **kwargs: Any + tenant: str, + next_link: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}" + url = '/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_paging_get_paging_model_with_item_name_with_xms_client_name_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/itemNameWithXMSClientName" + url = '/paging/itemNameWithXMSClientName' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class PagingOperations(object): """PagingOperations operations. @@ -408,7 +545,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_no_item_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: + def get_no_item_name_pages( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object @@ -431,19 +571,22 @@ def get_no_item_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -459,7 +602,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -469,10 +614,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: + def get_null_next_link_name_pages( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object @@ -495,19 +647,22 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -523,7 +678,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -533,10 +690,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages(self, **kwargs: Any) -> Iterable[JSONType]: + def get_single_pages( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object @@ -559,19 +723,22 @@ def get_single_pages(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -587,7 +754,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -597,10 +766,17 @@ def get_next(next_link=None): return pipeline_response - return CustomPager(get_next, extract_data) + + return CustomPager( + get_next, extract_data + ) + @distributed_trace - def first_response_empty(self, **kwargs: Any) -> Iterable[JSONType]: + def first_response_empty( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. @@ -624,19 +800,22 @@ def first_response_empty(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -652,7 +831,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -662,7 +843,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages( @@ -702,14 +887,15 @@ def get_multiple_pages( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -718,7 +904,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -739,7 +925,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -749,10 +937,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) -> Iterable[JSONType]: + def get_with_query_params( + self, + *, + required_query_parameter: int, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -783,15 +980,16 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) ] } """ - query_constant = kwargs.pop("query_constant", True) # type: bool - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + query_constant = kwargs.pop('query_constant', True) # type: bool + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_with_query_params_request( query_constant=query_constant, required_query_parameter=required_query_parameter, @@ -799,7 +997,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_operation_with_query_params_request( query_constant=query_constant, ) @@ -818,7 +1016,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -828,7 +1028,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_odata_multiple_pages( @@ -868,14 +1072,15 @@ def get_odata_multiple_pages( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -884,7 +1089,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -905,7 +1110,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -915,7 +1122,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_with_offset( @@ -958,14 +1169,15 @@ def get_multiple_pages_with_offset( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -975,7 +1187,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -997,7 +1209,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1007,10 +1221,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_retry_first( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. @@ -1034,19 +1255,22 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1062,7 +1286,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1072,10 +1298,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_retry_second( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. @@ -1099,19 +1332,22 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1127,7 +1363,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1137,10 +1375,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: + def get_single_pages_failure( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object @@ -1163,19 +1408,22 @@ def get_single_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1191,7 +1439,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1201,10 +1451,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_failure( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object @@ -1227,19 +1484,22 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1255,7 +1515,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1265,10 +1527,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_failure_uri( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object @@ -1291,19 +1560,22 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1319,7 +1591,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1329,11 +1603,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> Iterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment. @@ -1361,14 +1643,15 @@ def get_multiple_pages_fragment_next_link( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_next_link_request( tenant=tenant, api_version=api_version, @@ -1376,7 +1659,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_request( tenant=tenant, next_link=next_link, @@ -1397,7 +1680,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1407,11 +1692,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_with_grouping_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> Iterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. @@ -1439,14 +1732,15 @@ def get_multiple_pages_fragment_with_grouping_next_link( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_with_grouping_next_link_request( tenant=tenant, api_version=api_version, @@ -1454,7 +1748,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_with_grouping_request( tenant=tenant, next_link=next_link, @@ -1475,7 +1769,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1485,7 +1781,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + def _get_multiple_pages_lro_initial( self, @@ -1495,10 +1795,14 @@ def _get_multiple_pages_lro_initial( timeout: Optional[int] = 30, **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1507,7 +1811,9 @@ def _get_multiple_pages_lro_initial( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1525,6 +1831,8 @@ def _get_multiple_pages_lro_initial( return deserialized + + @distributed_trace def begin_get_multiple_pages_lro( self, @@ -1555,13 +1863,15 @@ def begin_get_multiple_pages_lro( :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1570,7 +1880,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1591,7 +1901,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1601,19 +1913,23 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._get_multiple_pages_lro_initial( client_request_id=client_request_id, maxresults=maxresults, timeout=timeout, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): @@ -1621,25 +1937,29 @@ def internal_get_next(next_link=None): return pipeline_response return get_next(next_link) - return ItemPaged(internal_get_next, extract_data) + return ItemPaged( + internal_get_next, extract_data + ) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return CustomPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return CustomPoller(self._client, raw_result, get_long_running_output, polling_method) + + @distributed_trace - def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> Iterable[JSONType]: + def get_paging_model_with_item_name_with_xms_client_name( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. @@ -1663,19 +1983,22 @@ def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1691,7 +2014,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1701,4 +2026,8 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py index 2c9524810fd..e0dcf6c55af 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Long-running Operation for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/__init__.py index 7ce1af93032..cd76db4da70 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestPagingClient"] +__all__ = ['AutoRestParameterizedHostTestPagingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_auto_rest_parameterized_host_test_paging_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_auto_rest_parameterized_host_test_paging_client.py index c91d51f53ba..3a80754ca77 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_auto_rest_parameterized_host_test_paging_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_auto_rest_parameterized_host_test_paging_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestPagingClient: """Test Infrastructure for AutoRest. @@ -30,8 +29,12 @@ class AutoRestParameterizedHostTestPagingClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestPagingClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -40,6 +43,7 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest @@ -64,7 +68,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_configuration.py index 732afe7bb50..e8c7573945e 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_configuration.py @@ -14,9 +14,7 @@ from ._version import VERSION -class AutoRestParameterizedHostTestPagingClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestPagingClient. Note that all parameters used to create this instance are saved as instance @@ -26,25 +24,30 @@ class AutoRestParameterizedHostTestPagingClientConfiguration( :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestPagingClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestpagingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestpagingclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/__init__.py index fa406e9634b..d6de8164bf5 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_paging_client import AutoRestParameterizedHostTestPagingClient - -__all__ = ["AutoRestParameterizedHostTestPagingClient"] +__all__ = ['AutoRestParameterizedHostTestPagingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_auto_rest_parameterized_host_test_paging_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_auto_rest_parameterized_host_test_paging_client.py index 1ae66d017c0..5c6063be4da 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_auto_rest_parameterized_host_test_paging_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_auto_rest_parameterized_host_test_paging_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestPagingClient: """Test Infrastructure for AutoRest. @@ -30,8 +29,12 @@ class AutoRestParameterizedHostTestPagingClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestPagingClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -40,7 +43,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -60,7 +68,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_configuration.py index 70d4ecdd326..bb844c63f9e 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_configuration.py @@ -14,9 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedHostTestPagingClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestParameterizedHostTestPagingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestPagingClient. Note that all parameters used to create this instance are saved as instance @@ -26,22 +24,29 @@ class AutoRestParameterizedHostTestPagingClientConfiguration( :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestPagingClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestpagingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestpagingclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/__init__.py index 6ede331119b..221e79311bc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py index 0e559ca2bea..b10e8169e00 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py @@ -9,29 +9,17 @@ from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from ...operations._operations import ( - build_paging_get_pages_partial_url_operation_next_request, - build_paging_get_pages_partial_url_operation_request, - build_paging_get_pages_partial_url_request, -) - -T = TypeVar("T") +from ...operations._operations import build_paging_get_pages_partial_url_operation_next_request, build_paging_get_pages_partial_url_operation_request, build_paging_get_pages_partial_url_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PagingOperations: """PagingOperations async operations. @@ -51,7 +39,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace - def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_pages_partial_url( + self, + account_name: str, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that combines custom url, paging and partial URL and expect to concat after host. @@ -77,32 +69,35 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterab ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_pages_partial_url_request() + + request = build_paging_get_pages_partial_url_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - - request = build_paging_get_pages_partial_url_request() + + request = build_paging_get_pages_partial_url_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(next_link, **path_format_arguments) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.method = "GET" return request @@ -118,7 +113,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -128,10 +125,18 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_pages_partial_url_operation( + self, + account_name: str, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that combines custom url, paging and partial URL with next operation. :param account_name: Account Name. @@ -156,28 +161,30 @@ def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> A ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_pages_partial_url_operation_request() + + request = build_paging_get_pages_partial_url_operation_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - + request = build_paging_get_pages_partial_url_operation_next_request( next_link=next_link, ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) @@ -194,7 +201,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -204,4 +213,8 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/__init__.py index 6ede331119b..221e79311bc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py index 69886974bed..ace0b5f5d8a 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -23,55 +17,74 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_paging_get_pages_partial_url_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_pages_partial_url_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/customurl/partialnextlink" + url = '/paging/customurl/partialnextlink' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_pages_partial_url_operation_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_pages_partial_url_operation_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/customurl/partialnextlinkop" + url = '/paging/customurl/partialnextlinkop' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_pages_partial_url_operation_next_request(next_link: str, **kwargs: Any) -> HttpRequest: +def build_paging_get_pages_partial_url_operation_next_request( + next_link: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/customurl/{nextLink}" + url = '/paging/customurl/{nextLink}' path_format_arguments = { - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class PagingOperations(object): """PagingOperations operations. @@ -92,7 +105,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> Iterable[JSONType]: + def get_pages_partial_url( + self, + account_name: str, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that combines custom url, paging and partial URL and expect to concat after host. @@ -118,32 +135,35 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> Iterable[JS ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_pages_partial_url_request() + + request = build_paging_get_pages_partial_url_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - - request = build_paging_get_pages_partial_url_request() + + request = build_paging_get_pages_partial_url_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(next_link, **path_format_arguments) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.method = "GET" return request @@ -159,7 +179,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -169,10 +191,18 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> Iterable[JSONType]: + def get_pages_partial_url_operation( + self, + account_name: str, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that combines custom url, paging and partial URL with next operation. :param account_name: Account Name. @@ -197,28 +227,30 @@ def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> I ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_pages_partial_url_operation_request() + + request = build_paging_get_pages_partial_url_operation_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) else: - + request = build_paging_get_pages_partial_url_operation_next_request( next_link=next_link, ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) @@ -235,7 +267,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -245,4 +279,8 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py index 8dd0ffbcbef..647deb3a8e6 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/__init__.py index 6064aa40bfd..407776c5bac 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHeadExceptionTestService"] +__all__ = ['AutoRestHeadExceptionTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_auto_rest_head_exception_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_auto_rest_head_exception_test_service.py index 39c89baa7e4..7586c1c21d3 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_auto_rest_head_exception_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_auto_rest_head_exception_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials import TokenCredential - class AutoRestHeadExceptionTestService: """Test Infrastructure for AutoRest. @@ -35,9 +34,13 @@ class AutoRestHeadExceptionTestService: """ def __init__( - self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "TokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: - + self._config = AutoRestHeadExceptionTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -46,6 +49,7 @@ def __init__( self._serialize.client_side_validation = False self.head_exception = HeadExceptionOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_configuration.py index 4413715922f..1c336e64447 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_configuration.py @@ -29,30 +29,33 @@ class AutoRestHeadExceptionTestServiceConfiguration(Configuration): # pylint: d :type credential: ~azure.core.credentials.TokenCredential """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadExceptionTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadexceptiontestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadexceptiontestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/__init__.py index 828b2a86e01..7a28607d182 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_head_exception_test_service import AutoRestHeadExceptionTestService - -__all__ = ["AutoRestHeadExceptionTestService"] +__all__ = ['AutoRestHeadExceptionTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_auto_rest_head_exception_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_auto_rest_head_exception_test_service.py index 9db04968d01..c771ca23f70 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_auto_rest_head_exception_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_auto_rest_head_exception_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestHeadExceptionTestService: """Test Infrastructure for AutoRest. @@ -35,7 +34,11 @@ class AutoRestHeadExceptionTestService: """ def __init__( - self, credential: "AsyncTokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestHeadExceptionTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -45,7 +48,12 @@ def __init__( self._serialize.client_side_validation = False self.head_exception = HeadExceptionOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_configuration.py index cac7a3ff8c9..b21528dab5f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_configuration.py @@ -29,27 +29,32 @@ class AutoRestHeadExceptionTestServiceConfiguration(Configuration): # pylint: d :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadExceptionTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadexceptiontestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadexceptiontestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/__init__.py index 2e48bc421d0..907c1b56729 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import HeadExceptionOperations __all__ = [ - "HeadExceptionOperations", + 'HeadExceptionOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py index 477ab94c844..70cd03790b9 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py @@ -8,29 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ...operations._operations import ( - build_head_exception_head200_request, - build_head_exception_head204_request, - build_head_exception_head404_request, -) - -T = TypeVar("T") +from ...operations._operations import build_head_exception_head200_request, build_head_exception_head204_request, build_head_exception_head404_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HeadExceptionOperations: """HeadExceptionOperations async operations. @@ -50,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head200(self, **kwargs: Any) -> bool: + async def head200( + self, + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_head_exception_head200_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_head_exception_head200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -77,23 +74,34 @@ async def head200(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace_async - async def head204(self, **kwargs: Any) -> bool: + async def head204( + self, + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_head_exception_head204_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_head_exception_head204_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -105,23 +113,34 @@ async def head204(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace_async - async def head404(self, **kwargs: Any) -> bool: + async def head404( + self, + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_head_exception_head404_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_head_exception_head404_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -132,3 +151,5 @@ async def head404(self, **kwargs: Any) -> bool: if cls: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/__init__.py index 2e48bc421d0..907c1b56729 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import HeadExceptionOperations __all__ = [ - "HeadExceptionOperations", + 'HeadExceptionOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py index fcac871b130..6cef2d3332d 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py @@ -8,47 +8,56 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_head_exception_head200_request(**kwargs: Any) -> HttpRequest: +def build_head_exception_head200_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/success/200" + url = '/http/success/200' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_head_exception_head204_request(**kwargs: Any) -> HttpRequest: +def build_head_exception_head204_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/success/204" + url = '/http/success/204' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_head_exception_head404_request(**kwargs: Any) -> HttpRequest: +def build_head_exception_head404_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/success/404" - - return HttpRequest(method="HEAD", url=url, **kwargs) + url = '/http/success/404' + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) class HeadExceptionOperations(object): """HeadExceptionOperations operations. @@ -69,22 +78,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head200(self, **kwargs: Any) -> bool: + def head200( + self, + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_head_exception_head200_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_head_exception_head200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -96,23 +114,34 @@ def head200(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace - def head204(self, **kwargs: Any) -> bool: + def head204( + self, + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_head_exception_head204_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_head_exception_head204_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -124,23 +153,34 @@ def head204(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace - def head404(self, **kwargs: Any) -> bool: + def head404( + self, + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_head_exception_head404_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_head_exception_head404_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -151,3 +191,5 @@ def head404(self, **kwargs: Any) -> bool: if cls: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py index 70236538118..5914b6853f9 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/__init__.py index 2a478ab434d..821fa23f191 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_auto_rest_head_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_auto_rest_head_test_service.py index 0805a82224d..e9354af22f1 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_auto_rest_head_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_auto_rest_head_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials import TokenCredential - class AutoRestHeadTestService: """Test Infrastructure for AutoRest. @@ -35,9 +34,13 @@ class AutoRestHeadTestService: """ def __init__( - self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "TokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: - + self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -46,6 +49,7 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_configuration.py index 59b7a0f543f..04d1229907c 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_configuration.py @@ -29,30 +29,33 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to :type credential: ~azure.core.credentials.TokenCredential """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/__init__.py index 6c3806fafee..c8c7dee1857 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_head_test_service import AutoRestHeadTestService - -__all__ = ["AutoRestHeadTestService"] +__all__ = ['AutoRestHeadTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_auto_rest_head_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_auto_rest_head_test_service.py index a36ef1d36a1..ac2003a3711 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_auto_rest_head_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_auto_rest_head_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestHeadTestService: """Test Infrastructure for AutoRest. @@ -35,7 +34,11 @@ class AutoRestHeadTestService: """ def __init__( - self, credential: "AsyncTokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -45,7 +48,12 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_configuration.py index c70f8eb34d9..2d2fa5415ae 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_configuration.py @@ -29,27 +29,32 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestheadtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestheadtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/__init__.py index 6e54d421939..2295c888f47 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import HttpSuccessOperations __all__ = [ - "HttpSuccessOperations", + 'HttpSuccessOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py index 20ac7d646cb..fddad63f552 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py @@ -8,29 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ...operations._operations import ( - build_http_success_head200_request, - build_http_success_head204_request, - build_http_success_head404_request, -) - -T = TypeVar("T") +from ...operations._operations import build_http_success_head200_request, build_http_success_head204_request, build_http_success_head404_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpSuccessOperations: """HttpSuccessOperations async operations. @@ -50,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head200(self, **kwargs: Any) -> bool: + async def head200( + self, + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_http_success_head200_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_http_success_head200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -77,23 +74,34 @@ async def head200(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace_async - async def head204(self, **kwargs: Any) -> bool: + async def head204( + self, + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_http_success_head204_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_http_success_head204_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -105,23 +113,34 @@ async def head204(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace_async - async def head404(self, **kwargs: Any) -> bool: + async def head404( + self, + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_http_success_head404_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_http_success_head404_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -132,3 +151,5 @@ async def head404(self, **kwargs: Any) -> bool: if cls: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/__init__.py index 6e54d421939..2295c888f47 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import HttpSuccessOperations __all__ = [ - "HttpSuccessOperations", + 'HttpSuccessOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py index bd5b7949f0a..435f6cadb23 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py @@ -8,47 +8,56 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_http_success_head200_request(**kwargs: Any) -> HttpRequest: +def build_http_success_head200_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/success/200" + url = '/http/success/200' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_http_success_head204_request(**kwargs: Any) -> HttpRequest: +def build_http_success_head204_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/success/204" + url = '/http/success/204' - return HttpRequest(method="HEAD", url=url, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) -def build_http_success_head404_request(**kwargs: Any) -> HttpRequest: +def build_http_success_head404_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/success/404" - - return HttpRequest(method="HEAD", url=url, **kwargs) + url = '/http/success/404' + return HttpRequest( + method="HEAD", + url=url, + **kwargs + ) class HttpSuccessOperations(object): """HttpSuccessOperations operations. @@ -69,22 +78,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head200(self, **kwargs: Any) -> bool: + def head200( + self, + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_http_success_head200_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_http_success_head200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -96,23 +114,34 @@ def head200(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace - def head204(self, **kwargs: Any) -> bool: + def head204( + self, + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_http_success_head204_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_http_success_head204_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -124,23 +153,34 @@ def head204(self, **kwargs: Any) -> bool: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + @distributed_trace - def head404(self, **kwargs: Any) -> bool: + def head404( + self, + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_http_success_head404_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_http_success_head404_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -151,3 +191,5 @@ def head404(self, **kwargs: Any) -> bool: if cls: return cls(pipeline_response, None, {}) return 200 <= response.status_code <= 299 + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py index 131cedf730b..cd62e3d4daa 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/__init__.py index 7ece5ec6c91..fa45fce0e43 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestLongRunningOperationTestService"] +__all__ = ['AutoRestLongRunningOperationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_auto_rest_long_running_operation_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_auto_rest_long_running_operation_test_service.py index 914ebe04aeb..a6a88c0a670 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_auto_rest_long_running_operation_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_auto_rest_long_running_operation_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials import TokenCredential - class AutoRestLongRunningOperationTestService: """Long-running Operation for AutoRest. @@ -43,9 +42,13 @@ class AutoRestLongRunningOperationTestService: """ def __init__( - self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "TokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: - + self._config = AutoRestLongRunningOperationTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -55,9 +58,8 @@ def __init__( self.lros = LROsOperations(self._client, self._config, self._serialize, self._deserialize) self.lro_retrys = LRORetrysOperations(self._client, self._config, self._serialize, self._deserialize) self.lrosads = LROSADsOperations(self._client, self._config, self._serialize, self._deserialize) - self.lr_os_custom_header = LROsCustomHeaderOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.lr_os_custom_header = LROsCustomHeaderOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_configuration.py index 0a5bfd558ec..5af259c0e92 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_configuration.py @@ -19,9 +19,7 @@ from azure.core.credentials import TokenCredential -class AutoRestLongRunningOperationTestServiceConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestLongRunningOperationTestService. Note that all parameters used to create this instance are saved as instance @@ -31,30 +29,33 @@ class AutoRestLongRunningOperationTestServiceConfiguration( :type credential: ~azure.core.credentials.TokenCredential """ - def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestLongRunningOperationTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestlongrunningoperationtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestlongrunningoperationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/__init__.py index 059561b117f..662ae8ef026 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_long_running_operation_test_service import AutoRestLongRunningOperationTestService - -__all__ = ["AutoRestLongRunningOperationTestService"] +__all__ = ['AutoRestLongRunningOperationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_auto_rest_long_running_operation_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_auto_rest_long_running_operation_test_service.py index 7e1a4585676..43ce03917df 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_auto_rest_long_running_operation_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_auto_rest_long_running_operation_test_service.py @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class AutoRestLongRunningOperationTestService: """Long-running Operation for AutoRest. @@ -43,7 +42,11 @@ class AutoRestLongRunningOperationTestService: """ def __init__( - self, credential: "AsyncTokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, + credential: "AsyncTokenCredential", + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any ) -> None: self._config = AutoRestLongRunningOperationTestServiceConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -54,11 +57,14 @@ def __init__( self.lros = LROsOperations(self._client, self._config, self._serialize, self._deserialize) self.lro_retrys = LRORetrysOperations(self._client, self._config, self._serialize, self._deserialize) self.lrosads = LROSADsOperations(self._client, self._config, self._serialize, self._deserialize) - self.lr_os_custom_header = LROsCustomHeaderOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.lr_os_custom_header = LROsCustomHeaderOperations(self._client, self._config, self._serialize, self._deserialize) + - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_configuration.py index 95cdfa836ad..d4d5e011886 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_configuration.py @@ -19,9 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AutoRestLongRunningOperationTestServiceConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestLongRunningOperationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestLongRunningOperationTestService. Note that all parameters used to create this instance are saved as instance @@ -31,27 +29,32 @@ class AutoRestLongRunningOperationTestServiceConfiguration( :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ - def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(AutoRestLongRunningOperationTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") self.credential = credential - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "autorestlongrunningoperationtestservice/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'autorestlongrunningoperationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/__init__.py index bef3a3f9d72..167c26f30aa 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/__init__.py @@ -12,8 +12,8 @@ from ._operations import LROsCustomHeaderOperations __all__ = [ - "LROsOperations", - "LRORetrysOperations", - "LROSADsOperations", - "LROsCustomHeaderOperations", + 'LROsOperations', + 'LRORetrysOperations', + 'LROSADsOperations', + 'LROsCustomHeaderOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py index 1a07cb6ca0f..78682470d56 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -23,95 +17,11 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ...operations._operations import ( - build_lr_os_custom_header_post202_retry200_request_initial, - build_lr_os_custom_header_post_async_retry_succeeded_request_initial, - build_lr_os_custom_header_put201_creating_succeeded200_request_initial, - build_lr_os_custom_header_put_async_retry_succeeded_request_initial, - build_lro_retrys_delete202_retry200_request_initial, - build_lro_retrys_delete_async_relative_retry_succeeded_request_initial, - build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial, - build_lro_retrys_post202_retry200_request_initial, - build_lro_retrys_post_async_relative_retry_succeeded_request_initial, - build_lro_retrys_put201_creating_succeeded200_request_initial, - build_lro_retrys_put_async_relative_retry_succeeded_request_initial, - build_lros_delete202_no_retry204_request_initial, - build_lros_delete202_retry200_request_initial, - build_lros_delete204_succeeded_request_initial, - build_lros_delete_async_no_header_in_retry_request_initial, - build_lros_delete_async_no_retry_succeeded_request_initial, - build_lros_delete_async_retry_failed_request_initial, - build_lros_delete_async_retry_succeeded_request_initial, - build_lros_delete_async_retrycanceled_request_initial, - build_lros_delete_no_header_in_retry_request_initial, - build_lros_delete_provisioning202_accepted200_succeeded_request_initial, - build_lros_delete_provisioning202_deleting_failed200_request_initial, - build_lros_delete_provisioning202_deletingcanceled200_request_initial, - build_lros_patch200_succeeded_ignore_headers_request_initial, - build_lros_patch201_retry_with_async_header_request_initial, - build_lros_patch202_retry_with_async_and_location_header_request_initial, - build_lros_post200_with_payload_request_initial, - build_lros_post202_list_request_initial, - build_lros_post202_no_retry204_request_initial, - build_lros_post202_retry200_request_initial, - build_lros_post_async_no_retry_succeeded_request_initial, - build_lros_post_async_retry_failed_request_initial, - build_lros_post_async_retry_succeeded_request_initial, - build_lros_post_async_retrycanceled_request_initial, - build_lros_post_double_headers_final_azure_header_get_default_request_initial, - build_lros_post_double_headers_final_azure_header_get_request_initial, - build_lros_post_double_headers_final_location_get_request_initial, - build_lros_put200_acceptedcanceled200_request_initial, - build_lros_put200_succeeded_no_state_request_initial, - build_lros_put200_succeeded_request_initial, - build_lros_put200_updating_succeeded204_request_initial, - build_lros_put201_creating_failed200_request_initial, - build_lros_put201_creating_succeeded200_request_initial, - build_lros_put201_succeeded_request_initial, - build_lros_put202_retry200_request_initial, - build_lros_put_async_no_header_in_retry_request_initial, - build_lros_put_async_no_retry_succeeded_request_initial, - build_lros_put_async_no_retrycanceled_request_initial, - build_lros_put_async_non_resource_request_initial, - build_lros_put_async_retry_failed_request_initial, - build_lros_put_async_retry_succeeded_request_initial, - build_lros_put_async_sub_resource_request_initial, - build_lros_put_no_header_in_retry_request_initial, - build_lros_put_non_resource_request_initial, - build_lros_put_sub_resource_request_initial, - build_lrosads_delete202_non_retry400_request_initial, - build_lrosads_delete202_retry_invalid_header_request_initial, - build_lrosads_delete204_succeeded_request_initial, - build_lrosads_delete_async_relative_retry400_request_initial, - build_lrosads_delete_async_relative_retry_invalid_header_request_initial, - build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial, - build_lrosads_delete_async_relative_retry_no_status_request_initial, - build_lrosads_delete_non_retry400_request_initial, - build_lrosads_post202_no_location_request_initial, - build_lrosads_post202_non_retry400_request_initial, - build_lrosads_post202_retry_invalid_header_request_initial, - build_lrosads_post_async_relative_retry400_request_initial, - build_lrosads_post_async_relative_retry_invalid_header_request_initial, - build_lrosads_post_async_relative_retry_invalid_json_polling_request_initial, - build_lrosads_post_async_relative_retry_no_payload_request_initial, - build_lrosads_post_non_retry400_request_initial, - build_lrosads_put200_invalid_json_request_initial, - build_lrosads_put_async_relative_retry400_request_initial, - build_lrosads_put_async_relative_retry_invalid_header_request_initial, - build_lrosads_put_async_relative_retry_invalid_json_polling_request_initial, - build_lrosads_put_async_relative_retry_no_status_payload_request_initial, - build_lrosads_put_async_relative_retry_no_status_request_initial, - build_lrosads_put_error201_no_provisioning_state_payload_request_initial, - build_lrosads_put_non_retry201_creating400_invalid_json_request_initial, - build_lrosads_put_non_retry201_creating400_request_initial, - build_lrosads_put_non_retry400_request_initial, -) - -T = TypeVar("T") +from ...operations._operations import build_lr_os_custom_header_post202_retry200_request_initial, build_lr_os_custom_header_post_async_retry_succeeded_request_initial, build_lr_os_custom_header_put201_creating_succeeded200_request_initial, build_lr_os_custom_header_put_async_retry_succeeded_request_initial, build_lro_retrys_delete202_retry200_request_initial, build_lro_retrys_delete_async_relative_retry_succeeded_request_initial, build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial, build_lro_retrys_post202_retry200_request_initial, build_lro_retrys_post_async_relative_retry_succeeded_request_initial, build_lro_retrys_put201_creating_succeeded200_request_initial, build_lro_retrys_put_async_relative_retry_succeeded_request_initial, build_lros_delete202_no_retry204_request_initial, build_lros_delete202_retry200_request_initial, build_lros_delete204_succeeded_request_initial, build_lros_delete_async_no_header_in_retry_request_initial, build_lros_delete_async_no_retry_succeeded_request_initial, build_lros_delete_async_retry_failed_request_initial, build_lros_delete_async_retry_succeeded_request_initial, build_lros_delete_async_retrycanceled_request_initial, build_lros_delete_no_header_in_retry_request_initial, build_lros_delete_provisioning202_accepted200_succeeded_request_initial, build_lros_delete_provisioning202_deleting_failed200_request_initial, build_lros_delete_provisioning202_deletingcanceled200_request_initial, build_lros_patch200_succeeded_ignore_headers_request_initial, build_lros_patch201_retry_with_async_header_request_initial, build_lros_patch202_retry_with_async_and_location_header_request_initial, build_lros_post200_with_payload_request_initial, build_lros_post202_list_request_initial, build_lros_post202_no_retry204_request_initial, build_lros_post202_retry200_request_initial, build_lros_post_async_no_retry_succeeded_request_initial, build_lros_post_async_retry_failed_request_initial, build_lros_post_async_retry_succeeded_request_initial, build_lros_post_async_retrycanceled_request_initial, build_lros_post_double_headers_final_azure_header_get_default_request_initial, build_lros_post_double_headers_final_azure_header_get_request_initial, build_lros_post_double_headers_final_location_get_request_initial, build_lros_put200_acceptedcanceled200_request_initial, build_lros_put200_succeeded_no_state_request_initial, build_lros_put200_succeeded_request_initial, build_lros_put200_updating_succeeded204_request_initial, build_lros_put201_creating_failed200_request_initial, build_lros_put201_creating_succeeded200_request_initial, build_lros_put201_succeeded_request_initial, build_lros_put202_retry200_request_initial, build_lros_put_async_no_header_in_retry_request_initial, build_lros_put_async_no_retry_succeeded_request_initial, build_lros_put_async_no_retrycanceled_request_initial, build_lros_put_async_non_resource_request_initial, build_lros_put_async_retry_failed_request_initial, build_lros_put_async_retry_succeeded_request_initial, build_lros_put_async_sub_resource_request_initial, build_lros_put_no_header_in_retry_request_initial, build_lros_put_non_resource_request_initial, build_lros_put_sub_resource_request_initial, build_lrosads_delete202_non_retry400_request_initial, build_lrosads_delete202_retry_invalid_header_request_initial, build_lrosads_delete204_succeeded_request_initial, build_lrosads_delete_async_relative_retry400_request_initial, build_lrosads_delete_async_relative_retry_invalid_header_request_initial, build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial, build_lrosads_delete_async_relative_retry_no_status_request_initial, build_lrosads_delete_non_retry400_request_initial, build_lrosads_post202_no_location_request_initial, build_lrosads_post202_non_retry400_request_initial, build_lrosads_post202_retry_invalid_header_request_initial, build_lrosads_post_async_relative_retry400_request_initial, build_lrosads_post_async_relative_retry_invalid_header_request_initial, build_lrosads_post_async_relative_retry_invalid_json_polling_request_initial, build_lrosads_post_async_relative_retry_no_payload_request_initial, build_lrosads_post_non_retry400_request_initial, build_lrosads_put200_invalid_json_request_initial, build_lrosads_put_async_relative_retry400_request_initial, build_lrosads_put_async_relative_retry_invalid_header_request_initial, build_lrosads_put_async_relative_retry_invalid_json_polling_request_initial, build_lrosads_put_async_relative_retry_no_status_payload_request_initial, build_lrosads_put_async_relative_retry_no_status_request_initial, build_lrosads_put_error201_no_provisioning_state_payload_request_initial, build_lrosads_put_non_retry201_creating400_invalid_json_request_initial, build_lrosads_put_non_retry201_creating400_request_initial, build_lrosads_put_non_retry400_request_initial +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class LROsOperations: # pylint: disable=too-many-public-methods """LROsOperations async operations. @@ -130,12 +40,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put200_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _put200_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -149,7 +65,9 @@ async def _put200_succeeded_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -169,8 +87,14 @@ async def _put200_succeeded_initial(self, product: JSONType = None, **kwargs: An return deserialized + + @distributed_trace_async - async def begin_put200_succeeded(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put200_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -226,16 +150,22 @@ async def begin_put200_succeeded(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -247,27 +177,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _patch200_succeeded_ignore_headers_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -281,7 +217,9 @@ async def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -290,9 +228,7 @@ async def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = N raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) if response.content: deserialized = response.json() @@ -304,9 +240,13 @@ async def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = N return deserialized + + @distributed_trace_async async def begin_patch200_succeeded_ignore_headers( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -363,24 +303,28 @@ async def begin_patch200_succeeded_ignore_headers( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._patch200_succeeded_ignore_headers_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + if response.content: deserialized = response.json() else: @@ -389,27 +333,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _patch201_retry_with_async_header_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _patch201_retry_with_async_header_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -423,7 +373,9 @@ async def _patch201_retry_with_async_header_initial(self, product: JSONType = No request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -439,10 +391,8 @@ async def _patch201_retry_with_async_header_initial(self, product: JSONType = No deserialized = None if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + if response.content: deserialized = response.json() else: @@ -453,9 +403,13 @@ async def _patch201_retry_with_async_header_initial(self, product: JSONType = No return deserialized + + @distributed_trace_async async def begin_patch201_retry_with_async_header( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running patch request, service returns a 201 to the initial request with async header. @@ -511,16 +465,22 @@ async def begin_patch201_retry_with_async_header( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._patch201_retry_with_async_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -532,31 +492,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling( - lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs - ) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _patch202_retry_with_async_and_location_header_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -570,7 +532,9 @@ async def _patch202_retry_with_async_and_location_header_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -586,11 +550,9 @@ async def _patch202_retry_with_async_and_location_header_initial( deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -601,9 +563,13 @@ async def _patch202_retry_with_async_and_location_header_initial( return deserialized + + @distributed_trace_async async def begin_patch202_retry_with_async_and_location_header( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running patch request, service returns a 202 to the initial request with async and location header. @@ -660,16 +626,22 @@ async def begin_patch202_retry_with_async_and_location_header( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._patch202_retry_with_async_and_location_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -681,27 +653,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put201_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put201_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -715,7 +693,9 @@ async def _put201_succeeded_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -733,8 +713,14 @@ async def _put201_succeeded_initial(self, product: JSONType = None, **kwargs: An return deserialized + + @distributed_trace_async - async def begin_put201_succeeded(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put201_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -790,16 +776,22 @@ async def begin_put201_succeeded(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -811,31 +803,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_list_initial(self, **kwargs: Any) -> Optional[List[JSONType]]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[JSONType]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post202_list_request_initial() + + async def _post202_list_initial( + self, + **kwargs: Any + ) -> Optional[List[JSONType]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List[JSONType]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post202_list_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -852,18 +853,22 @@ async def _post202_list_initial(self, **kwargs: Any) -> Optional[List[JSONType]] deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace_async - async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List[JSONType]]: + async def begin_post202_list( + self, + **kwargs: Any + ) -> AsyncLROPoller[List[JSONType]]: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -901,13 +906,19 @@ async def begin_post202_list(self, **kwargs: Any) -> AsyncLROPoller[List[JSONTyp } ] """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post202_list_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post202_list_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -919,27 +930,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put200_succeeded_no_state_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put200_succeeded_no_state_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -953,7 +970,9 @@ async def _put200_succeeded_no_state_initial(self, product: JSONType = None, **k request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -971,9 +990,13 @@ async def _put200_succeeded_no_state_initial(self, product: JSONType = None, **k return deserialized + + @distributed_trace_async async def begin_put200_succeeded_no_state( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -1030,16 +1053,22 @@ async def begin_put200_succeeded_no_state( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_succeeded_no_state_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1051,27 +1080,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1085,7 +1120,9 @@ async def _put202_retry200_initial(self, product: JSONType = None, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1103,8 +1140,14 @@ async def _put202_retry200_initial(self, product: JSONType = None, **kwargs: Any return deserialized + + @distributed_trace_async - async def begin_put202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -1161,16 +1204,22 @@ async def begin_put202_retry200(self, product: JSONType = None, **kwargs: Any) - "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1182,27 +1231,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put201_creating_succeeded200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1216,7 +1271,9 @@ async def _put201_creating_succeeded200_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1241,9 +1298,13 @@ async def _put201_creating_succeeded200_initial(self, product: JSONType = None, return deserialized + + @distributed_trace_async async def begin_put201_creating_succeeded200( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a @@ -1301,16 +1362,22 @@ async def begin_put201_creating_succeeded200( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1322,27 +1389,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put200_updating_succeeded204_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put200_updating_succeeded204_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1356,7 +1429,9 @@ async def _put200_updating_succeeded204_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1374,9 +1449,13 @@ async def _put200_updating_succeeded204_initial(self, product: JSONType = None, return deserialized + + @distributed_trace_async async def begin_put200_updating_succeeded204( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a @@ -1434,16 +1513,22 @@ async def begin_put200_updating_succeeded204( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_updating_succeeded204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1455,27 +1540,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put201_creating_failed200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put201_creating_failed200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1489,7 +1580,9 @@ async def _put201_creating_failed200_initial(self, product: JSONType = None, **k request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1514,9 +1607,13 @@ async def _put201_creating_failed200_initial(self, product: JSONType = None, **k return deserialized + + @distributed_trace_async async def begin_put201_creating_failed200( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a @@ -1574,16 +1671,22 @@ async def begin_put201_creating_failed200( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_failed200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1595,27 +1698,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put200_acceptedcanceled200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put200_acceptedcanceled200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1629,7 +1738,9 @@ async def _put200_acceptedcanceled200_initial(self, product: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1647,9 +1758,13 @@ async def _put200_acceptedcanceled200_initial(self, product: JSONType = None, ** return deserialized + + @distributed_trace_async async def begin_put200_acceptedcanceled200( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a @@ -1707,16 +1822,22 @@ async def begin_put200_acceptedcanceled200( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_acceptedcanceled200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1728,27 +1849,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_no_header_in_retry_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1762,7 +1889,9 @@ async def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1771,7 +1900,7 @@ async def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers['location']=self._deserialize('str', response.headers.get('location')) if response.content: deserialized = response.json() @@ -1783,8 +1912,14 @@ async def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace_async - async def begin_put_no_header_in_retry(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put_no_header_in_retry( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -1840,22 +1975,28 @@ async def begin_put_no_header_in_retry(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - + response_headers['location']=self._deserialize('str', response.headers.get('location')) + if response.content: deserialized = response.json() else: @@ -1864,27 +2005,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1898,7 +2045,9 @@ async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **k request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1907,11 +2056,9 @@ async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **k raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -1923,9 +2070,13 @@ async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **k return deserialized + + @distributed_trace_async async def begin_put_async_retry_succeeded( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1983,26 +2134,30 @@ async def begin_put_async_retry_succeeded( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -2011,27 +2166,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_no_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2045,7 +2206,9 @@ async def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2054,10 +2217,8 @@ async def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if response.content: deserialized = response.json() @@ -2069,9 +2230,13 @@ async def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, return deserialized + + @distributed_trace_async async def begin_put_async_no_retry_succeeded( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2129,25 +2294,29 @@ async def begin_put_async_no_retry_succeeded( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -2156,27 +2325,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_retry_failed_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_retry_failed_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2190,7 +2365,9 @@ async def _put_async_retry_failed_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2199,11 +2376,9 @@ async def _put_async_retry_failed_initial(self, product: JSONType = None, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -2215,8 +2390,14 @@ async def _put_async_retry_failed_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace_async - async def begin_put_async_retry_failed(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put_async_retry_failed( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2273,26 +2454,30 @@ async def begin_put_async_retry_failed(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -2301,27 +2486,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_no_retrycanceled_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_no_retrycanceled_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2335,7 +2526,9 @@ async def _put_async_no_retrycanceled_initial(self, product: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2344,10 +2537,8 @@ async def _put_async_no_retrycanceled_initial(self, product: JSONType = None, ** raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if response.content: deserialized = response.json() @@ -2359,9 +2550,13 @@ async def _put_async_no_retrycanceled_initial(self, product: JSONType = None, ** return deserialized + + @distributed_trace_async async def begin_put_async_no_retrycanceled( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2419,25 +2614,29 @@ async def begin_put_async_no_retrycanceled( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_no_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -2446,27 +2645,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_no_header_in_retry_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2480,7 +2685,9 @@ async def _put_async_no_header_in_retry_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2489,9 +2696,7 @@ async def _put_async_no_header_in_retry_initial(self, product: JSONType = None, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) if response.content: deserialized = response.json() @@ -2503,9 +2708,13 @@ async def _put_async_no_header_in_retry_initial(self, product: JSONType = None, return deserialized + + @distributed_trace_async async def begin_put_async_no_header_in_retry( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain @@ -2563,24 +2772,28 @@ async def begin_put_async_no_header_in_retry( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + if response.content: deserialized = response.json() else: @@ -2589,27 +2802,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_non_resource_initial( + self, + sku: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: _json = sku @@ -2623,7 +2842,9 @@ async def _put_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2641,8 +2862,14 @@ async def _put_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) - return deserialized + + @distributed_trace_async - async def begin_put_non_resource(self, sku: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put_non_resource( + self, + sku: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request with non resource. :param sku: sku to put. @@ -2673,16 +2900,22 @@ async def begin_put_non_resource(self, sku: JSONType = None, **kwargs: Any) -> A "name": "str" # Optional. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2694,27 +2927,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_non_resource_initial( + self, + sku: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: _json = sku @@ -2728,7 +2967,9 @@ async def _put_async_non_resource_initial(self, sku: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2746,8 +2987,14 @@ async def _put_async_non_resource_initial(self, sku: JSONType = None, **kwargs: return deserialized + + @distributed_trace_async - async def begin_put_async_non_resource(self, sku: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put_async_non_resource( + self, + sku: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request with non resource. :param sku: Sku to put. @@ -2778,16 +3025,22 @@ async def begin_put_async_non_resource(self, sku: JSONType = None, **kwargs: Any "name": "str" # Optional. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2799,27 +3052,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_sub_resource_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2833,7 +3092,9 @@ async def _put_sub_resource_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2851,8 +3112,14 @@ async def _put_sub_resource_initial(self, product: JSONType = None, **kwargs: An return deserialized + + @distributed_trace_async - async def begin_put_sub_resource(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put_sub_resource( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request with sub resource. :param product: Sub Product to put. @@ -2893,16 +3160,22 @@ async def begin_put_sub_resource(self, product: JSONType = None, **kwargs: Any) } } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_sub_resource_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2914,27 +3187,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_sub_resource_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2948,7 +3227,9 @@ async def _put_async_sub_resource_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2966,8 +3247,14 @@ async def _put_async_sub_resource_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace_async - async def begin_put_async_sub_resource(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put_async_sub_resource( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request with sub resource. :param product: Sub Product to put. @@ -3008,16 +3295,22 @@ async def begin_put_async_sub_resource(self, product: JSONType = None, **kwargs: } } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_sub_resource_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3029,31 +3322,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_provisioning202_accepted200_succeeded_request_initial() + + async def _delete_provisioning202_accepted200_succeeded_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_provisioning202_accepted200_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3069,9 +3371,9 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -3082,8 +3384,13 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: return deserialized + + @distributed_trace_async - async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_delete_provisioning202_accepted200_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -3120,15 +3427,19 @@ async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3140,31 +3451,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_provisioning202_deleting_failed200_request_initial() + + async def _delete_provisioning202_deleting_failed200_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_provisioning202_deleting_failed200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3180,9 +3500,9 @@ async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -3193,8 +3513,13 @@ async def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any return deserialized + + @distributed_trace_async - async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_delete_provisioning202_deleting_failed200( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -3231,13 +3556,19 @@ async def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) - "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_provisioning202_deleting_failed200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_provisioning202_deleting_failed200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3249,31 +3580,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_provisioning202_deletingcanceled200_request_initial() + + async def _delete_provisioning202_deletingcanceled200_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_provisioning202_deletingcanceled200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3289,9 +3629,9 @@ async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: An deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -3302,8 +3642,13 @@ async def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: An return deserialized + + @distributed_trace_async - async def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_delete_provisioning202_deletingcanceled200( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -3340,13 +3685,19 @@ async def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_provisioning202_deletingcanceled200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_provisioning202_deletingcanceled200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3358,31 +3709,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete204_succeeded_request_initial() + + async def _delete204_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete204_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3393,8 +3753,13 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete204_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete succeeds and returns right away. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -3408,43 +3773,58 @@ async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None] :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete202_retry200_request_initial() + + async def _delete202_retry200_initial( + self, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete202_retry200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3461,16 +3841,22 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[JSONType] deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace_async - async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_delete202_retry200( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -3506,13 +3892,19 @@ async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[JSONTy "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3524,31 +3916,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete202_no_retry204_request_initial() + + async def _delete202_no_retry204_initial( + self, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete202_no_retry204_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3565,16 +3966,22 @@ async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[JSONTy deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace_async - async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_delete202_no_retry204( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -3610,13 +4017,19 @@ async def begin_delete202_no_retry204(self, **kwargs: Any) -> AsyncLROPoller[JSO "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_no_retry204_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_no_retry204_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3628,31 +4041,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_no_header_in_retry_request_initial() + + async def _delete_no_header_in_retry_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_no_header_in_retry_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3662,13 +4084,19 @@ async def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_no_header_in_retry(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_no_header_in_retry( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -3683,43 +4111,58 @@ async def begin_delete_no_header_in_retry(self, **kwargs: Any) -> AsyncLROPoller :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_no_header_in_retry_request_initial() + + async def _delete_async_no_header_in_retry_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_no_header_in_retry_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3729,13 +4172,19 @@ async def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_no_header_in_retry(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_no_header_in_retry( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -3750,43 +4199,58 @@ async def begin_delete_async_no_header_in_retry(self, **kwargs: Any) -> AsyncLRO :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_retry_succeeded_request_initial() + + async def _delete_async_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_retry_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3795,17 +4259,21 @@ async def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_retry_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_retry_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3820,43 +4288,58 @@ async def begin_delete_async_retry_succeeded(self, **kwargs: Any) -> AsyncLROPol :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_no_retry_succeeded_request_initial() + + async def _delete_async_no_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_no_retry_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3865,17 +4348,21 @@ async def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_no_retry_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_no_retry_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3890,43 +4377,58 @@ async def begin_delete_async_no_retry_succeeded(self, **kwargs: Any) -> AsyncLRO :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_no_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_no_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_retry_failed_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_retry_failed_request_initial() + + async def _delete_async_retry_failed_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_retry_failed_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3935,17 +4437,21 @@ async def _delete_async_retry_failed_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_retry_failed(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_retry_failed( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3960,43 +4466,58 @@ async def begin_delete_async_retry_failed(self, **kwargs: Any) -> AsyncLROPoller :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_retry_failed_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_retry_failed_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_retrycanceled_request_initial() + + async def _delete_async_retrycanceled_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_retrycanceled_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4005,17 +4526,21 @@ async def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_retrycanceled(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_retrycanceled( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -4030,43 +4555,58 @@ async def begin_delete_async_retrycanceled(self, **kwargs: Any) -> AsyncLROPolle :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_retrycanceled_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_retrycanceled_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post200_with_payload_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post200_with_payload_request_initial() + + async def _post200_with_payload_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post200_with_payload_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4091,8 +4631,13 @@ async def _post200_with_payload_initial(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_post200_with_payload( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -4116,13 +4661,19 @@ async def begin_post200_with_payload(self, **kwargs: Any) -> AsyncLROPoller[JSON "name": "str" # Optional. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post200_with_payload_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post200_with_payload_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4134,27 +4685,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -4168,7 +4725,9 @@ async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4177,14 +4736,21 @@ async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -4222,42 +4788,54 @@ async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post202_no_retry204_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -4271,7 +4849,9 @@ async def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4280,8 +4860,8 @@ async def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -4293,8 +4873,14 @@ async def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: return deserialized + + @distributed_trace_async - async def begin_post202_no_retry204(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_post202_no_retry204( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -4350,23 +4936,29 @@ async def begin_post202_no_retry204(self, product: JSONType = None, **kwargs: An "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_no_retry204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -4375,31 +4967,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_double_headers_final_location_get_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post_double_headers_final_location_get_request_initial() + + async def _post_double_headers_final_location_get_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post_double_headers_final_location_get_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4417,8 +5018,13 @@ async def _post_double_headers_final_location_get_initial(self, **kwargs: Any) - return deserialized + + @distributed_trace_async - async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_post_double_headers_final_location_get( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -4455,13 +5061,19 @@ async def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> A "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post_double_headers_final_location_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post_double_headers_final_location_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4473,31 +5085,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_double_headers_final_azure_header_get_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post_double_headers_final_azure_header_get_request_initial() + + async def _post_double_headers_final_azure_header_get_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post_double_headers_final_azure_header_get_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4515,8 +5136,13 @@ async def _post_double_headers_final_azure_header_get_initial(self, **kwargs: An return deserialized + + @distributed_trace_async - async def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_post_double_headers_final_azure_header_get( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -4553,13 +5179,19 @@ async def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._post_double_headers_final_azure_header_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._post_double_headers_final_azure_header_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4571,33 +5203,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling( - lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs - ) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_double_headers_final_azure_header_get_default_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post_double_headers_final_azure_header_get_default_request_initial() + + async def _post_double_headers_final_azure_header_get_default_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post_double_headers_final_azure_header_get_default_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4615,8 +5254,13 @@ async def _post_double_headers_final_azure_header_get_default_initial(self, **kw return deserialized + + @distributed_trace_async - async def begin_post_double_headers_final_azure_header_get_default(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_post_double_headers_final_azure_header_get_default( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -4653,15 +5297,19 @@ async def begin_post_double_headers_final_azure_header_get_default(self, **kwarg "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_double_headers_final_azure_header_get_default_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4673,27 +5321,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -4707,7 +5361,9 @@ async def _post_async_retry_succeeded_initial(self, product: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4724,20 +5380,23 @@ async def _post_async_retry_succeeded_initial(self, product: JSONType = None, ** deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace_async async def begin_post_async_retry_succeeded( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -4795,16 +5454,22 @@ async def begin_post_async_retry_succeeded( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4816,29 +5481,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _post_async_no_retry_succeeded_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -4852,7 +5521,9 @@ async def _post_async_no_retry_succeeded_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4869,20 +5540,23 @@ async def _post_async_no_retry_succeeded_initial( deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace_async async def begin_post_async_no_retry_succeeded( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -4940,16 +5614,22 @@ async def begin_post_async_no_retry_succeeded( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4961,27 +5641,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_retry_failed_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_retry_failed_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -4995,7 +5681,9 @@ async def _post_async_retry_failed_initial(self, product: JSONType = None, **kwa request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5004,17 +5692,22 @@ async def _post_async_retry_failed_initial(self, product: JSONType = None, **kwa raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post_async_retry_failed(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_retry_failed( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5053,42 +5746,54 @@ async def begin_post_async_retry_failed(self, product: JSONType = None, **kwargs "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_retrycanceled_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_retrycanceled_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5102,7 +5807,9 @@ async def _post_async_retrycanceled_initial(self, product: JSONType = None, **kw request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5111,17 +5818,22 @@ async def _post_async_retrycanceled_initial(self, product: JSONType = None, **kw raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post_async_retrycanceled(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_retrycanceled( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5160,33 +5872,37 @@ async def begin_post_async_retrycanceled(self, product: JSONType = None, **kwarg "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) @@ -5209,12 +5925,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _put201_creating_succeeded200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5228,7 +5950,9 @@ async def _put201_creating_succeeded200_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5253,9 +5977,13 @@ async def _put201_creating_succeeded200_initial(self, product: JSONType = None, return deserialized + + @distributed_trace_async async def begin_put201_creating_succeeded200( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -5313,16 +6041,22 @@ async def begin_put201_creating_succeeded200( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -5334,27 +6068,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_relative_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_relative_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5368,7 +6108,9 @@ async def _put_async_relative_retry_succeeded_initial(self, product: JSONType = request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5377,11 +6119,9 @@ async def _put_async_relative_retry_succeeded_initial(self, product: JSONType = raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -5393,9 +6133,13 @@ async def _put_async_relative_retry_succeeded_initial(self, product: JSONType = return deserialized + + @distributed_trace_async async def begin_put_async_relative_retry_succeeded( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -5453,26 +6197,30 @@ async def begin_put_async_relative_retry_succeeded( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -5481,31 +6229,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial() + + async def _delete_provisioning202_accepted200_succeeded_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5521,9 +6278,9 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -5534,8 +6291,13 @@ async def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: return deserialized + + @distributed_trace_async - async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_delete_provisioning202_accepted200_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -5572,15 +6334,19 @@ async def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -5592,31 +6358,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete202_retry200_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lro_retrys_delete202_retry200_request_initial() + + async def _delete202_retry200_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lro_retrys_delete202_retry200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5625,14 +6400,20 @@ async def _delete202_retry200_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete202_retry200( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -5647,43 +6428,58 @@ async def begin_delete202_retry200(self, **kwargs: Any) -> AsyncLROPoller[None]: :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_relative_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lro_retrys_delete_async_relative_retry_succeeded_request_initial() + + async def _delete_async_relative_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lro_retrys_delete_async_relative_retry_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5692,17 +6488,21 @@ async def _delete_async_relative_retry_succeeded_initial(self, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_relative_retry_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5717,39 +6517,51 @@ async def begin_delete_async_relative_retry_succeeded(self, **kwargs: Any) -> As :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5763,7 +6575,9 @@ async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5772,14 +6586,21 @@ async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -5817,42 +6638,54 @@ async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_relative_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_relative_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5866,7 +6699,9 @@ async def _post_async_relative_retry_succeeded_initial(self, product: JSONType = request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5875,18 +6710,21 @@ async def _post_async_relative_retry_succeeded_initial(self, product: JSONType = raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async async def begin_post_async_relative_retry_succeeded( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -5926,33 +6764,37 @@ async def begin_post_async_relative_retry_succeeded( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) @@ -5975,12 +6817,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _put_non_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5994,7 +6842,9 @@ async def _put_non_retry400_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6019,8 +6869,14 @@ async def _put_non_retry400_initial(self, product: JSONType = None, **kwargs: An return deserialized + + @distributed_trace_async - async def begin_put_non_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put_non_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 400 to the initial request. :param product: Product to put. @@ -6075,16 +6931,22 @@ async def begin_put_non_retry400(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -6096,27 +6958,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_non_retry201_creating400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_non_retry201_creating400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6130,7 +6998,9 @@ async def _put_non_retry201_creating400_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6155,9 +7025,13 @@ async def _put_non_retry201_creating400_initial(self, product: JSONType = None, return deserialized + + @distributed_trace_async async def begin_put_non_retry201_creating400( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -6214,16 +7088,22 @@ async def begin_put_non_retry201_creating400( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_retry201_creating400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -6235,29 +7115,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _put_non_retry201_creating400_invalid_json_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6271,7 +7155,9 @@ async def _put_non_retry201_creating400_invalid_json_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6296,9 +7182,13 @@ async def _put_non_retry201_creating400_invalid_json_initial( return deserialized + + @distributed_trace_async async def begin_put_non_retry201_creating400_invalid_json( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -6355,16 +7245,22 @@ async def begin_put_non_retry201_creating400_invalid_json( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_non_retry201_creating400_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -6376,27 +7272,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_relative_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_relative_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6410,7 +7312,9 @@ async def _put_async_relative_retry400_initial(self, product: JSONType = None, * request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6419,11 +7323,9 @@ async def _put_async_relative_retry400_initial(self, product: JSONType = None, * raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -6435,9 +7337,13 @@ async def _put_async_relative_retry400_initial(self, product: JSONType = None, * return deserialized + + @distributed_trace_async async def begin_put_async_relative_retry400( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -6494,26 +7400,30 @@ async def begin_put_async_relative_retry400( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -6522,31 +7432,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_non_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_non_retry400_request_initial() + + async def _delete_non_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_non_retry400_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6555,14 +7474,20 @@ async def _delete_non_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_non_retry400( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 400 with an error body. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -6576,43 +7501,58 @@ async def begin_delete_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[None] :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete202_non_retry400_request_initial() + + async def _delete202_non_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete202_non_retry400_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6621,14 +7561,20 @@ async def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete202_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete202_non_retry400( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 with a location header. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -6642,43 +7588,58 @@ async def begin_delete202_non_retry400(self, **kwargs: Any) -> AsyncLROPoller[No :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry400_request_initial() + + async def _delete_async_relative_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry400_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6687,17 +7648,21 @@ async def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_relative_retry400(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry400( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -6712,39 +7677,51 @@ async def begin_delete_async_relative_retry400(self, **kwargs: Any) -> AsyncLROP :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_non_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6758,7 +7735,9 @@ async def _post_non_retry400_initial(self, product: JSONType = None, **kwargs: A request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6767,14 +7746,21 @@ async def _post_non_retry400_initial(self, product: JSONType = None, **kwargs: A raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post_non_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_non_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 400 with no error body. :param product: Product to put. @@ -6811,42 +7797,54 @@ async def begin_post_non_retry400(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post202_non_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6860,7 +7858,9 @@ async def _post202_non_retry400_initial(self, product: JSONType = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6869,14 +7869,21 @@ async def _post202_non_retry400_initial(self, product: JSONType = None, **kwargs raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post202_non_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_non_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 with a location header. :param product: Product to put. @@ -6913,42 +7920,54 @@ async def begin_post202_non_retry400(self, product: JSONType = None, **kwargs: A "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_relative_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_relative_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6962,7 +7981,9 @@ async def _post_async_relative_retry400_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6971,17 +7992,22 @@ async def _post_async_relative_retry400_initial(self, product: JSONType = None, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post_async_relative_retry400(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_relative_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -7019,44 +8045,54 @@ async def begin_post_async_relative_retry400(self, product: JSONType = None, **k "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _put_error201_no_provisioning_state_payload_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7070,7 +8106,9 @@ async def _put_error201_no_provisioning_state_payload_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7095,9 +8133,13 @@ async def _put_error201_no_provisioning_state_payload_initial( return deserialized + + @distributed_trace_async async def begin_put_error201_no_provisioning_state_payload( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request with no payload. @@ -7153,16 +8195,22 @@ async def begin_put_error201_no_provisioning_state_payload( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_error201_no_provisioning_state_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -7174,27 +8222,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put_async_relative_retry_no_status_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put_async_relative_retry_no_status_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7208,7 +8262,9 @@ async def _put_async_relative_retry_no_status_initial(self, product: JSONType = request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7217,11 +8273,9 @@ async def _put_async_relative_retry_no_status_initial(self, product: JSONType = raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -7233,9 +8287,13 @@ async def _put_async_relative_retry_no_status_initial(self, product: JSONType = return deserialized + + @distributed_trace_async async def begin_put_async_relative_retry_no_status( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -7293,26 +8351,30 @@ async def begin_put_async_relative_retry_no_status( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_no_status_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -7321,29 +8383,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _put_async_relative_retry_no_status_payload_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7357,7 +8423,9 @@ async def _put_async_relative_retry_no_status_payload_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7366,11 +8434,9 @@ async def _put_async_relative_retry_no_status_payload_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -7382,9 +8448,13 @@ async def _put_async_relative_retry_no_status_payload_initial( return deserialized + + @distributed_trace_async async def begin_put_async_relative_retry_no_status_payload( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -7442,26 +8512,30 @@ async def begin_put_async_relative_retry_no_status_payload( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_no_status_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -7470,31 +8544,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete204_succeeded_request_initial() + + async def _delete204_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete204_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7505,8 +8588,13 @@ async def _delete204_succeeded_initial(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete204_succeeded( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 204 to the initial request, indicating success. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -7520,43 +8608,58 @@ async def begin_delete204_succeeded(self, **kwargs: Any) -> AsyncLROPoller[None] :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_relative_retry_no_status_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry_no_status_request_initial() + + async def _delete_async_relative_retry_no_status_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry_no_status_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7565,17 +8668,21 @@ async def _delete_async_relative_retry_no_status_initial(self, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_relative_retry_no_status(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_no_status( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -7590,39 +8697,51 @@ async def begin_delete_async_relative_retry_no_status(self, **kwargs: Any) -> As :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry_no_status_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry_no_status_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_no_location_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post202_no_location_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7636,7 +8755,9 @@ async def _post202_no_location_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7645,14 +8766,21 @@ async def _post202_no_location_initial(self, product: JSONType = None, **kwargs: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post202_no_location(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_no_location( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -7690,42 +8818,54 @@ async def begin_post202_no_location(self, product: JSONType = None, **kwargs: An "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_no_location_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_relative_retry_no_payload_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_relative_retry_no_payload_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7739,7 +8879,9 @@ async def _post_async_relative_retry_no_payload_initial(self, product: JSONType request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7748,18 +8890,21 @@ async def _post_async_relative_retry_no_payload_initial(self, product: JSONType raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async async def begin_post_async_relative_retry_no_payload( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -7799,42 +8944,54 @@ async def begin_post_async_relative_retry_no_payload( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_no_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put200_invalid_json_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put200_invalid_json_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7848,7 +9005,9 @@ async def _put200_invalid_json_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7868,8 +9027,14 @@ async def _put200_invalid_json_initial(self, product: JSONType = None, **kwargs: return deserialized + + @distributed_trace_async - async def begin_put200_invalid_json(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[JSONType]: + async def begin_put200_invalid_json( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -7925,16 +9090,22 @@ async def begin_put200_invalid_json(self, product: JSONType = None, **kwargs: An "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put200_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -7946,29 +9117,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _put_async_relative_retry_invalid_header_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7982,7 +9157,9 @@ async def _put_async_relative_retry_invalid_header_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7991,11 +9168,9 @@ async def _put_async_relative_retry_invalid_header_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -8007,9 +9182,13 @@ async def _put_async_relative_retry_invalid_header_initial( return deserialized + + @distributed_trace_async async def begin_put_async_relative_retry_invalid_header( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -8067,26 +9246,30 @@ async def begin_put_async_relative_retry_invalid_header( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -8095,29 +9278,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _put_async_relative_retry_invalid_json_polling_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8131,7 +9318,9 @@ async def _put_async_relative_retry_invalid_json_polling_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8140,11 +9329,9 @@ async def _put_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -8156,9 +9343,13 @@ async def _put_async_relative_retry_invalid_json_polling_initial( return deserialized + + @distributed_trace_async async def begin_put_async_relative_retry_invalid_json_polling( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -8216,26 +9407,30 @@ async def begin_put_async_relative_retry_invalid_json_polling( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -8244,31 +9439,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete202_retry_invalid_header_request_initial() + + async def _delete202_retry_invalid_header_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete202_retry_invalid_header_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8277,14 +9481,20 @@ async def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete202_retry_invalid_header(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete202_retry_invalid_header( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -8299,43 +9509,58 @@ async def begin_delete202_retry_invalid_header(self, **kwargs: Any) -> AsyncLROP :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete202_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete202_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_relative_retry_invalid_header_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry_invalid_header_request_initial() + + async def _delete_async_relative_retry_invalid_header_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry_invalid_header_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8344,17 +9569,21 @@ async def _delete_async_relative_retry_invalid_header_initial(self, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_relative_retry_invalid_header(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_invalid_header( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -8369,43 +9598,58 @@ async def begin_delete_async_relative_retry_invalid_header(self, **kwargs: Any) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_async_relative_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = await self._delete_async_relative_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_async_relative_retry_invalid_json_polling_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial() + + async def _delete_async_relative_retry_invalid_json_polling_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8414,17 +9658,21 @@ async def _delete_async_relative_retry_invalid_json_polling_initial(self, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_delete_async_relative_retry_invalid_json_polling(self, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_delete_async_relative_retry_invalid_json_polling( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -8439,41 +9687,51 @@ async def begin_delete_async_relative_retry_invalid_json_polling(self, **kwargs: :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_async_relative_retry_invalid_json_polling_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_retry_invalid_header_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post202_retry_invalid_header_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8487,7 +9745,9 @@ async def _post202_retry_invalid_header_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8496,14 +9756,21 @@ async def _post202_retry_invalid_header_initial(self, product: JSONType = None, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post202_retry_invalid_header(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry_invalid_header( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -8541,42 +9808,54 @@ async def begin_post202_retry_invalid_header(self, product: JSONType = None, **k "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_relative_retry_invalid_header_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_relative_retry_invalid_header_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8590,7 +9869,9 @@ async def _post_async_relative_retry_invalid_header_initial(self, product: JSONT request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8599,18 +9880,21 @@ async def _post_async_relative_retry_invalid_header_initial(self, product: JSONT raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async async def begin_post_async_relative_retry_invalid_header( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -8650,44 +9934,54 @@ async def begin_post_async_relative_retry_invalid_header( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _post_async_relative_retry_invalid_json_polling_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8701,7 +9995,9 @@ async def _post_async_relative_retry_invalid_json_polling_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8710,18 +10006,21 @@ async def _post_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async async def begin_post_async_relative_retry_invalid_json_polling( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -8761,33 +10060,37 @@ async def begin_post_async_relative_retry_invalid_json_polling( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) @@ -8810,12 +10113,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + async def _put_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8829,7 +10138,9 @@ async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **k request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8838,11 +10149,9 @@ async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **k raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -8854,9 +10163,13 @@ async def _put_async_retry_succeeded_initial(self, product: JSONType = None, **k return deserialized + + @distributed_trace_async async def begin_put_async_retry_succeeded( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an @@ -8915,26 +10228,30 @@ async def begin_put_async_retry_succeeded( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -8943,27 +10260,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _put201_creating_succeeded200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8977,7 +10300,9 @@ async def _put201_creating_succeeded200_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9002,9 +10327,13 @@ async def _put201_creating_succeeded200_initial(self, product: JSONType = None, return deserialized + + @distributed_trace_async async def begin_put201_creating_succeeded200( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an @@ -9063,16 +10392,22 @@ async def begin_put201_creating_succeeded200( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -9084,27 +10419,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9118,7 +10459,9 @@ async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9127,14 +10470,21 @@ async def _post202_retry200_initial(self, product: JSONType = None, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -9173,42 +10523,54 @@ async def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + async def _post_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9222,7 +10584,9 @@ async def _post_async_retry_succeeded_initial(self, product: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9231,17 +10595,22 @@ async def _post_async_retry_succeeded_initial(self, product: JSONType = None, ** raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def begin_post_async_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> AsyncLROPoller[None]: + async def begin_post_async_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -9281,32 +10650,38 @@ async def begin_post_async_retry_succeeded(self, product: JSONType = None, **kwa "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/__init__.py index bef3a3f9d72..167c26f30aa 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/__init__.py @@ -12,8 +12,8 @@ from ._operations import LROsCustomHeaderOperations __all__ = [ - "LROsOperations", - "LRORetrysOperations", - "LROSADsOperations", - "LROsCustomHeaderOperations", + 'LROsOperations', + 'LRORetrysOperations', + 'LROSADsOperations', + 'LROsCustomHeaderOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py index e17ce02f188..67237d6c3a3 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -23,1304 +17,2027 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_lros_put200_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/succeeded" + url = '/lro/put/200/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_patch200_succeeded_ignore_headers_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/patch/200/succeeded/ignoreheaders" + url = '/lro/patch/200/succeeded/ignoreheaders' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_patch201_retry_with_async_header_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/patch/201/retry/onlyAsyncHeader" + url = '/lro/patch/201/retry/onlyAsyncHeader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_patch202_retry_with_async_and_location_header_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/patch/202/retry/asyncAndLocationHeader" + url = '/lro/patch/202/retry/asyncAndLocationHeader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put201_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/201/succeeded" + url = '/lro/put/201/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_lros_post202_list_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_post202_list_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/list" + url = '/lro/list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_lros_put200_succeeded_no_state_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/succeeded/nostate" + url = '/lro/put/200/succeeded/nostate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put202_retry200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/202/retry/200" + url = '/lro/put/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put201_creating_succeeded200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/201/creating/succeeded/200" + url = '/lro/put/201/creating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put200_updating_succeeded204_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/updating/succeeded/200" + url = '/lro/put/200/updating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put201_creating_failed200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/201/created/failed/200" + url = '/lro/put/201/created/failed/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put200_acceptedcanceled200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/200/accepted/canceled/200" + url = '/lro/put/200/accepted/canceled/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_no_header_in_retry_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/put/noheader/202/200" + url = '/lro/put/noheader/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_async_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/retry/succeeded" + url = '/lro/putasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_async_no_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/noretry/succeeded" + url = '/lro/putasync/noretry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_async_retry_failed_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/retry/failed" + url = '/lro/putasync/retry/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_async_no_retrycanceled_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/noretry/canceled" + url = '/lro/putasync/noretry/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_async_no_header_in_retry_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putasync/noheader/201/200" + url = '/lro/putasync/noheader/201/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_non_resource_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putnonresource/202/200" + url = '/lro/putnonresource/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_async_non_resource_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putnonresourceasync/202/200" + url = '/lro/putnonresourceasync/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_sub_resource_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putsubresource/202/200" + url = '/lro/putsubresource/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_put_async_sub_resource_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/putsubresourceasync/202/200" + url = '/lro/putsubresourceasync/202/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_lros_delete_provisioning202_accepted200_succeeded_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_provisioning202_accepted200_succeeded_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/provisioning/202/accepted/200/succeeded" + url = '/lro/delete/provisioning/202/accepted/200/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_provisioning202_deleting_failed200_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_provisioning202_deleting_failed200_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/provisioning/202/deleting/200/failed" + url = '/lro/delete/provisioning/202/deleting/200/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_provisioning202_deletingcanceled200_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_provisioning202_deletingcanceled200_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/provisioning/202/deleting/200/canceled" + url = '/lro/delete/provisioning/202/deleting/200/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete204_succeeded_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete204_succeeded_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/204/succeeded" + url = '/lro/delete/204/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete202_retry200_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete202_retry200_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/202/retry/200" + url = '/lro/delete/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete202_no_retry204_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete202_no_retry204_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/202/noretry/204" + url = '/lro/delete/202/noretry/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_no_header_in_retry_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_no_header_in_retry_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/delete/noheader" + url = '/lro/delete/noheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_async_no_header_in_retry_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_async_no_header_in_retry_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/noheader/202/204" + url = '/lro/deleteasync/noheader/202/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_async_retry_succeeded_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_async_retry_succeeded_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/retry/succeeded" + url = '/lro/deleteasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_async_no_retry_succeeded_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_async_no_retry_succeeded_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/noretry/succeeded" + url = '/lro/deleteasync/noretry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_async_retry_failed_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_async_retry_failed_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/retry/failed" + url = '/lro/deleteasync/retry/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_delete_async_retrycanceled_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_delete_async_retrycanceled_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/deleteasync/retry/canceled" + url = '/lro/deleteasync/retry/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_post200_with_payload_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_post200_with_payload_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/post/payload/200" + url = '/lro/post/payload/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_lros_post202_retry200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/post/202/retry/200" + url = '/lro/post/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_post202_no_retry204_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/post/202/noretry/204" + url = '/lro/post/202/noretry/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_lros_post_double_headers_final_location_get_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_post_double_headers_final_location_get_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/LROPostDoubleHeadersFinalLocationGet" + url = '/lro/LROPostDoubleHeadersFinalLocationGet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_post_double_headers_final_azure_header_get_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_post_double_headers_final_azure_header_get_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGet" + url = '/lro/LROPostDoubleHeadersFinalAzureHeaderGet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lros_post_double_headers_final_azure_header_get_default_request_initial(**kwargs: Any) -> HttpRequest: +def build_lros_post_double_headers_final_azure_header_get_default_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault" + url = '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_lros_post_async_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/retry/succeeded" + url = '/lro/postasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_post_async_no_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/noretry/succeeded" + url = '/lro/postasync/noretry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_post_async_retry_failed_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/retry/failed" + url = '/lro/postasync/retry/failed' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lros_post_async_retrycanceled_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/postasync/retry/canceled" + url = '/lro/postasync/retry/canceled' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lro_retrys_put201_creating_succeeded200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/put/201/creating/succeeded/200" + url = '/lro/retryerror/put/201/creating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lro_retrys_put_async_relative_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/putasync/retry/succeeded" + url = '/lro/retryerror/putasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial(**kwargs: Any) -> HttpRequest: +def build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded" + url = '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lro_retrys_delete202_retry200_request_initial(**kwargs: Any) -> HttpRequest: +def build_lro_retrys_delete202_retry200_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/retryerror/delete/202/retry/200" + url = '/lro/retryerror/delete/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lro_retrys_delete_async_relative_retry_succeeded_request_initial(**kwargs: Any) -> HttpRequest: +def build_lro_retrys_delete_async_relative_retry_succeeded_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/retryerror/deleteasync/retry/succeeded" + url = '/lro/retryerror/deleteasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) def build_lro_retrys_post202_retry200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/post/202/retry/200" + url = '/lro/retryerror/post/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lro_retrys_post_async_relative_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/retryerror/postasync/retry/succeeded" + url = '/lro/retryerror/postasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_non_retry400_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/put/400" + url = '/lro/nonretryerror/put/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_non_retry201_creating400_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/put/201/creating/400" + url = '/lro/nonretryerror/put/201/creating/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_non_retry201_creating400_invalid_json_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/put/201/creating/400/invalidjson" + url = '/lro/nonretryerror/put/201/creating/400/invalidjson' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_async_relative_retry400_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/putasync/retry/400" + url = '/lro/nonretryerror/putasync/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_lrosads_delete_non_retry400_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete_non_retry400_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/nonretryerror/delete/400" + url = '/lro/nonretryerror/delete/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lrosads_delete202_non_retry400_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete202_non_retry400_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/nonretryerror/delete/202/retry/400" + url = '/lro/nonretryerror/delete/202/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lrosads_delete_async_relative_retry400_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete_async_relative_retry400_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/nonretryerror/deleteasync/retry/400" + url = '/lro/nonretryerror/deleteasync/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) def build_lrosads_post_non_retry400_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/post/400" + url = '/lro/nonretryerror/post/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_post202_non_retry400_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/post/202/retry/400" + url = '/lro/nonretryerror/post/202/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_post_async_relative_retry400_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/nonretryerror/postasync/retry/400" + url = '/lro/nonretryerror/postasync/retry/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_error201_no_provisioning_state_payload_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/put/201/noprovisioningstatepayload" + url = '/lro/error/put/201/noprovisioningstatepayload' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_async_relative_retry_no_status_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/nostatus" + url = '/lro/error/putasync/retry/nostatus' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_async_relative_retry_no_status_payload_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/nostatuspayload" + url = '/lro/error/putasync/retry/nostatuspayload' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_lrosads_delete204_succeeded_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete204_succeeded_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/error/delete/204/nolocation" + url = '/lro/error/delete/204/nolocation' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lrosads_delete_async_relative_retry_no_status_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete_async_relative_retry_no_status_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/error/deleteasync/retry/nostatus" + url = '/lro/error/deleteasync/retry/nostatus' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) def build_lrosads_post202_no_location_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/post/202/nolocation" + url = '/lro/error/post/202/nolocation' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_post_async_relative_retry_no_payload_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/postasync/retry/nopayload" + url = '/lro/error/postasync/retry/nopayload' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put200_invalid_json_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/put/200/invalidjson" + url = '/lro/error/put/200/invalidjson' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_async_relative_retry_invalid_header_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/invalidheader" + url = '/lro/error/putasync/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_put_async_relative_retry_invalid_json_polling_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/putasync/retry/invalidjsonpolling" + url = '/lro/error/putasync/retry/invalidjsonpolling' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_lrosads_delete202_retry_invalid_header_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete202_retry_invalid_header_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/error/delete/202/retry/invalidheader" + url = '/lro/error/delete/202/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lrosads_delete_async_relative_retry_invalid_header_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete_async_relative_retry_invalid_header_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/error/deleteasync/retry/invalidheader" + url = '/lro/error/deleteasync/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) -def build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial(**kwargs: Any) -> HttpRequest: +def build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lro/error/deleteasync/retry/invalidjsonpolling" + url = '/lro/error/deleteasync/retry/invalidjsonpolling' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + **kwargs + ) def build_lrosads_post202_retry_invalid_header_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/post/202/retry/invalidheader" + url = '/lro/error/post/202/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_post_async_relative_retry_invalid_header_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/postasync/retry/invalidheader" + url = '/lro/error/postasync/retry/invalidheader' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lrosads_post_async_relative_retry_invalid_json_polling_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/error/postasync/retry/invalidjsonpolling" + url = '/lro/error/postasync/retry/invalidjsonpolling' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lr_os_custom_header_put_async_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/putasync/retry/succeeded" + url = '/lro/customheader/putasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lr_os_custom_header_put201_creating_succeeded200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/put/201/creating/succeeded/200" + url = '/lro/customheader/put/201/creating/succeeded/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lr_os_custom_header_post202_retry200_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/post/202/retry/200" + url = '/lro/customheader/post/202/retry/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_lr_os_custom_header_post_async_retry_succeeded_request_initial( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/lro/customheader/postasync/retry/succeeded" + url = '/lro/customheader/postasync/retry/succeeded' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class LROsOperations(object): # pylint: disable=too-many-public-methods """LROsOperations operations. @@ -1340,12 +2057,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _put200_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + def _put200_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1359,7 +2082,9 @@ def _put200_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1379,8 +2104,14 @@ def _put200_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> return deserialized + + @distributed_trace - def begin_put200_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put200_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -1436,16 +2167,22 @@ def begin_put200_succeeded(self, product: JSONType = None, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1457,27 +2194,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _patch200_succeeded_ignore_headers_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1491,7 +2234,9 @@ def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = None, * request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1500,9 +2245,7 @@ def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = None, * raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) if response.content: deserialized = response.json() @@ -1514,8 +2257,14 @@ def _patch200_succeeded_ignore_headers_initial(self, product: JSONType = None, * return deserialized + + @distributed_trace - def begin_patch200_succeeded_ignore_headers(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_patch200_succeeded_ignore_headers( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -1571,24 +2320,28 @@ def begin_patch200_succeeded_ignore_headers(self, product: JSONType = None, **kw "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._patch200_succeeded_ignore_headers_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + if response.content: deserialized = response.json() else: @@ -1597,27 +2350,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _patch201_retry_with_async_header_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _patch201_retry_with_async_header_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1631,7 +2390,9 @@ def _patch201_retry_with_async_header_initial(self, product: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1647,10 +2408,8 @@ def _patch201_retry_with_async_header_initial(self, product: JSONType = None, ** deserialized = None if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + if response.content: deserialized = response.json() else: @@ -1661,8 +2420,14 @@ def _patch201_retry_with_async_header_initial(self, product: JSONType = None, ** return deserialized + + @distributed_trace - def begin_patch201_retry_with_async_header(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_patch201_retry_with_async_header( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running patch request, service returns a 201 to the initial request with async header. :param product: Product to patch. @@ -1717,16 +2482,22 @@ def begin_patch201_retry_with_async_header(self, product: JSONType = None, **kwa "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._patch201_retry_with_async_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1738,29 +2509,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + def _patch202_retry_with_async_and_location_header_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1774,7 +2549,9 @@ def _patch202_retry_with_async_and_location_header_initial( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1790,11 +2567,9 @@ def _patch202_retry_with_async_and_location_header_initial( deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -1805,9 +2580,13 @@ def _patch202_retry_with_async_and_location_header_initial( return deserialized + + @distributed_trace def begin_patch202_retry_with_async_and_location_header( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[JSONType]: """Long running patch request, service returns a 202 to the initial request with async and location header. @@ -1864,16 +2643,22 @@ def begin_patch202_retry_with_async_and_location_header( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._patch202_retry_with_async_and_location_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -1885,27 +2670,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put201_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put201_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -1919,7 +2710,9 @@ def _put201_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1937,8 +2730,14 @@ def _put201_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> return deserialized + + @distributed_trace - def begin_put201_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put201_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -1994,16 +2793,22 @@ def begin_put201_succeeded(self, product: JSONType = None, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2015,31 +2820,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_list_initial(self, **kwargs: Any) -> Optional[List[JSONType]]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[JSONType]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post202_list_request_initial() + + def _post202_list_initial( + self, + **kwargs: Any + ) -> Optional[List[JSONType]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List[JSONType]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post202_list_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2056,18 +2870,22 @@ def _post202_list_initial(self, **kwargs: Any) -> Optional[List[JSONType]]: deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace - def begin_post202_list(self, **kwargs: Any) -> LROPoller[List[JSONType]]: + def begin_post202_list( + self, + **kwargs: Any + ) -> LROPoller[List[JSONType]]: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -2105,13 +2923,19 @@ def begin_post202_list(self, **kwargs: Any) -> LROPoller[List[JSONType]]: } ] """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post202_list_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post202_list_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2123,27 +2947,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put200_succeeded_no_state_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put200_succeeded_no_state_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2157,7 +2987,9 @@ def _put200_succeeded_no_state_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2175,8 +3007,14 @@ def _put200_succeeded_no_state_initial(self, product: JSONType = None, **kwargs: return deserialized + + @distributed_trace - def begin_put200_succeeded_no_state(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put200_succeeded_no_state( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -2232,16 +3070,22 @@ def begin_put200_succeeded_no_state(self, product: JSONType = None, **kwargs: An "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_succeeded_no_state_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2253,27 +3097,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2287,7 +3137,9 @@ def _put202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> J request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2305,8 +3157,14 @@ def _put202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> J return deserialized + + @distributed_trace - def begin_put202_retry200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -2363,16 +3221,22 @@ def begin_put202_retry200(self, product: JSONType = None, **kwargs: Any) -> LROP "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2384,27 +3248,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put201_creating_succeeded200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2418,7 +3288,9 @@ def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2443,8 +3315,14 @@ def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace - def begin_put201_creating_succeeded200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put201_creating_succeeded200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2501,16 +3379,22 @@ def begin_put201_creating_succeeded200(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2522,27 +3406,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put200_updating_succeeded204_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put200_updating_succeeded204_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2556,7 +3446,9 @@ def _put200_updating_succeeded204_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2574,8 +3466,14 @@ def _put200_updating_succeeded204_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace - def begin_put200_updating_succeeded204(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put200_updating_succeeded204( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2632,16 +3530,22 @@ def begin_put200_updating_succeeded204(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_updating_succeeded204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2653,27 +3557,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put201_creating_failed200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put201_creating_failed200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2687,7 +3597,9 @@ def _put201_creating_failed200_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2712,8 +3624,14 @@ def _put201_creating_failed200_initial(self, product: JSONType = None, **kwargs: return deserialized + + @distributed_trace - def begin_put201_creating_failed200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put201_creating_failed200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -2770,16 +3688,22 @@ def begin_put201_creating_failed200(self, product: JSONType = None, **kwargs: An "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_failed200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2791,27 +3715,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put200_acceptedcanceled200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put200_acceptedcanceled200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2825,7 +3755,9 @@ def _put200_acceptedcanceled200_initial(self, product: JSONType = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2843,8 +3775,14 @@ def _put200_acceptedcanceled200_initial(self, product: JSONType = None, **kwargs return deserialized + + @distributed_trace - def begin_put200_acceptedcanceled200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put200_acceptedcanceled200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -2901,16 +3839,22 @@ def begin_put200_acceptedcanceled200(self, product: JSONType = None, **kwargs: A "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_acceptedcanceled200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -2922,27 +3866,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_no_header_in_retry_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -2956,7 +3906,9 @@ def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2965,7 +3917,7 @@ def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers['location']=self._deserialize('str', response.headers.get('location')) if response.content: deserialized = response.json() @@ -2977,8 +3929,14 @@ def _put_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: An return deserialized + + @distributed_trace - def begin_put_no_header_in_retry(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_no_header_in_retry( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -3034,22 +3992,28 @@ def begin_put_no_header_in_retry(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - + response_headers['location']=self._deserialize('str', response.headers.get('location')) + if response.content: deserialized = response.json() else: @@ -3058,27 +4022,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -3092,7 +4062,9 @@ def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3101,11 +4073,9 @@ def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -3117,8 +4087,14 @@ def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: return deserialized + + @distributed_trace - def begin_put_async_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3175,26 +4151,30 @@ def begin_put_async_retry_succeeded(self, product: JSONType = None, **kwargs: An "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -3203,27 +4183,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_no_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -3237,7 +4223,9 @@ def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3246,10 +4234,8 @@ def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if response.content: deserialized = response.json() @@ -3261,8 +4247,14 @@ def _put_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace - def begin_put_async_no_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_no_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3319,25 +4311,29 @@ def begin_put_async_no_retry_succeeded(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -3346,27 +4342,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_retry_failed_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_retry_failed_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -3380,7 +4382,9 @@ def _put_async_retry_failed_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3389,11 +4393,9 @@ def _put_async_retry_failed_initial(self, product: JSONType = None, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -3405,8 +4407,14 @@ def _put_async_retry_failed_initial(self, product: JSONType = None, **kwargs: An return deserialized + + @distributed_trace - def begin_put_async_retry_failed(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_retry_failed( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3463,26 +4471,30 @@ def begin_put_async_retry_failed(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -3491,27 +4503,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_no_retrycanceled_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_no_retrycanceled_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -3525,7 +4543,9 @@ def _put_async_no_retrycanceled_initial(self, product: JSONType = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3534,10 +4554,8 @@ def _put_async_no_retrycanceled_initial(self, product: JSONType = None, **kwargs raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if response.content: deserialized = response.json() @@ -3549,8 +4567,14 @@ def _put_async_no_retrycanceled_initial(self, product: JSONType = None, **kwargs return deserialized + + @distributed_trace - def begin_put_async_no_retrycanceled(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_no_retrycanceled( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3607,25 +4631,29 @@ def begin_put_async_no_retrycanceled(self, product: JSONType = None, **kwargs: A "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_no_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -3634,27 +4662,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_no_header_in_retry_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_no_header_in_retry_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -3668,7 +4702,9 @@ def _put_async_no_header_in_retry_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3677,9 +4713,7 @@ def _put_async_no_header_in_retry_initial(self, product: JSONType = None, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) if response.content: deserialized = response.json() @@ -3691,8 +4725,14 @@ def _put_async_no_header_in_retry_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace - def begin_put_async_no_header_in_retry(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_no_header_in_retry( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -3749,24 +4789,28 @@ def begin_put_async_no_header_in_retry(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_no_header_in_retry_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + if response.content: deserialized = response.json() else: @@ -3775,27 +4819,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_non_resource_initial( + self, + sku: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: _json = sku @@ -3809,7 +4859,9 @@ def _put_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSON request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3827,8 +4879,14 @@ def _put_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSON return deserialized + + @distributed_trace - def begin_put_non_resource(self, sku: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_non_resource( + self, + sku: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request with non resource. :param sku: sku to put. @@ -3859,16 +4917,22 @@ def begin_put_non_resource(self, sku: JSONType = None, **kwargs: Any) -> LROPoll "name": "str" # Optional. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3880,27 +4944,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_non_resource_initial( + self, + sku: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if sku is not None: _json = sku @@ -3914,7 +4984,9 @@ def _put_async_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3932,8 +5004,14 @@ def _put_async_non_resource_initial(self, sku: JSONType = None, **kwargs: Any) - return deserialized + + @distributed_trace - def begin_put_async_non_resource(self, sku: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_non_resource( + self, + sku: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request with non resource. :param sku: Sku to put. @@ -3964,16 +5042,22 @@ def begin_put_async_non_resource(self, sku: JSONType = None, **kwargs: Any) -> L "name": "str" # Optional. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_non_resource_initial( - sku=sku, content_type=content_type, cls=lambda x, y, z: x, **kwargs + sku=sku, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -3985,27 +5069,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_sub_resource_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -4019,7 +5109,9 @@ def _put_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4037,8 +5129,14 @@ def _put_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> return deserialized + + @distributed_trace - def begin_put_sub_resource(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_sub_resource( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request with sub resource. :param product: Sub Product to put. @@ -4079,16 +5177,22 @@ def begin_put_sub_resource(self, product: JSONType = None, **kwargs: Any) -> LRO } } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_sub_resource_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4100,27 +5204,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_sub_resource_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_sub_resource_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -4134,7 +5244,9 @@ def _put_async_sub_resource_initial(self, product: JSONType = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4152,8 +5264,14 @@ def _put_async_sub_resource_initial(self, product: JSONType = None, **kwargs: An return deserialized + + @distributed_trace - def begin_put_async_sub_resource(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_sub_resource( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request with sub resource. :param product: Sub Product to put. @@ -4194,16 +5312,22 @@ def begin_put_async_sub_resource(self, product: JSONType = None, **kwargs: Any) } } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_sub_resource_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4215,31 +5339,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_provisioning202_accepted200_succeeded_request_initial() + + def _delete_provisioning202_accepted200_succeeded_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_provisioning202_accepted200_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4255,9 +5388,9 @@ def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) - deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -4268,8 +5401,13 @@ def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) - return deserialized + + @distributed_trace - def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_delete_provisioning202_accepted200_succeeded( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -4306,13 +5444,19 @@ def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> L "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_accepted200_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4324,31 +5468,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_provisioning202_deleting_failed200_request_initial() + + def _delete_provisioning202_deleting_failed200_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_provisioning202_deleting_failed200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4364,9 +5517,9 @@ def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any) -> J deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -4377,8 +5530,13 @@ def _delete_provisioning202_deleting_failed200_initial(self, **kwargs: Any) -> J return deserialized + + @distributed_trace - def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_delete_provisioning202_deleting_failed200( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -4415,13 +5573,19 @@ def begin_delete_provisioning202_deleting_failed200(self, **kwargs: Any) -> LROP "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_deleting_failed200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_deleting_failed200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4433,31 +5597,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_provisioning202_deletingcanceled200_request_initial() + + def _delete_provisioning202_deletingcanceled200_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_provisioning202_deletingcanceled200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4473,9 +5646,9 @@ def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: Any) -> deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -4486,8 +5659,13 @@ def _delete_provisioning202_deletingcanceled200_initial(self, **kwargs: Any) -> return deserialized + + @distributed_trace - def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_delete_provisioning202_deletingcanceled200( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -4524,13 +5702,19 @@ def begin_delete_provisioning202_deletingcanceled200(self, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_deletingcanceled200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_deletingcanceled200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4542,31 +5726,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete204_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete204_succeeded_request_initial() + + def _delete204_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete204_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4577,8 +5770,13 @@ def _delete204_succeeded_initial(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def begin_delete204_succeeded(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete204_succeeded( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete succeeds and returns right away. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -4592,43 +5790,58 @@ def begin_delete204_succeeded(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete202_retry200_request_initial() + + def _delete202_retry200_initial( + self, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete202_retry200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4645,16 +5858,22 @@ def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[JSONType]: deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace - def begin_delete202_retry200(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_delete202_retry200( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -4690,13 +5909,19 @@ def begin_delete202_retry200(self, **kwargs: Any) -> LROPoller[JSONType]: "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4708,31 +5933,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete202_no_retry204_request_initial() + + def _delete202_no_retry204_initial( + self, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete202_no_retry204_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4749,16 +5983,22 @@ def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[JSONType]: deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace - def begin_delete202_no_retry204(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_delete202_no_retry204( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -4794,13 +6034,19 @@ def begin_delete202_no_retry204(self, **kwargs: Any) -> LROPoller[JSONType]: "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_no_retry204_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_no_retry204_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -4812,31 +6058,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_no_header_in_retry_request_initial() + + def _delete_no_header_in_retry_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_no_header_in_retry_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4846,13 +6101,19 @@ def _delete_no_header_in_retry_initial(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_no_header_in_retry(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_no_header_in_retry( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -4867,43 +6128,58 @@ def begin_delete_no_header_in_retry(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_no_header_in_retry_request_initial() + + def _delete_async_no_header_in_retry_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_no_header_in_retry_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4913,13 +6189,19 @@ def _delete_async_no_header_in_retry_initial(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_no_header_in_retry(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_no_header_in_retry( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -4934,43 +6216,58 @@ def begin_delete_async_no_header_in_retry(self, **kwargs: Any) -> LROPoller[None :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_no_header_in_retry_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_retry_succeeded_request_initial() + + def _delete_async_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_retry_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4979,17 +6276,21 @@ def _delete_async_retry_succeeded_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_retry_succeeded(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_retry_succeeded( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5004,43 +6305,58 @@ def begin_delete_async_retry_succeeded(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_no_retry_succeeded_request_initial() + + def _delete_async_no_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_no_retry_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5049,17 +6365,21 @@ def _delete_async_no_retry_succeeded_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_no_retry_succeeded(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_no_retry_succeeded( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5074,43 +6394,58 @@ def begin_delete_async_no_retry_succeeded(self, **kwargs: Any) -> LROPoller[None :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_no_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_no_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_retry_failed_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_retry_failed_request_initial() + + def _delete_async_retry_failed_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_retry_failed_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5119,17 +6454,21 @@ def _delete_async_retry_failed_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_retry_failed(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_retry_failed( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5144,43 +6483,58 @@ def begin_delete_async_retry_failed(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_retry_failed_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_retry_failed_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_delete_async_retrycanceled_request_initial() + + def _delete_async_retrycanceled_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_delete_async_retrycanceled_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5189,17 +6543,21 @@ def _delete_async_retrycanceled_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_retrycanceled(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_retrycanceled( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5214,43 +6572,58 @@ def begin_delete_async_retrycanceled(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_retrycanceled_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_retrycanceled_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post200_with_payload_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post200_with_payload_request_initial() + + def _post200_with_payload_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post200_with_payload_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5275,8 +6648,13 @@ def _post200_with_payload_initial(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def begin_post200_with_payload(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_post200_with_payload( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -5300,13 +6678,19 @@ def begin_post200_with_payload(self, **kwargs: Any) -> LROPoller[JSONType]: "name": "str" # Optional. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post200_with_payload_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post200_with_payload_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -5318,27 +6702,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5352,7 +6742,9 @@ def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5361,14 +6753,21 @@ def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -5406,42 +6805,54 @@ def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post202_no_retry204_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5455,7 +6866,9 @@ def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5464,8 +6877,8 @@ def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: Any) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -5477,8 +6890,14 @@ def _post202_no_retry204_initial(self, product: JSONType = None, **kwargs: Any) return deserialized + + @distributed_trace - def begin_post202_no_retry204(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_post202_no_retry204( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -5534,23 +6953,29 @@ def begin_post202_no_retry204(self, product: JSONType = None, **kwargs: Any) -> "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_no_retry204_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -5559,31 +6984,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_double_headers_final_location_get_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post_double_headers_final_location_get_request_initial() + + def _post_double_headers_final_location_get_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post_double_headers_final_location_get_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5601,8 +7035,13 @@ def _post_double_headers_final_location_get_initial(self, **kwargs: Any) -> JSON return deserialized + + @distributed_trace - def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_post_double_headers_final_location_get( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -5639,13 +7078,19 @@ def begin_post_double_headers_final_location_get(self, **kwargs: Any) -> LROPoll "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post_double_headers_final_location_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post_double_headers_final_location_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -5657,31 +7102,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_double_headers_final_azure_header_get_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post_double_headers_final_azure_header_get_request_initial() + + def _post_double_headers_final_azure_header_get_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post_double_headers_final_azure_header_get_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5699,8 +7153,13 @@ def _post_double_headers_final_azure_header_get_initial(self, **kwargs: Any) -> return deserialized + + @distributed_trace - def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_post_double_headers_final_azure_header_get( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -5737,13 +7196,19 @@ def begin_post_double_headers_final_azure_header_get(self, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._post_double_headers_final_azure_header_get_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._post_double_headers_final_azure_header_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -5755,31 +7220,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_double_headers_final_azure_header_get_default_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lros_post_double_headers_final_azure_header_get_default_request_initial() + + def _post_double_headers_final_azure_header_get_default_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lros_post_double_headers_final_azure_header_get_default_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5797,8 +7271,13 @@ def _post_double_headers_final_azure_header_get_default_initial(self, **kwargs: return deserialized + + @distributed_trace - def begin_post_double_headers_final_azure_header_get_default(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_post_double_headers_final_azure_header_get_default( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -5835,15 +7314,19 @@ def begin_post_double_headers_final_azure_header_get_default(self, **kwargs: Any "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_double_headers_final_azure_header_get_default_initial( - cls=lambda x, y, z: x, **kwargs + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -5855,27 +7338,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -5889,7 +7378,9 @@ def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5906,19 +7397,24 @@ def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace - def begin_post_async_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_post_async_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -5975,16 +7471,22 @@ def begin_post_async_retry_succeeded(self, product: JSONType = None, **kwargs: A "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -5996,27 +7498,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_no_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6030,7 +7538,9 @@ def _post_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwa request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6047,19 +7557,24 @@ def _post_async_no_retry_succeeded_initial(self, product: JSONType = None, **kwa deserialized = None if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace - def begin_post_async_no_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_post_async_no_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -6116,16 +7631,22 @@ def begin_post_async_no_retry_succeeded(self, product: JSONType = None, **kwargs "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_no_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -6137,27 +7658,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_retry_failed_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_retry_failed_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6171,7 +7698,9 @@ def _post_async_retry_failed_initial(self, product: JSONType = None, **kwargs: A request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6180,17 +7709,22 @@ def _post_async_retry_failed_initial(self, product: JSONType = None, **kwargs: A raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post_async_retry_failed(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post_async_retry_failed( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -6229,42 +7763,54 @@ def begin_post_async_retry_failed(self, product: JSONType = None, **kwargs: Any) "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retry_failed_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_retrycanceled_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_retrycanceled_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6278,7 +7824,9 @@ def _post_async_retrycanceled_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6287,17 +7835,22 @@ def _post_async_retrycanceled_initial(self, product: JSONType = None, **kwargs: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post_async_retrycanceled(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post_async_retrycanceled( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -6336,33 +7889,37 @@ def begin_post_async_retrycanceled(self, product: JSONType = None, **kwargs: Any "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retrycanceled_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) @@ -6385,12 +7942,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + def _put201_creating_succeeded200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6404,7 +7967,9 @@ def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6429,8 +7994,14 @@ def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace - def begin_put201_creating_succeeded200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put201_creating_succeeded200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -6487,16 +8058,22 @@ def begin_put201_creating_succeeded200(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -6508,27 +8085,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_relative_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_relative_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6542,7 +8125,9 @@ def _put_async_relative_retry_succeeded_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6551,11 +8136,9 @@ def _put_async_relative_retry_succeeded_initial(self, product: JSONType = None, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -6567,8 +8150,14 @@ def _put_async_relative_retry_succeeded_initial(self, product: JSONType = None, return deserialized + + @distributed_trace - def begin_put_async_relative_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_relative_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -6625,26 +8214,30 @@ def begin_put_async_relative_retry_succeeded(self, product: JSONType = None, **k "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -6653,31 +8246,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial() + + def _delete_provisioning202_accepted200_succeeded_initial( + self, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lro_retrys_delete_provisioning202_accepted200_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6693,9 +8295,9 @@ def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) - deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -6706,8 +8308,13 @@ def _delete_provisioning202_accepted200_succeeded_initial(self, **kwargs: Any) - return deserialized + + @distributed_trace - def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> LROPoller[JSONType]: + def begin_delete_provisioning202_accepted200_succeeded( + self, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -6744,13 +8351,19 @@ def begin_delete_provisioning202_accepted200_succeeded(self, **kwargs: Any) -> L "type": "str" # Optional. Resource Type. } """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_provisioning202_accepted200_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -6762,31 +8375,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete202_retry200_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lro_retrys_delete202_retry200_request_initial() + + def _delete202_retry200_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lro_retrys_delete202_retry200_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6795,14 +8417,20 @@ def _delete202_retry200_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete202_retry200(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete202_retry200( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -6817,43 +8445,58 @@ def begin_delete202_retry200(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_retry200_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_relative_retry_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lro_retrys_delete_async_relative_retry_succeeded_request_initial() + + def _delete_async_relative_retry_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lro_retrys_delete_async_relative_retry_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6862,17 +8505,21 @@ def _delete_async_relative_retry_succeeded_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_relative_retry_succeeded(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_relative_retry_succeeded( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -6887,39 +8534,51 @@ def begin_delete_async_relative_retry_succeeded(self, **kwargs: Any) -> LROPolle :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -6933,7 +8592,9 @@ def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -6942,14 +8603,21 @@ def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -6987,42 +8655,54 @@ def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_relative_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_relative_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7036,7 +8716,9 @@ def _post_async_relative_retry_succeeded_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7045,17 +8727,22 @@ def _post_async_relative_retry_succeeded_initial(self, product: JSONType = None, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post_async_relative_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post_async_relative_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -7094,33 +8781,37 @@ def begin_post_async_relative_retry_succeeded(self, product: JSONType = None, ** "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) @@ -7143,12 +8834,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _put_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + def _put_non_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7162,7 +8859,9 @@ def _put_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7187,8 +8886,14 @@ def _put_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> return deserialized + + @distributed_trace - def begin_put_non_retry400(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_non_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 400 to the initial request. :param product: Product to put. @@ -7243,16 +8948,22 @@ def begin_put_non_retry400(self, product: JSONType = None, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -7264,27 +8975,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_non_retry201_creating400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_non_retry201_creating400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7298,7 +9015,9 @@ def _put_non_retry201_creating400_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7323,8 +9042,14 @@ def _put_non_retry201_creating400_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace - def begin_put_non_retry201_creating400(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_non_retry201_creating400( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -7380,16 +9105,22 @@ def begin_put_non_retry201_creating400(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_retry201_creating400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -7401,27 +9132,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_non_retry201_creating400_invalid_json_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_non_retry201_creating400_invalid_json_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7435,7 +9172,9 @@ def _put_non_retry201_creating400_invalid_json_initial(self, product: JSONType = request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7460,9 +9199,13 @@ def _put_non_retry201_creating400_invalid_json_initial(self, product: JSONType = return deserialized + + @distributed_trace def begin_put_non_retry201_creating400_invalid_json( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[JSONType]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -7519,16 +9262,22 @@ def begin_put_non_retry201_creating400_invalid_json( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_non_retry201_creating400_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -7540,27 +9289,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_relative_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_relative_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7574,7 +9329,9 @@ def _put_async_relative_retry400_initial(self, product: JSONType = None, **kwarg request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7583,11 +9340,9 @@ def _put_async_relative_retry400_initial(self, product: JSONType = None, **kwarg raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -7599,8 +9354,14 @@ def _put_async_relative_retry400_initial(self, product: JSONType = None, **kwarg return deserialized + + @distributed_trace - def begin_put_async_relative_retry400(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_relative_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -7656,26 +9417,30 @@ def begin_put_async_relative_retry400(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -7684,31 +9449,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_non_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_non_retry400_request_initial() + + def _delete_non_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_non_retry400_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7717,14 +9491,20 @@ def _delete_non_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_non_retry400(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_non_retry400( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 400 with an error body. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -7738,43 +9518,58 @@ def begin_delete_non_retry400(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete202_non_retry400_request_initial() + + def _delete202_non_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete202_non_retry400_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7783,14 +9578,20 @@ def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete202_non_retry400(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete202_non_retry400( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 with a location header. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -7804,43 +9605,58 @@ def begin_delete202_non_retry400(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_non_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry400_request_initial() + + def _delete_async_relative_retry400_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry400_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7849,17 +9665,21 @@ def _delete_async_relative_retry400_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_relative_retry400(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_relative_retry400( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -7874,39 +9694,51 @@ def begin_delete_async_relative_retry400(self, **kwargs: Any) -> LROPoller[None] :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry400_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_non_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -7920,7 +9752,9 @@ def _post_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -7929,14 +9763,21 @@ def _post_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post_non_retry400(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post_non_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 400 with no error body. :param product: Product to put. @@ -7973,42 +9814,54 @@ def begin_post_non_retry400(self, product: JSONType = None, **kwargs: Any) -> LR "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post202_non_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8022,7 +9875,9 @@ def _post202_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8031,14 +9886,21 @@ def _post202_non_retry400_initial(self, product: JSONType = None, **kwargs: Any) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post202_non_retry400(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post202_non_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 with a location header. :param product: Product to put. @@ -8075,42 +9937,54 @@ def begin_post202_non_retry400(self, product: JSONType = None, **kwargs: Any) -> "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_non_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_relative_retry400_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_relative_retry400_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8124,7 +9998,9 @@ def _post_async_relative_retry400_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8133,17 +10009,22 @@ def _post_async_relative_retry400_initial(self, product: JSONType = None, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post_async_relative_retry400(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post_async_relative_retry400( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -8181,42 +10062,54 @@ def begin_post_async_relative_retry400(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry400_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_error201_no_provisioning_state_payload_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_error201_no_provisioning_state_payload_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8230,7 +10123,9 @@ def _put_error201_no_provisioning_state_payload_initial(self, product: JSONType request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8255,9 +10150,13 @@ def _put_error201_no_provisioning_state_payload_initial(self, product: JSONType return deserialized + + @distributed_trace def begin_put_error201_no_provisioning_state_payload( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[JSONType]: """Long running put request, service returns a 201 to the initial request with no payload. @@ -8313,16 +10212,22 @@ def begin_put_error201_no_provisioning_state_payload( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_error201_no_provisioning_state_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -8334,27 +10239,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_relative_retry_no_status_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_relative_retry_no_status_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8368,7 +10279,9 @@ def _put_async_relative_retry_no_status_initial(self, product: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8377,11 +10290,9 @@ def _put_async_relative_retry_no_status_initial(self, product: JSONType = None, raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -8393,8 +10304,14 @@ def _put_async_relative_retry_no_status_initial(self, product: JSONType = None, return deserialized + + @distributed_trace - def begin_put_async_relative_retry_no_status(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_relative_retry_no_status( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -8451,26 +10368,30 @@ def begin_put_async_relative_retry_no_status(self, product: JSONType = None, **k "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_no_status_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -8479,27 +10400,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_relative_retry_no_status_payload_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_relative_retry_no_status_payload_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8513,7 +10440,9 @@ def _put_async_relative_retry_no_status_payload_initial(self, product: JSONType request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8522,11 +10451,9 @@ def _put_async_relative_retry_no_status_payload_initial(self, product: JSONType raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -8538,9 +10465,13 @@ def _put_async_relative_retry_no_status_payload_initial(self, product: JSONType return deserialized + + @distributed_trace def begin_put_async_relative_retry_no_status_payload( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -8598,26 +10529,30 @@ def begin_put_async_relative_retry_no_status_payload( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_no_status_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -8626,31 +10561,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete204_succeeded_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete204_succeeded_request_initial() + + def _delete204_succeeded_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete204_succeeded_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8661,8 +10605,13 @@ def _delete204_succeeded_initial(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def begin_delete204_succeeded(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete204_succeeded( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 204 to the initial request, indicating success. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -8676,43 +10625,58 @@ def begin_delete204_succeeded(self, **kwargs: Any) -> LROPoller[None]: :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete204_succeeded_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_relative_retry_no_status_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry_no_status_request_initial() + + def _delete_async_relative_retry_no_status_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry_no_status_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8721,17 +10685,21 @@ def _delete_async_relative_retry_no_status_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_relative_retry_no_status(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_relative_retry_no_status( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -8746,39 +10714,51 @@ def begin_delete_async_relative_retry_no_status(self, **kwargs: Any) -> LROPolle :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_no_status_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_no_status_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_no_location_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post202_no_location_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8792,7 +10772,9 @@ def _post202_no_location_initial(self, product: JSONType = None, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8801,14 +10783,21 @@ def _post202_no_location_initial(self, product: JSONType = None, **kwargs: Any) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post202_no_location(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post202_no_location( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -8846,42 +10835,54 @@ def begin_post202_no_location(self, product: JSONType = None, **kwargs: Any) -> "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_no_location_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_relative_retry_no_payload_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_relative_retry_no_payload_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -8895,7 +10896,9 @@ def _post_async_relative_retry_no_payload_initial(self, product: JSONType = None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -8904,17 +10907,22 @@ def _post_async_relative_retry_no_payload_initial(self, product: JSONType = None raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post_async_relative_retry_no_payload(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post_async_relative_retry_no_payload( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -8953,42 +10961,54 @@ def begin_post_async_relative_retry_no_payload(self, product: JSONType = None, * "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_no_payload_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put200_invalid_json_initial(self, product: JSONType = None, **kwargs: Any) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put200_invalid_json_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> Optional[JSONType]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9002,7 +11022,9 @@ def _put200_invalid_json_initial(self, product: JSONType = None, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9022,8 +11044,14 @@ def _put200_invalid_json_initial(self, product: JSONType = None, **kwargs: Any) return deserialized + + @distributed_trace - def begin_put200_invalid_json(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put200_invalid_json( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -9079,16 +11107,22 @@ def begin_put200_invalid_json(self, product: JSONType = None, **kwargs: Any) -> "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put200_invalid_json_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -9100,27 +11134,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put_async_relative_retry_invalid_header_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put_async_relative_retry_invalid_header_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9134,7 +11174,9 @@ def _put_async_relative_retry_invalid_header_initial(self, product: JSONType = N request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9143,11 +11185,9 @@ def _put_async_relative_retry_invalid_header_initial(self, product: JSONType = N raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -9159,9 +11199,13 @@ def _put_async_relative_retry_invalid_header_initial(self, product: JSONType = N return deserialized + + @distributed_trace def begin_put_async_relative_retry_invalid_header( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -9219,26 +11263,30 @@ def begin_put_async_relative_retry_invalid_header( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -9247,29 +11295,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + def _put_async_relative_retry_invalid_json_polling_initial( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9283,7 +11335,9 @@ def _put_async_relative_retry_invalid_json_polling_initial( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9292,11 +11346,9 @@ def _put_async_relative_retry_invalid_json_polling_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -9308,9 +11360,13 @@ def _put_async_relative_retry_invalid_json_polling_initial( return deserialized + + @distributed_trace def begin_put_async_relative_retry_invalid_json_polling( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[JSONType]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -9368,26 +11424,30 @@ def begin_put_async_relative_retry_invalid_json_polling( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -9396,31 +11456,40 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete202_retry_invalid_header_request_initial() + + def _delete202_retry_invalid_header_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete202_retry_invalid_header_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9429,14 +11498,20 @@ def _delete202_retry_invalid_header_initial(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete202_retry_invalid_header(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete202_retry_invalid_header( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -9451,43 +11526,58 @@ def begin_delete202_retry_invalid_header(self, **kwargs: Any) -> LROPoller[None] :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete202_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete202_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_relative_retry_invalid_header_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry_invalid_header_request_initial() + + def _delete_async_relative_retry_invalid_header_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry_invalid_header_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9496,17 +11586,21 @@ def _delete_async_relative_retry_invalid_header_initial(self, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_relative_retry_invalid_header(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_relative_retry_invalid_header( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -9521,43 +11615,58 @@ def begin_delete_async_relative_retry_invalid_header(self, **kwargs: Any) -> LRO :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_invalid_header_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_async_relative_retry_invalid_json_polling_initial(self, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial() + + def _delete_async_relative_retry_invalid_json_polling_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_lrosads_delete_async_relative_retry_invalid_json_polling_request_initial( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9566,17 +11675,21 @@ def _delete_async_relative_retry_invalid_json_polling_initial(self, **kwargs: An raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_delete_async_relative_retry_invalid_json_polling(self, **kwargs: Any) -> LROPoller[None]: + def begin_delete_async_relative_retry_invalid_json_polling( + self, + **kwargs: Any + ) -> LROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -9591,39 +11704,51 @@ def begin_delete_async_relative_retry_invalid_json_polling(self, **kwargs: Any) :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_async_relative_retry_invalid_json_polling_initial(cls=lambda x, y, z: x, **kwargs) - kwargs.pop("error_map", None) + raw_result = self._delete_async_relative_retry_invalid_json_polling_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_retry_invalid_header_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post202_retry_invalid_header_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9637,7 +11762,9 @@ def _post202_retry_invalid_header_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9646,14 +11773,21 @@ def _post202_retry_invalid_header_initial(self, product: JSONType = None, **kwar raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post202_retry_invalid_header(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post202_retry_invalid_header( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -9691,42 +11825,54 @@ def begin_post202_retry_invalid_header(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_relative_retry_invalid_header_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_relative_retry_invalid_header_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9740,7 +11886,9 @@ def _post_async_relative_retry_invalid_header_initial(self, product: JSONType = request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9749,18 +11897,21 @@ def _post_async_relative_retry_invalid_header_initial(self, product: JSONType = raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace def begin_post_async_relative_retry_invalid_header( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation @@ -9800,42 +11951,54 @@ def begin_post_async_relative_retry_invalid_header( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_invalid_header_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_relative_retry_invalid_json_polling_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_relative_retry_invalid_json_polling_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9849,7 +12012,9 @@ def _post_async_relative_retry_invalid_json_polling_initial(self, product: JSONT request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9858,18 +12023,21 @@ def _post_async_relative_retry_invalid_json_polling_initial(self, product: JSONT raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace def begin_post_async_relative_retry_invalid_json_polling( - self, product: JSONType = None, **kwargs: Any + self, + product: JSONType = None, + **kwargs: Any ) -> LROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation @@ -9909,33 +12077,37 @@ def begin_post_async_relative_retry_invalid_json_polling( "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_relative_retry_invalid_json_polling_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) @@ -9958,12 +12130,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + def _put_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -9977,7 +12155,9 @@ def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -9986,11 +12166,9 @@ def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) if response.content: deserialized = response.json() @@ -10002,8 +12180,14 @@ def _put_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: return deserialized + + @distributed_trace - def begin_put_async_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put_async_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -10061,26 +12245,30 @@ def begin_put_async_retry_succeeded(self, product: JSONType = None, **kwargs: An "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response_headers = {} response = pipeline_response.http_response - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if response.content: deserialized = response.json() else: @@ -10089,27 +12277,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, response_headers) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwargs: Any) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _put201_creating_succeeded200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> JSONType: + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -10123,7 +12317,9 @@ def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -10148,8 +12344,14 @@ def _put201_creating_succeeded200_initial(self, product: JSONType = None, **kwar return deserialized + + @distributed_trace - def begin_put201_creating_succeeded200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[JSONType]: + def begin_put201_creating_succeeded200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[JSONType]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -10207,16 +12409,22 @@ def begin_put201_creating_succeeded200(self, product: JSONType = None, **kwargs: "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._put201_creating_succeeded200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -10228,27 +12436,33 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post202_retry200_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -10262,7 +12476,9 @@ def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -10271,14 +12487,21 @@ def _post202_retry200_initial(self, product: JSONType = None, **kwargs: Any) -> raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post202_retry200( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -10317,42 +12540,54 @@ def begin_post202_retry200(self, product: JSONType = None, **kwargs: Any) -> LRO "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post202_retry200_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs: Any) -> None: - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + + def _post_async_retry_succeeded_initial( + self, + product: JSONType = None, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if product is not None: _json = product @@ -10366,7 +12601,9 @@ def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -10375,17 +12612,22 @@ def _post_async_retry_succeeded_initial(self, product: JSONType = None, **kwargs raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def begin_post_async_retry_succeeded(self, product: JSONType = None, **kwargs: Any) -> LROPoller[None]: + def begin_post_async_retry_succeeded( + self, + product: JSONType = None, + **kwargs: Any + ) -> LROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -10425,32 +12667,38 @@ def begin_post_async_retry_succeeded(self, product: JSONType = None, **kwargs: A "type": "str" # Optional. Resource Type. } """ - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[None] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._post_async_retry_succeeded_initial( - product=product, content_type=content_type, cls=lambda x, y, z: x, **kwargs + product=product, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py index 226e1d293dc..73e7389d758 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Long-running Operation for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/__init__.py index 20185994f95..f347f9b0b0d 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["LROWithParamaterizedEndpoints"] +__all__ = ['LROWithParamaterizedEndpoints'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_configuration.py index 70bafa84f17..2229138a594 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_configuration.py @@ -25,25 +25,30 @@ class LROWithParamaterizedEndpointsConfiguration(Configuration): # pylint: disa :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(LROWithParamaterizedEndpointsConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "lrowithparamaterizedendpoints/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'lrowithparamaterizedendpoints/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_lro_with_paramaterized_endpoints.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_lro_with_paramaterized_endpoints.py index d0a8cacc182..6eab9799194 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_lro_with_paramaterized_endpoints.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_lro_with_paramaterized_endpoints.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LROWithParamaterizedEndpoints(LROWithParamaterizedEndpointsOperationsMixin): """Test Infrastructure for AutoRest. @@ -31,8 +30,12 @@ class LROWithParamaterizedEndpoints(LROWithParamaterizedEndpointsOperationsMixin Retry-After header is present. """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = LROWithParamaterizedEndpointsConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -40,6 +43,7 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest @@ -64,7 +68,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/__init__.py index ca05269fe54..278053ab3bb 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import LROWithParamaterizedEndpointsOperationsMixin __all__ = [ - "LROWithParamaterizedEndpointsOperationsMixin", + 'LROWithParamaterizedEndpointsOperationsMixin', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py index ef3518952cc..57bbfe9a13f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -24,61 +18,83 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_poll_with_parameterized_endpoints_request_initial(**kwargs: Any) -> HttpRequest: +def build_poll_with_parameterized_endpoints_request_initial( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/lroParameterizedEndpoints" + url = '/lroParameterizedEndpoints' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_poll_with_constant_parameterized_endpoints_request_initial(**kwargs: Any) -> HttpRequest: - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str +def build_poll_with_constant_parameterized_endpoints_request_initial( + **kwargs: Any +) -> HttpRequest: + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str accept = "application/json" # Construct URL - url = "/lroConstantParameterizedEndpoints/{constantParameter}" + url = '/lroConstantParameterizedEndpoints/{constantParameter}' path_format_arguments = { - "constantParameter": _SERIALIZER.url("constant_parameter", constant_parameter, "str", skip_quote=True), + "constantParameter": _SERIALIZER.url("constant_parameter", constant_parameter, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) class LROWithParamaterizedEndpointsOperationsMixin(object): - def _poll_with_parameterized_endpoints_initial(self, account_name: str, **kwargs: Any) -> Optional[str]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_poll_with_parameterized_endpoints_request_initial() + def _poll_with_parameterized_endpoints_initial( + self, + account_name: str, + **kwargs: Any + ) -> Optional[str]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_poll_with_parameterized_endpoints_request_initial( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -95,15 +111,22 @@ def _poll_with_parameterized_endpoints_initial(self, account_name: str, **kwargs deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace - def begin_poll_with_parameterized_endpoints(self, account_name: str, **kwargs: Any) -> LROPoller[str]: + def begin_poll_with_parameterized_endpoints( + self, + account_name: str, + **kwargs: Any + ) -> LROPoller[str]: """Poll with method and client level parameters in endpoint. :param account_name: Account Name. Pass in 'local' to pass test. @@ -119,15 +142,20 @@ def begin_poll_with_parameterized_endpoints(self, account_name: str, **kwargs: A :rtype: ~azure.core.polling.LROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._poll_with_parameterized_endpoints_initial( - account_name=account_name, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -139,49 +167,53 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = LROBasePolling( - lro_delay, - lro_options={"final-state-via": "location"}, - path_format_arguments=path_format_arguments, - **kwargs - ) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _poll_with_constant_parameterized_endpoints_initial(self, account_name: str, **kwargs: Any) -> Optional[str]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str + def _poll_with_constant_parameterized_endpoints_initial( + self, + account_name: str, + **kwargs: Any + ) -> Optional[str]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + + request = build_poll_with_constant_parameterized_endpoints_request_initial( constant_parameter=constant_parameter, ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -198,15 +230,22 @@ def _poll_with_constant_parameterized_endpoints_initial(self, account_name: str, deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace - def begin_poll_with_constant_parameterized_endpoints(self, account_name: str, **kwargs: Any) -> LROPoller[str]: + def begin_poll_with_constant_parameterized_endpoints( + self, + account_name: str, + **kwargs: Any + ) -> LROPoller[str]: """Poll with method and client level parameters in endpoint, with a constant value. :param account_name: Account Name. Pass in 'local' to pass test. @@ -225,16 +264,22 @@ def begin_poll_with_constant_parameterized_endpoints(self, account_name: str, ** :rtype: ~azure.core.polling.LROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._poll_with_constant_parameterized_endpoints_initial( - account_name=account_name, constant_parameter=constant_parameter, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + constant_parameter=constant_parameter, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -246,22 +291,22 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/__init__.py index c083144aca2..53484dfaccb 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._lro_with_paramaterized_endpoints import LROWithParamaterizedEndpoints - -__all__ = ["LROWithParamaterizedEndpoints"] +__all__ = ['LROWithParamaterizedEndpoints'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_configuration.py index 82ab4244e5b..1aeee6aaf3d 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_configuration.py @@ -25,22 +25,29 @@ class LROWithParamaterizedEndpointsConfiguration(Configuration): # pylint: disa :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(LROWithParamaterizedEndpointsConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "lrowithparamaterizedendpoints/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'lrowithparamaterizedendpoints/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_lro_with_paramaterized_endpoints.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_lro_with_paramaterized_endpoints.py index d020419642b..388ef4784e0 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_lro_with_paramaterized_endpoints.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_lro_with_paramaterized_endpoints.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LROWithParamaterizedEndpoints(LROWithParamaterizedEndpointsOperationsMixin): """Test Infrastructure for AutoRest. @@ -31,8 +30,12 @@ class LROWithParamaterizedEndpoints(LROWithParamaterizedEndpointsOperationsMixin Retry-After header is present. """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = LROWithParamaterizedEndpointsConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -40,7 +43,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -60,7 +68,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/__init__.py index ca05269fe54..278053ab3bb 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import LROWithParamaterizedEndpointsOperationsMixin __all__ = [ - "LROWithParamaterizedEndpointsOperationsMixin", + 'LROWithParamaterizedEndpointsOperationsMixin', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py index 6a93dea8a47..c0cfeda2b66 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -22,31 +16,37 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ..._operations._operations import ( - build_poll_with_constant_parameterized_endpoints_request_initial, - build_poll_with_parameterized_endpoints_request_initial, -) - -T = TypeVar("T") +from ..._operations._operations import build_poll_with_constant_parameterized_endpoints_request_initial, build_poll_with_parameterized_endpoints_request_initial +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class LROWithParamaterizedEndpointsOperationsMixin: - async def _poll_with_parameterized_endpoints_initial(self, account_name: str, **kwargs: Any) -> Optional[str]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - request = build_poll_with_parameterized_endpoints_request_initial() + async def _poll_with_parameterized_endpoints_initial( + self, + account_name: str, + **kwargs: Any + ) -> Optional[str]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_poll_with_parameterized_endpoints_request_initial( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -63,15 +63,22 @@ async def _poll_with_parameterized_endpoints_initial(self, account_name: str, ** deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace_async - async def begin_poll_with_parameterized_endpoints(self, account_name: str, **kwargs: Any) -> AsyncLROPoller[str]: + async def begin_poll_with_parameterized_endpoints( + self, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[str]: """Poll with method and client level parameters in endpoint. :param account_name: Account Name. Pass in 'local' to pass test. @@ -87,15 +94,20 @@ async def begin_poll_with_parameterized_endpoints(self, account_name: str, **kwa :rtype: ~azure.core.polling.AsyncLROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._poll_with_parameterized_endpoints_initial( - account_name=account_name, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -107,51 +119,53 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = AsyncLROBasePolling( - lro_delay, - lro_options={"final-state-via": "location"}, - path_format_arguments=path_format_arguments, - **kwargs - ) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + async def _poll_with_constant_parameterized_endpoints_initial( - self, account_name: str, **kwargs: Any + self, + account_name: str, + **kwargs: Any ) -> Optional[str]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + request = build_poll_with_constant_parameterized_endpoints_request_initial( constant_parameter=constant_parameter, ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -168,16 +182,21 @@ async def _poll_with_constant_parameterized_endpoints_initial( deserialized = None if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + + @distributed_trace_async async def begin_poll_with_constant_parameterized_endpoints( - self, account_name: str, **kwargs: Any + self, + account_name: str, + **kwargs: Any ) -> AsyncLROPoller[str]: """Poll with method and client level parameters in endpoint, with a constant value. @@ -197,16 +216,22 @@ async def begin_poll_with_constant_parameterized_endpoints( :rtype: ~azure.core.polling.AsyncLROPoller[str] :raises: ~azure.core.exceptions.HttpResponseError """ - constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[str] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[str] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._poll_with_constant_parameterized_endpoints_initial( - account_name=account_name, constant_parameter=constant_parameter, cls=lambda x, y, z: x, **kwargs + account_name=account_name, + constant_parameter=constant_parameter, + cls=lambda x,y,z: x, + **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -218,22 +243,22 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } - if polling is True: - polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py index c0c7a324c37..17f17459445 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/__init__.py index e8e67b959c7..f0189aa1367 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_auto_rest_paging_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_auto_rest_paging_test_service.py index f5faced9efd..09931c204fe 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_auto_rest_paging_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_auto_rest_paging_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestPagingTestService: """Long-running Operation for AutoRest. @@ -32,8 +31,13 @@ class AutoRestPagingTestService: Retry-After header is present. """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestPagingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -42,6 +46,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_configuration.py index 3352eae9c24..f44985e74ca 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable= attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestpagingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestpagingtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/__init__.py index deb5dd54332..f9327b479e8 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_paging_test_service import AutoRestPagingTestService - -__all__ = ["AutoRestPagingTestService"] +__all__ = ['AutoRestPagingTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_auto_rest_paging_test_service.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_auto_rest_paging_test_service.py index e1267ac5b04..16fa7a40087 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_auto_rest_paging_test_service.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_auto_rest_paging_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestPagingTestService: """Long-running Operation for AutoRest. @@ -32,7 +31,12 @@ class AutoRestPagingTestService: Retry-After header is present. """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestPagingTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -41,7 +45,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.paging = PagingOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_configuration.py index b095035214a..5b32ba327e5 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestPagingTestServiceConfiguration(Configuration): # pylint: disable= attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestPagingTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestpagingtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestpagingtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/__init__.py index 6ede331119b..221e79311bc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py index 4f12e8c1308..8646abc783f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py @@ -9,13 +9,7 @@ from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -24,34 +18,11 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_paging_first_response_empty_request, - build_paging_get_multiple_pages_failure_request, - build_paging_get_multiple_pages_failure_uri_request, - build_paging_get_multiple_pages_fragment_next_link_request, - build_paging_get_multiple_pages_fragment_with_grouping_next_link_request, - build_paging_get_multiple_pages_lro_request_initial, - build_paging_get_multiple_pages_request, - build_paging_get_multiple_pages_retry_first_request, - build_paging_get_multiple_pages_retry_second_request, - build_paging_get_multiple_pages_with_offset_request, - build_paging_get_no_item_name_pages_request, - build_paging_get_null_next_link_name_pages_request, - build_paging_get_odata_multiple_pages_request, - build_paging_get_paging_model_with_item_name_with_xms_client_name_request, - build_paging_get_single_pages_failure_request, - build_paging_get_single_pages_request, - build_paging_get_with_query_params_request, - build_paging_next_fragment_request, - build_paging_next_fragment_with_grouping_request, - build_paging_next_operation_with_query_params_request, -) - -T = TypeVar("T") +from ...operations._operations import build_paging_first_response_empty_request, build_paging_get_multiple_pages_failure_request, build_paging_get_multiple_pages_failure_uri_request, build_paging_get_multiple_pages_fragment_next_link_request, build_paging_get_multiple_pages_fragment_with_grouping_next_link_request, build_paging_get_multiple_pages_lro_request_initial, build_paging_get_multiple_pages_request, build_paging_get_multiple_pages_retry_first_request, build_paging_get_multiple_pages_retry_second_request, build_paging_get_multiple_pages_with_offset_request, build_paging_get_no_item_name_pages_request, build_paging_get_null_next_link_name_pages_request, build_paging_get_odata_multiple_pages_request, build_paging_get_paging_model_with_item_name_with_xms_client_name_request, build_paging_get_single_pages_failure_request, build_paging_get_single_pages_request, build_paging_get_with_query_params_request, build_paging_next_fragment_request, build_paging_next_fragment_with_grouping_request, build_paging_next_operation_with_query_params_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PagingOperations: """PagingOperations async operations. @@ -71,7 +42,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace - def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_no_item_name_pages( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object @@ -94,19 +68,22 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -122,7 +99,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -132,10 +111,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_null_next_link_name_pages( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object @@ -158,19 +144,22 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSONType ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -186,7 +175,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -196,10 +187,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_single_pages( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object @@ -222,19 +220,22 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -250,7 +251,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -260,10 +263,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def first_response_empty(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def first_response_empty( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. @@ -287,19 +297,22 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -315,7 +328,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -325,7 +340,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages( @@ -365,13 +384,14 @@ def get_multiple_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -380,7 +400,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -401,7 +421,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -411,10 +433,19 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_with_query_params( + self, + *, + required_query_parameter: int, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -445,15 +476,16 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) ] } """ - query_constant = kwargs.pop("query_constant", True) # type: bool - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + query_constant = kwargs.pop('query_constant', True) # type: bool + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_with_query_params_request( query_constant=query_constant, required_query_parameter=required_query_parameter, @@ -461,7 +493,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_operation_with_query_params_request( query_constant=query_constant, ) @@ -480,7 +512,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -490,7 +524,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_odata_multiple_pages( @@ -530,13 +568,14 @@ def get_odata_multiple_pages( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -545,7 +584,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -566,7 +605,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -576,7 +617,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_with_offset( @@ -619,13 +664,14 @@ def get_multiple_pages_with_offset( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -635,7 +681,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -657,7 +703,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -667,10 +715,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_retry_first( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. @@ -694,19 +749,22 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[JSONTyp ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -722,7 +780,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -732,10 +792,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_retry_second( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. @@ -759,19 +826,22 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[JSONTy ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -787,7 +857,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -797,10 +869,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_single_pages_failure( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object @@ -823,19 +902,22 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -851,7 +933,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -861,10 +945,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_failure( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object @@ -887,19 +978,22 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -915,7 +1009,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -925,10 +1021,17 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_multiple_pages_failure_uri( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object @@ -951,19 +1054,22 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[JSONTyp ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -979,7 +1085,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -989,11 +1097,19 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment. @@ -1021,13 +1137,14 @@ def get_multiple_pages_fragment_next_link( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_next_link_request( tenant=tenant, api_version=api_version, @@ -1035,7 +1152,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_request( tenant=tenant, next_link=next_link, @@ -1056,7 +1173,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1066,11 +1185,19 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_with_grouping_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> AsyncIterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. @@ -1098,13 +1225,14 @@ def get_multiple_pages_fragment_with_grouping_next_link( ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_with_grouping_next_link_request( tenant=tenant, api_version=api_version, @@ -1112,7 +1240,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_with_grouping_request( tenant=tenant, next_link=next_link, @@ -1133,7 +1261,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1143,7 +1273,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + async def _get_multiple_pages_lro_initial( self, @@ -1153,10 +1287,13 @@ async def _get_multiple_pages_lro_initial( timeout: Optional[int] = 30, **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1165,7 +1302,9 @@ async def _get_multiple_pages_lro_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1183,6 +1322,8 @@ async def _get_multiple_pages_lro_initial( return deserialized + + @distributed_trace_async async def begin_get_multiple_pages_lro( self, @@ -1213,13 +1354,14 @@ async def begin_get_multiple_pages_lro( :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1228,7 +1370,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1249,7 +1391,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1259,19 +1403,23 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._get_multiple_pages_lro_initial( client_request_id=client_request_id, maxresults=maxresults, timeout=timeout, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): @@ -1279,25 +1427,29 @@ async def internal_get_next(next_link=None): return pipeline_response return await get_next(next_link) - return AsyncItemPaged(internal_get_next, extract_data) + return AsyncItemPaged( + internal_get_next, extract_data + ) - if polling is True: - polling_method = AsyncLROBasePolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + @distributed_trace - def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def get_paging_model_with_item_name_with_xms_client_name( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. @@ -1321,19 +1473,22 @@ def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1349,7 +1504,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1359,4 +1516,8 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/__init__.py index 6ede331119b..221e79311bc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PagingOperations __all__ = [ - "PagingOperations", + 'PagingOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py index 0645f46dc3e..f82b5b12928 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -25,61 +19,87 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_paging_get_no_item_name_pages_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_no_item_name_pages_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/noitemname" + url = '/paging/noitemname' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_null_next_link_name_pages_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_null_next_link_name_pages_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/nullnextlink" + url = '/paging/nullnextlink' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_single_pages_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_single_pages_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/single" + url = '/paging/single' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_first_response_empty_request(**kwargs: Any) -> HttpRequest: +def build_paging_first_response_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/firstResponseEmpty/1" + url = '/paging/firstResponseEmpty/1' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_request( @@ -91,58 +111,79 @@ def build_paging_get_multiple_pages_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple" + url = '/paging/multiple' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_with_query_params_request(*, required_query_parameter: int, **kwargs: Any) -> HttpRequest: - query_constant = kwargs.pop("query_constant", True) # type: bool +def build_paging_get_with_query_params_request( + *, + required_query_parameter: int, + **kwargs: Any +) -> HttpRequest: + query_constant = kwargs.pop('query_constant', True) # type: bool accept = "application/json" # Construct URL - url = "/paging/multiple/getWithQueryParams" + url = '/paging/multiple/getWithQueryParams' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["requiredQueryParameter"] = _SERIALIZER.query( - "required_query_parameter", required_query_parameter, "int" - ) - query_parameters["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") + query_parameters['requiredQueryParameter'] = _SERIALIZER.query("required_query_parameter", required_query_parameter, 'int') + query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_paging_next_operation_with_query_params_request(**kwargs: Any) -> HttpRequest: - query_constant = kwargs.pop("query_constant", True) # type: bool +def build_paging_next_operation_with_query_params_request( + **kwargs: Any +) -> HttpRequest: + query_constant = kwargs.pop('query_constant', True) # type: bool accept = "application/json" # Construct URL - url = "/paging/multiple/nextOperationWithQueryParams" + url = '/paging/multiple/nextOperationWithQueryParams' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") + query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_get_odata_multiple_pages_request( @@ -154,19 +195,24 @@ def build_paging_get_odata_multiple_pages_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/odata" + url = '/paging/multiple/odata' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_with_offset_request( @@ -179,9 +225,9 @@ def build_paging_get_multiple_pages_with_offset_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/withpath/{offset}" + url = '/paging/multiple/withpath/{offset}' path_format_arguments = { - "offset": _SERIALIZER.url("offset", offset, "int"), + "offset": _SERIALIZER.url("offset", offset, 'int'), } url = _format_url_section(url, **path_format_arguments) @@ -189,120 +235,178 @@ def build_paging_get_multiple_pages_with_offset_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_retry_first_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_retry_first_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/retryfirst" + url = '/paging/multiple/retryfirst' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_retry_second_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_retry_second_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/retrysecond" + url = '/paging/multiple/retrysecond' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_single_pages_failure_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_single_pages_failure_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/single/failure" + url = '/paging/single/failure' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_failure_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_failure_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/failure" + url = '/paging/multiple/failure' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_get_multiple_pages_failure_uri_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_multiple_pages_failure_uri_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/failureuri" + url = '/paging/multiple/failureuri' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_fragment_next_link_request( - tenant: str, *, api_version: str, **kwargs: Any + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragment/{tenant}" + url = '/paging/multiple/fragment/{tenant}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_fragment_with_grouping_next_link_request( - tenant: str, *, api_version: str, **kwargs: Any + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragmentwithgrouping/{tenant}" + url = '/paging/multiple/fragmentwithgrouping/{tenant}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_get_multiple_pages_lro_request_initial( @@ -314,78 +418,111 @@ def build_paging_get_multiple_pages_lro_request_initial( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/lro" + url = '/paging/multiple/lro' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if client_request_id is not None: - header_parameters["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') if maxresults is not None: - header_parameters["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") + header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') if timeout is not None: - header_parameters["timeout"] = _SERIALIZER.header("timeout", timeout, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paging_next_fragment_request(tenant: str, next_link: str, *, api_version: str, **kwargs: Any) -> HttpRequest: +def build_paging_next_fragment_request( + tenant: str, + next_link: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragment/{tenant}/{nextLink}" + url = '/paging/multiple/fragment/{tenant}/{nextLink}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_paging_next_fragment_with_grouping_request( - tenant: str, next_link: str, *, api_version: str, **kwargs: Any + tenant: str, + next_link: str, + *, + api_version: str, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}" + url = '/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}' path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, "str"), - "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api_version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_paging_get_paging_model_with_item_name_with_xms_client_name_request(**kwargs: Any) -> HttpRequest: +def build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paging/itemNameWithXMSClientName" + url = '/paging/itemNameWithXMSClientName' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class PagingOperations(object): """PagingOperations operations. @@ -406,7 +543,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_no_item_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: + def get_no_item_name_pages( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that must return result of the default 'value' node. :return: An iterator like instance of JSON object @@ -429,19 +569,22 @@ def get_no_item_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_no_item_name_pages_request() + + request = build_paging_get_no_item_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -457,7 +600,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -467,10 +612,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: + def get_null_next_link_name_pages( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that must ignore any kind of nextLink, and stop after page 1. :return: An iterator like instance of JSON object @@ -493,19 +645,22 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_null_next_link_name_pages_request() + + request = build_paging_get_null_next_link_name_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -521,7 +676,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -531,10 +688,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages(self, **kwargs: Any) -> Iterable[JSONType]: + def get_single_pages( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that finishes on the first call without a nextlink. :return: An iterator like instance of JSON object @@ -557,19 +721,22 @@ def get_single_pages(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_request() + + request = build_paging_get_single_pages_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -585,7 +752,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -595,10 +764,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def first_response_empty(self, **kwargs: Any) -> Iterable[JSONType]: + def first_response_empty( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. @@ -622,19 +798,22 @@ def first_response_empty(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_first_response_empty_request() + + request = build_paging_first_response_empty_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -650,7 +829,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -660,7 +841,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages( @@ -700,14 +885,15 @@ def get_multiple_pages( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -716,7 +902,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -737,7 +923,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -747,10 +935,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) -> Iterable[JSONType]: + def get_with_query_params( + self, + *, + required_query_parameter: int, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -781,15 +978,16 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) ] } """ - query_constant = kwargs.pop("query_constant", True) # type: bool - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + query_constant = kwargs.pop('query_constant', True) # type: bool + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_with_query_params_request( query_constant=query_constant, required_query_parameter=required_query_parameter, @@ -797,7 +995,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_operation_with_query_params_request( query_constant=query_constant, ) @@ -816,7 +1014,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -826,7 +1026,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_odata_multiple_pages( @@ -866,14 +1070,15 @@ def get_odata_multiple_pages( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -882,7 +1087,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_odata_multiple_pages_request( client_request_id=client_request_id, maxresults=maxresults, @@ -903,7 +1108,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -913,7 +1120,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_with_offset( @@ -956,14 +1167,15 @@ def get_multiple_pages_with_offset( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -973,7 +1185,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_with_offset_request( offset=offset, client_request_id=client_request_id, @@ -995,7 +1207,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1005,10 +1219,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_retry_first( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. @@ -1032,19 +1253,22 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_first_request() + + request = build_paging_get_multiple_pages_retry_first_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1060,7 +1284,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1070,10 +1296,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_retry_second( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. @@ -1097,19 +1330,22 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_retry_second_request() + + request = build_paging_get_multiple_pages_retry_second_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1125,7 +1361,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1135,10 +1373,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_single_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: + def get_single_pages_failure( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that receives a 400 on the first call. :return: An iterator like instance of JSON object @@ -1161,19 +1406,22 @@ def get_single_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_single_pages_failure_request() + + request = build_paging_get_single_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1189,7 +1437,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1199,10 +1449,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_failure( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that receives a 400 on the second call. :return: An iterator like instance of JSON object @@ -1225,19 +1482,22 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_request() + + request = build_paging_get_multiple_pages_failure_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1253,7 +1513,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1263,10 +1525,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable[JSONType]: + def get_multiple_pages_failure_uri( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that receives an invalid nextLink. :return: An iterator like instance of JSON object @@ -1289,19 +1558,22 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_multiple_pages_failure_uri_request() + + request = build_paging_get_multiple_pages_failure_uri_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1317,7 +1589,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1327,11 +1601,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> Iterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment. @@ -1359,14 +1641,15 @@ def get_multiple_pages_fragment_next_link( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_next_link_request( tenant=tenant, api_version=api_version, @@ -1374,7 +1657,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_request( tenant=tenant, next_link=next_link, @@ -1395,7 +1678,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1405,11 +1690,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def get_multiple_pages_fragment_with_grouping_next_link( - self, tenant: str, *, api_version: str, **kwargs: Any + self, + tenant: str, + *, + api_version: str, + **kwargs: Any ) -> Iterable[JSONType]: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. @@ -1437,14 +1730,15 @@ def get_multiple_pages_fragment_with_grouping_next_link( ] } """ - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_fragment_with_grouping_next_link_request( tenant=tenant, api_version=api_version, @@ -1452,7 +1746,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_next_fragment_with_grouping_request( tenant=tenant, next_link=next_link, @@ -1473,7 +1767,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1483,7 +1779,11 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + def _get_multiple_pages_lro_initial( self, @@ -1493,10 +1793,14 @@ def _get_multiple_pages_lro_initial( timeout: Optional[int] = 30, **kwargs: Any ) -> JSONType: - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1505,7 +1809,9 @@ def _get_multiple_pages_lro_initial( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1523,6 +1829,8 @@ def _get_multiple_pages_lro_initial( return deserialized + + @distributed_trace def begin_get_multiple_pages_lro( self, @@ -1553,13 +1861,15 @@ def begin_get_multiple_pages_lro( :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1568,7 +1878,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_paging_get_multiple_pages_lro_request_initial( client_request_id=client_request_id, maxresults=maxresults, @@ -1589,7 +1899,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1599,19 +1911,23 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._get_multiple_pages_lro_initial( client_request_id=client_request_id, maxresults=maxresults, timeout=timeout, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): @@ -1619,25 +1935,29 @@ def internal_get_next(next_link=None): return pipeline_response return get_next(next_link) - return ItemPaged(internal_get_next, extract_data) + return ItemPaged( + internal_get_next, extract_data + ) - if polling is True: - polling_method = LROBasePolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + if polling is True: polling_method = LROBasePolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + @distributed_trace - def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> Iterable[JSONType]: + def get_paging_model_with_item_name_with_xms_client_name( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. @@ -1661,19 +1981,22 @@ def get_paging_model_with_item_name_with_xms_client_name(self, **kwargs: Any) -> ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(request.url) else: - - request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request() + + request = build_paging_get_paging_model_with_item_name_with_xms_client_name_request( + ) request.url = self._client.format_url(next_link) request.method = "GET" return request @@ -1689,7 +2012,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1699,4 +2024,8 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py index 3e9c4b351e5..6bdb38f58a7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Long-running Operation for AutoRest. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py index a553c7263e5..7b497d82d97 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ StorageManagementClient. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/__init__.py index 46519cbf943..1072dc10316 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["StorageManagementClient"] +__all__ = ['StorageManagementClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_configuration.py index 412ecea257a..affc0760c24 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_configuration.py @@ -35,9 +35,14 @@ class StorageManagementClientConfiguration(Configuration): # pylint: disable=to :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(StorageManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -47,24 +52,23 @@ def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "storagemanagementclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'storagemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_storage_management_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_storage_management_client.py index 8f1284e6fc0..199f3f596b6 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_storage_management_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_storage_management_client.py @@ -22,7 +22,6 @@ from azure.core.credentials import TokenCredential - class StorageManagementClient: """StorageManagementClient. @@ -52,20 +51,17 @@ def __init__( endpoint: str = "https://management.azure.com", **kwargs: Any ) -> None: - - self._config = StorageManagementClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + + self._config = StorageManagementClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/__init__.py index bba070179f2..3b85e3279ea 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._storage_management_client import StorageManagementClient - -__all__ = ["StorageManagementClient"] +__all__ = ['StorageManagementClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_configuration.py index fbf417f2d97..f65df3561c1 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_configuration.py @@ -35,9 +35,14 @@ class StorageManagementClientConfiguration(Configuration): # pylint: disable=to :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(StorageManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -47,21 +52,22 @@ def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **k self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "storagemanagementclient/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'storagemanagementclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_storage_management_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_storage_management_client.py index e30de1b900b..37489499e8f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_storage_management_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_storage_management_client.py @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class StorageManagementClient: """StorageManagementClient. @@ -52,20 +51,21 @@ def __init__( endpoint: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = StorageManagementClientConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + self._config = StorageManagementClientConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.storage_accounts = StorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.storage_accounts = StorageAccountsOperations(self._client, self._config, self._serialize, self._deserialize) self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/__init__.py index 42fdba710a5..e8fe3db0d4f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import UsageOperations __all__ = [ - "StorageAccountsOperations", - "UsageOperations", + 'StorageAccountsOperations', + 'UsageOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py index b9f348fdfc7..91722afbcdc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py @@ -9,13 +9,7 @@ from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -25,24 +19,11 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ...operations._operations import ( - build_storage_accounts_check_name_availability_request, - build_storage_accounts_create_request_initial, - build_storage_accounts_delete_request, - build_storage_accounts_get_properties_request, - build_storage_accounts_list_by_resource_group_request, - build_storage_accounts_list_keys_request, - build_storage_accounts_list_request, - build_storage_accounts_regenerate_key_request, - build_storage_accounts_update_request, - build_usage_list_request, -) - -T = TypeVar("T") +from ...operations._operations import build_storage_accounts_check_name_availability_request, build_storage_accounts_create_request_initial, build_storage_accounts_delete_request, build_storage_accounts_get_properties_request, build_storage_accounts_list_by_resource_group_request, build_storage_accounts_list_keys_request, build_storage_accounts_list_request, build_storage_accounts_regenerate_key_request, build_storage_accounts_update_request, build_usage_list_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class StorageAccountsOperations: """StorageAccountsOperations async operations. @@ -62,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def check_name_availability(self, account_name: JSONType, **kwargs: Any) -> JSONType: + async def check_name_availability( + self, + account_name: JSONType, + **kwargs: Any + ) -> JSONType: """Checks that account name is valid and is not in use. :param account_name: The name of the storage account within the specified resource group. @@ -95,12 +80,14 @@ async def check_name_availability(self, account_name: JSONType, **kwargs: Any) - Possible values include: "AccountNameInvalid", "AlreadyExists". } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = account_name @@ -113,7 +100,9 @@ async def check_name_availability(self, account_name: JSONType, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -131,15 +120,23 @@ async def check_name_availability(self, account_name: JSONType, **kwargs: Any) - return deserialized + + async def _create_initial( - self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + parameters: JSONType, + **kwargs: Any ) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = parameters @@ -154,7 +151,9 @@ async def _create_initial( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -174,9 +173,15 @@ async def _create_initial( return deserialized + + @distributed_trace_async async def begin_create( - self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + parameters: JSONType, + **kwargs: Any ) -> AsyncLROPoller[JSONType]: """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an @@ -288,12 +293,15 @@ async def begin_create( "type": "str" # Optional. Resource type. } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = await self._create_initial( resource_group_name=resource_group_name, @@ -301,10 +309,10 @@ async def begin_create( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -316,23 +324,28 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = AsyncNoPolling() - else: - polling_method = polling + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + @distributed_trace_async - async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: + async def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -345,12 +358,15 @@ async def delete(self, resource_group_name: str, account_name: str, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_storage_accounts_delete_request( resource_group_name=resource_group_name, account_name=account_name, @@ -360,7 +376,9 @@ async def delete(self, resource_group_name: str, account_name: str, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -371,8 +389,15 @@ async def delete(self, resource_group_name: str, account_name: str, **kwargs: An if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_properties(self, resource_group_name: str, account_name: str, **kwargs: Any) -> JSONType: + async def get_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> JSONType: """Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -457,12 +482,15 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_storage_accounts_get_properties_request( resource_group_name=resource_group_name, account_name=account_name, @@ -472,7 +500,9 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -490,9 +520,15 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw return deserialized + + @distributed_trace_async async def update( - self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + parameters: JSONType, + **kwargs: Any ) -> JSONType: """Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom @@ -610,12 +646,14 @@ async def update( "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = parameters @@ -630,7 +668,9 @@ async def update( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -648,8 +688,15 @@ async def update( return deserialized + + @distributed_trace_async - async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> JSONType: + async def list_keys( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> JSONType: """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -669,12 +716,15 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_storage_accounts_list_keys_request( resource_group_name=resource_group_name, account_name=account_name, @@ -684,7 +734,9 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -702,8 +754,13 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: return deserialized + + @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable[JSONType]: + def list( + self, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -797,15 +854,16 @@ def list(self, **kwargs: Any) -> AsyncIterable[JSONType]: ] } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_storage_accounts_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -813,7 +871,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_storage_accounts_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -833,7 +891,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -843,10 +903,18 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable[JSONType]: + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable[JSONType]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -942,15 +1010,16 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy ] } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_storage_accounts_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, @@ -959,7 +1028,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_storage_accounts_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, @@ -980,7 +1049,9 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -990,11 +1061,19 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged(get_next, extract_data) + + return AsyncItemPaged( + get_next, extract_data + ) + @distributed_trace_async async def regenerate_key( - self, resource_group_name: str, account_name: str, regenerate_key: JSONType, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + regenerate_key: JSONType, + **kwargs: Any ) -> JSONType: """Regenerates the access keys for the specified storage account. @@ -1024,12 +1103,14 @@ async def regenerate_key( "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = regenerate_key @@ -1044,7 +1125,9 @@ async def regenerate_key( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1082,7 +1165,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def list(self, **kwargs: Any) -> JSONType: + async def list( + self, + **kwargs: Any + ) -> JSONType: """Gets the current usage count and the limit for the resources under the subscription. :return: JSON object @@ -1113,12 +1199,15 @@ async def list(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_usage_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -1126,7 +1215,9 @@ async def list(self, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1143,3 +1234,5 @@ async def list(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/__init__.py index 42fdba710a5..e8fe3db0d4f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import UsageOperations __all__ = [ - "StorageAccountsOperations", - "UsageOperations", + 'StorageAccountsOperations', + 'UsageOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py index 10a31b09945..a9f6307a6f3 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse @@ -26,42 +20,50 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_storage_accounts_check_name_availability_request( - subscription_id: str, *, json: JSONType = None, content: Any = None, **kwargs: Any + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability" + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) @@ -74,82 +76,105 @@ def build_storage_accounts_create_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) def build_storage_accounts_delete_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - return HttpRequest(method="DELETE", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) def build_storage_accounts_get_properties_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_storage_accounts_update_request( @@ -161,29 +186,29 @@ def build_storage_accounts_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", @@ -197,81 +222,105 @@ def build_storage_accounts_update_request( def build_storage_accounts_list_keys_request( - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + account_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys" # pylint: disable=line-too-long + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_storage_accounts_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str +def build_storage_accounts_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts" + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_storage_accounts_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = ( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts" - ) + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts' path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_storage_accounts_regenerate_key_request( @@ -283,57 +332,71 @@ def build_storage_accounts_regenerate_key_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey" # pylint: disable=line-too-long + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey' # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) -def build_usage_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str +def build_usage_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str accept = "application/json, text/json" # Construct URL - url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages" + url = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -354,7 +417,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def check_name_availability(self, account_name: JSONType, **kwargs: Any) -> JSONType: + def check_name_availability( + self, + account_name: JSONType, + **kwargs: Any + ) -> JSONType: """Checks that account name is valid and is not in use. :param account_name: The name of the storage account within the specified resource group. @@ -387,12 +454,14 @@ def check_name_availability(self, account_name: JSONType, **kwargs: Any) -> JSON Possible values include: "AccountNameInvalid", "AlreadyExists". } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = account_name @@ -405,7 +474,9 @@ def check_name_availability(self, account_name: JSONType, **kwargs: Any) -> JSON request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -423,15 +494,23 @@ def check_name_availability(self, account_name: JSONType, **kwargs: Any) -> JSON return deserialized + + def _create_initial( - self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + parameters: JSONType, + **kwargs: Any ) -> Optional[JSONType]: - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = parameters @@ -446,7 +525,9 @@ def _create_initial( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -466,9 +547,15 @@ def _create_initial( return deserialized + + @distributed_trace def begin_create( - self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + parameters: JSONType, + **kwargs: Any ) -> LROPoller[JSONType]: """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an @@ -580,12 +667,15 @@ def begin_create( "type": "str" # Optional. Resource type. } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: raw_result = self._create_initial( resource_group_name=resource_group_name, @@ -593,10 +683,10 @@ def begin_create( parameters=parameters, api_version=api_version, content_type=content_type, - cls=lambda x, y, z: x, + cls=lambda x,y,z: x, **kwargs ) - kwargs.pop("error_map", None) + kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): response = pipeline_response.http_response @@ -608,23 +698,28 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: - polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: - polling_method = NoPolling() - else: - polling_method = polling + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output, + deserialization_callback=get_long_running_output ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + @distributed_trace - def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: + def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -637,12 +732,15 @@ def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_storage_accounts_delete_request( resource_group_name=resource_group_name, account_name=account_name, @@ -652,7 +750,9 @@ def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -663,8 +763,15 @@ def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_properties(self, resource_group_name: str, account_name: str, **kwargs: Any) -> JSONType: + def get_properties( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> JSONType: """Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -749,12 +856,15 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_storage_accounts_get_properties_request( resource_group_name=resource_group_name, account_name=account_name, @@ -764,7 +874,9 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -782,8 +894,16 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: return deserialized + + @distributed_trace - def update(self, resource_group_name: str, account_name: str, parameters: JSONType, **kwargs: Any) -> JSONType: + def update( + self, + resource_group_name: str, + account_name: str, + parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. This API can only be used to update one of tags, @@ -900,12 +1020,14 @@ def update(self, resource_group_name: str, account_name: str, parameters: JSONTy "type": "str" # Optional. Resource type. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = parameters @@ -920,7 +1042,9 @@ def update(self, resource_group_name: str, account_name: str, parameters: JSONTy request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -938,8 +1062,15 @@ def update(self, resource_group_name: str, account_name: str, parameters: JSONTy return deserialized + + @distributed_trace - def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> JSONType: + def list_keys( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> JSONType: """Lists the access keys for the specified storage account. :param resource_group_name: The name of the resource group within the user’s subscription. @@ -959,12 +1090,15 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_storage_accounts_list_keys_request( resource_group_name=resource_group_name, account_name=account_name, @@ -974,7 +1108,9 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -992,8 +1128,13 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) return deserialized + + @distributed_trace - def list(self, **kwargs: Any) -> Iterable[JSONType]: + def list( + self, + **kwargs: Any + ) -> Iterable[JSONType]: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -1087,15 +1228,16 @@ def list(self, **kwargs: Any) -> Iterable[JSONType]: ] } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_storage_accounts_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -1103,7 +1245,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_storage_accounts_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -1123,7 +1265,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1133,10 +1277,18 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable[JSONType]: + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable[JSONType]: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -1232,15 +1384,16 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite ] } """ - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) def prepare_request(next_link=None): if not next_link: - + request = build_storage_accounts_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, @@ -1249,7 +1402,7 @@ def prepare_request(next_link=None): request.url = self._client.format_url(request.url) else: - + request = build_storage_accounts_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, @@ -1270,7 +1423,9 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1280,11 +1435,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + + return ItemPaged( + get_next, extract_data + ) + @distributed_trace def regenerate_key( - self, resource_group_name: str, account_name: str, regenerate_key: JSONType, **kwargs: Any + self, + resource_group_name: str, + account_name: str, + regenerate_key: JSONType, + **kwargs: Any ) -> JSONType: """Regenerates the access keys for the specified storage account. @@ -1314,12 +1477,14 @@ def regenerate_key( "key2": "str" # Optional. Gets the value of key 2. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = regenerate_key @@ -1334,7 +1499,9 @@ def regenerate_key( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1372,7 +1539,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def list(self, **kwargs: Any) -> JSONType: + def list( + self, + **kwargs: Any + ) -> JSONType: """Gets the current usage count and the limit for the resources under the subscription. :return: JSON object @@ -1403,12 +1573,15 @@ def list(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2015-05-01-preview") # type: str + api_version = kwargs.pop('api_version', "2015-05-01-preview") # type: str + request = build_usage_list_request( subscription_id=self._config.subscription_id, api_version=api_version, @@ -1416,7 +1589,9 @@ def list(self, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1433,3 +1608,5 @@ def list(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py index 134ed19236e..76028e221e7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Some cool documentation. - """, + """ ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/__init__.py index 5516098e010..83558158f3d 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MicrosoftAzureTestUrl"] +__all__ = ['MicrosoftAzureTestUrl'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_configuration.py index 021657b2048..04a56e33132 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_configuration.py @@ -34,9 +34,14 @@ class MicrosoftAzureTestUrlConfiguration(Configuration): # pylint: disable=too- :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(MicrosoftAzureTestUrlConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -46,24 +51,23 @@ def __init__(self, subscription_id: str, credential: "TokenCredential", **kwargs self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "microsoftazuretesturl/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftazuretesturl/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_microsoft_azure_test_url.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_microsoft_azure_test_url.py index 97a6ca62b6d..c63e58bf7e5 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_microsoft_azure_test_url.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_microsoft_azure_test_url.py @@ -22,7 +22,6 @@ from azure.core.credentials import TokenCredential - class MicrosoftAzureTestUrl: """Some cool documentation. @@ -47,10 +46,8 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = MicrosoftAzureTestUrlConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + + self._config = MicrosoftAzureTestUrlConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -58,6 +55,7 @@ def __init__( self._serialize.client_side_validation = False self.group = GroupOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_vendor.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_vendor.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/__init__.py index 5595d4583ad..b02e25a00c5 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._microsoft_azure_test_url import MicrosoftAzureTestUrl - -__all__ = ["MicrosoftAzureTestUrl"] +__all__ = ['MicrosoftAzureTestUrl'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_configuration.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_configuration.py index a06f9a1af6c..29a95157580 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_configuration.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_configuration.py @@ -34,9 +34,14 @@ class MicrosoftAzureTestUrlConfiguration(Configuration): # pylint: disable=too- :paramtype api_version: str """ - def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: super(MicrosoftAzureTestUrlConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -46,21 +51,22 @@ def __init__(self, subscription_id: str, credential: "AsyncTokenCredential", **k self.subscription_id = subscription_id self.credential = credential self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "microsoftazuretesturl/{}".format(VERSION)) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'microsoftazuretesturl/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_microsoft_azure_test_url.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_microsoft_azure_test_url.py index d40818e461d..525381941ec 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_microsoft_azure_test_url.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_microsoft_azure_test_url.py @@ -22,7 +22,6 @@ from azure.core.credentials_async import AsyncTokenCredential - class MicrosoftAzureTestUrl: """Some cool documentation. @@ -47,9 +46,7 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = MicrosoftAzureTestUrlConfiguration( - subscription_id=subscription_id, credential=credential, **kwargs - ) + self._config = MicrosoftAzureTestUrlConfiguration(subscription_id=subscription_id, credential=credential, **kwargs) self._client = AsyncARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -57,7 +54,12 @@ def __init__( self._serialize.client_side_validation = False self.group = GroupOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/__init__.py index c06b3dd2915..4a68ce35f1f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import GroupOperations __all__ = [ - "GroupOperations", + 'GroupOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py index f426a73d373..4204994cdf6 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -22,12 +16,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ...operations._operations import build_group_get_sample_resource_group_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class GroupOperations: """GroupOperations async operations. @@ -47,7 +39,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> JSONType: + async def get_sample_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> JSONType: """Provides a resouce group with name 'testgroup101' and location 'West US'. :param resource_group_name: Resource Group name 'testgroup101'. @@ -65,12 +61,15 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An "name": "str" # Optional. resource group name 'testgroup101'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str + request = build_group_get_sample_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, @@ -79,7 +78,9 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -96,3 +97,5 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/__init__.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/__init__.py index c06b3dd2915..4a68ce35f1f 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/__init__.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import GroupOperations __all__ = [ - "GroupOperations", + 'GroupOperations', ] diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py index 16a20dd135f..ba55c2c5b18 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -23,40 +17,45 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_group_get_sample_resource_group_request( - subscription_id: str, resource_group_name: str, **kwargs: Any + subscription_id: str, + resource_group_name: str, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str accept = "application/json" # Construct URL - url = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" + url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class GroupOperations(object): """GroupOperations operations. @@ -77,7 +76,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> JSONType: + def get_sample_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> JSONType: """Provides a resouce group with name 'testgroup101' and location 'West US'. :param resource_group_name: Resource Group name 'testgroup101'. @@ -95,12 +98,15 @@ def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> "name": "str" # Optional. resource group name 'testgroup101'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2014-04-01-preview") # type: str + api_version = kwargs.pop('api_version', "2014-04-01-preview") # type: str + request = build_group_get_sample_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, @@ -109,7 +115,9 @@ def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -126,3 +134,5 @@ def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/__init__.py index 8f9b9ed0989..0fcfec30886 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_configuration.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_configuration.py index a846c0d8781..9c24ebf0100 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_configuration.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class LLCClientConfiguration(Configuration): +class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LLCClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedriveninitial/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedriveninitial/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_llc_client.py index c4cb2e23a1c..55805e8dc96 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/_llc_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -27,8 +26,13 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = LLCClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/__init__.py index 62eae948512..9ada3654f53 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._llc_client import LLCClient - -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_configuration.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_configuration.py index 35bdf357a0c..9a004fc2194 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_configuration.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class LLCClientConfiguration(Configuration): +class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LLCClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedriveninitial/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedriveninitial/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_llc_client.py index ec475f3a4e7..6d54c85c21c 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/aio/_llc_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -27,7 +26,12 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = LLCClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `llcservicedriveninitiallowlevel.rest`. diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/__init__.py index 7b3b78a53ab..03c8b191082 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/__init__.py @@ -20,9 +20,9 @@ from ._request_builders import build_get_optional_request # type: ignore __all__ = [ - "build_head_no_params_request", - "build_get_required_request", - "build_put_required_optional_request", - "build_post_parameters_request", - "build_get_optional_request", + 'build_head_no_params_request', + 'build_get_required_request', + 'build_put_required_optional_request', + 'build_post_parameters_request', + 'build_get_optional_request', ] diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py index 1e6154c6f00..a7bf225fa95 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -165,7 +164,7 @@ def build_post_parameters_request( # JSON input template you can fill out and use as your body input. json = { - "url": "str" # Required. + "url": "str" # Required. } """ @@ -228,3 +227,4 @@ def build_get_optional_request( headers=header_parameters, **kwargs ) + diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py index 384f89b494d..ae2f4e343ba 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/llcservicedriveninitiallowlevel/rest/params/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_head_no_params_request(**kwargs: Any) -> HttpRequest: +def build_head_no_params_request( + **kwargs: Any +) -> HttpRequest: """Head request, no params. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,25 @@ def build_head_no_params_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_required_request(*, parameter: str, **kwargs: Any) -> HttpRequest: +def build_get_required_request( + *, + parameter: str, + **kwargs: Any +) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -56,21 +66,30 @@ def build_get_required_request(*, parameter: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter"] = _SERIALIZER.query("parameter", parameter, "str") + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_put_required_optional_request( - *, required_param: str, optional_param: Optional[str] = None, **kwargs: Any + *, + required_param: str, + optional_param: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Put, has both required and optional params. @@ -89,22 +108,33 @@ def build_put_required_optional_request( accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["requiredParam"] = _SERIALIZER.query("required_param", required_param, "str") + query_parameters['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_post_parameters_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_post_parameters_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """POST a JSON. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -132,22 +162,33 @@ def build_post_parameters_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_optional_request(*, optional_param: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_optional_request( + *, + optional_param: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -163,15 +204,22 @@ def build_get_optional_request(*, optional_param: Optional[str] = None, **kwargs accept = "application/json" # Construct URL - url = "/serviceDriven/moreParameters" + url = '/serviceDriven/moreParameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/setup.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/setup.py index 4f1a6a12826..de2280bd9a0 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/setup.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenInitialLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ LLC Swagger, this is the initial swagger a service could do. - """, + """ ) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/__init__.py index 8f9b9ed0989..0fcfec30886 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_configuration.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_configuration.py index 3314e0125e8..195b140bd0a 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_configuration.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class LLCClientConfiguration(Configuration): +class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LLCClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedrivenupdateone/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedrivenupdateone/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_llc_client.py index 25f909d21fd..91d08dd4b20 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/_llc_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -27,8 +26,13 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = LLCClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/__init__.py index 62eae948512..9ada3654f53 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._llc_client import LLCClient - -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_configuration.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_configuration.py index fdb5ddb9fba..9de22ae932f 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_configuration.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class LLCClientConfiguration(Configuration): +class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for LLCClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedrivenupdateone/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedrivenupdateone/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_llc_client.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_llc_client.py index 50c0c7ccb14..a374999ca62 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_llc_client.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/aio/_llc_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -27,7 +26,12 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = LLCClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `llcservicedrivenupdateonelowlevel.rest`. diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/__init__.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/__init__.py index 725e075b7c5..4038bfc1755 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/__init__.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/__init__.py @@ -24,11 +24,11 @@ from ._request_builders import build_get_new_operation_request # type: ignore __all__ = [ - "build_head_no_params_request", - "build_get_required_request", - "build_put_required_optional_request", - "build_post_parameters_request", - "build_delete_parameters_request", - "build_get_optional_request", - "build_get_new_operation_request", + 'build_head_no_params_request', + 'build_get_required_request', + 'build_put_required_optional_request', + 'build_post_parameters_request', + 'build_delete_parameters_request', + 'build_get_optional_request', + 'build_get_new_operation_request', ] diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py index 2ae663a7223..cb1b545dc5b 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar, Union + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -309,3 +308,4 @@ def build_get_new_operation_request( headers=header_parameters, **kwargs ) + diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py index 873f60cb325..f1c67b144a6 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/llcservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py @@ -5,19 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, Optional, TypeVar, Union +from typing import Any, Dict, Optional, TypeVar, Union from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_head_no_params_request(*, new_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_head_no_params_request( + *, + new_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Head request, no params. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -33,21 +36,32 @@ def build_head_no_params_request(*, new_parameter: Optional[str] = None, **kwarg accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="HEAD", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_get_required_request(*, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_required_request( + *, + parameter: str, + new_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -65,23 +79,33 @@ def build_get_required_request(*, parameter: str, new_parameter: Optional[str] = accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter"] = _SERIALIZER.query("parameter", parameter, "str") + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_put_required_optional_request( - *, required_param: str, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any + *, + required_param: str, + optional_param: Optional[str] = None, + new_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Put, has both required and optional params. @@ -102,24 +126,35 @@ def build_put_required_optional_request( accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["requiredParam"] = _SERIALIZER.query("required_param", required_param, "str") + query_parameters['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_post_parameters_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_post_parameters_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """POST a JSON or a JPEG. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -147,22 +182,31 @@ def build_post_parameters_request(*, json: JSONType = None, content: Any = None, json = b'bytes' # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_delete_parameters_request(**kwargs: Any) -> HttpRequest: +def build_delete_parameters_request( + **kwargs: Any +) -> HttpRequest: """Delete something. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -175,13 +219,20 @@ def build_delete_parameters_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' - return HttpRequest(method="DELETE", url=url, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + **kwargs + ) def build_get_optional_request( - *, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any + *, + optional_param: Optional[str] = None, + new_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Get true Boolean value on path. @@ -200,23 +251,31 @@ def build_get_optional_request( accept = "application/json" # Construct URL - url = "/serviceDriven/moreParameters" + url = '/serviceDriven/moreParameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_new_operation_request(**kwargs: Any) -> HttpRequest: +def build_get_new_operation_request( + **kwargs: Any +) -> HttpRequest: """I'm a new operation. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -230,10 +289,16 @@ def build_get_new_operation_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/newPath" + url = '/serviceDriven/newPath' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/setup.py b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/setup.py index b41f4d8f5e3..741668ce762 100644 --- a/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/setup.py +++ b/test/llc/low-level/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ LLC Swagger, this is the initial swagger a service could do. - """, + """ ) diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/__init__.py index 8f9b9ed0989..0fcfec30886 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_configuration.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_configuration.py index 784bfb700ff..9c24ebf0100 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_configuration.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instanc attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedriveninitial/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedriveninitial/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_llc_client.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_llc_client.py index d0c8e721a40..b3b9acdcdea 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_llc_client.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/_llc_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -30,8 +29,13 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = LLCClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.params = ParamsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/__init__.py index 62eae948512..9ada3654f53 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._llc_client import LLCClient - -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_configuration.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_configuration.py index 1fcc6b383cf..9a004fc2194 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_configuration.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instanc attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedriveninitial/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedriveninitial/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_llc_client.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_llc_client.py index ac11c954e5a..1f5e07eedfa 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_llc_client.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/_llc_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -30,7 +29,12 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = LLCClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.params = ParamsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/__init__.py index 381fd4322b6..076a9bd8411 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParamsOperations __all__ = [ - "ParamsOperations", + 'ParamsOperations', ] diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py index e1d03f8dc6c..cc202d8a203 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/aio/operations/_operations.py @@ -8,31 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_params_get_optional_request, - build_params_get_required_request, - build_params_head_no_params_request, - build_params_post_parameters_request, - build_params_put_required_optional_request, -) - -T = TypeVar("T") +from ...operations._operations import build_params_get_optional_request, build_params_get_required_request, build_params_head_no_params_request, build_params_post_parameters_request, build_params_put_required_optional_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ParamsOperations: """ParamsOperations async operations. @@ -52,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head_no_params(self, **kwargs: Any) -> Any: + async def head_no_params( + self, + **kwargs: Any + ) -> Any: """Head request, no params. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_params_head_no_params_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_head_no_params_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -85,8 +80,15 @@ async def head_no_params(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def get_required(self, *, parameter: str, **kwargs: Any) -> Any: + async def get_required( + self, + *, + parameter: str, + **kwargs: Any + ) -> Any: """Get true Boolean value on path. :keyword parameter: I am a required parameter. @@ -95,17 +97,22 @@ async def get_required(self, *, parameter: str, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_params_get_required_request( parameter=parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -123,9 +130,15 @@ async def get_required(self, *, parameter: str, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async async def put_required_optional( - self, *, required_param: str, optional_param: Optional[str] = None, **kwargs: Any + self, + *, + required_param: str, + optional_param: Optional[str] = None, + **kwargs: Any ) -> Any: """Put, has both required and optional params. @@ -137,10 +150,13 @@ async def put_required_optional( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_params_put_required_optional_request( required_param=required_param, optional_param=optional_param, @@ -148,7 +164,9 @@ async def put_required_optional( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -166,8 +184,14 @@ async def put_required_optional( return deserialized + + @distributed_trace_async - async def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: + async def post_parameters( + self, + parameter: JSONType, + **kwargs: Any + ) -> Any: """POST a JSON. :param parameter: I am a body parameter. My only valid JSON entry is { url: @@ -185,11 +209,13 @@ async def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: "url": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = parameter @@ -200,7 +226,9 @@ async def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -218,8 +246,15 @@ async def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: Any) -> Any: + async def get_optional( + self, + *, + optional_param: Optional[str] = None, + **kwargs: Any + ) -> Any: """Get true Boolean value on path. :keyword optional_param: I am an optional parameter. @@ -228,17 +263,22 @@ async def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_params_get_optional_request( optional_param=optional_param, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -255,3 +295,5 @@ async def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/__init__.py index 381fd4322b6..076a9bd8411 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParamsOperations __all__ = [ - "ParamsOperations", + 'ParamsOperations', ] diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py index 9293ee0a822..1bef387098c 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/llcservicedriveninitialversiontolerant/operations/_operations.py @@ -8,107 +8,146 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_params_head_no_params_request(**kwargs: Any) -> HttpRequest: +def build_params_head_no_params_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_params_get_required_request(*, parameter: str, **kwargs: Any) -> HttpRequest: +def build_params_get_required_request( + *, + parameter: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter"] = _SERIALIZER.query("parameter", parameter, "str") + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_params_put_required_optional_request( - *, required_param: str, optional_param: Optional[str] = None, **kwargs: Any + *, + required_param: str, + optional_param: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["requiredParam"] = _SERIALIZER.query("required_param", required_param, "str") + query_parameters['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_params_post_parameters_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_params_post_parameters_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_params_get_optional_request(*, optional_param: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_params_get_optional_request( + *, + optional_param: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/moreParameters" + url = '/serviceDriven/moreParameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ParamsOperations(object): """ParamsOperations operations. @@ -129,22 +168,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head_no_params(self, **kwargs: Any) -> Any: + def head_no_params( + self, + **kwargs: Any + ) -> Any: """Head request, no params. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_params_head_no_params_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_head_no_params_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -162,8 +210,15 @@ def head_no_params(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def get_required(self, *, parameter: str, **kwargs: Any) -> Any: + def get_required( + self, + *, + parameter: str, + **kwargs: Any + ) -> Any: """Get true Boolean value on path. :keyword parameter: I am a required parameter. @@ -172,17 +227,23 @@ def get_required(self, *, parameter: str, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_get_required_request( parameter=parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -200,8 +261,16 @@ def get_required(self, *, parameter: str, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def put_required_optional(self, *, required_param: str, optional_param: Optional[str] = None, **kwargs: Any) -> Any: + def put_required_optional( + self, + *, + required_param: str, + optional_param: Optional[str] = None, + **kwargs: Any + ) -> Any: """Put, has both required and optional params. :keyword required_param: I am a required parameter. @@ -212,10 +281,14 @@ def put_required_optional(self, *, required_param: str, optional_param: Optional :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_put_required_optional_request( required_param=required_param, optional_param=optional_param, @@ -223,7 +296,9 @@ def put_required_optional(self, *, required_param: str, optional_param: Optional request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -241,8 +316,14 @@ def put_required_optional(self, *, required_param: str, optional_param: Optional return deserialized + + @distributed_trace - def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: + def post_parameters( + self, + parameter: JSONType, + **kwargs: Any + ) -> Any: """POST a JSON. :param parameter: I am a body parameter. My only valid JSON entry is { url: @@ -260,11 +341,13 @@ def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: "url": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = parameter @@ -275,7 +358,9 @@ def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -293,8 +378,15 @@ def post_parameters(self, parameter: JSONType, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: Any) -> Any: + def get_optional( + self, + *, + optional_param: Optional[str] = None, + **kwargs: Any + ) -> Any: """Get true Boolean value on path. :keyword optional_param: I am an optional parameter. @@ -303,17 +395,23 @@ def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: Any) - :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_get_optional_request( optional_param=optional_param, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -330,3 +428,5 @@ def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: Any) - return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/setup.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/setup.py index 4f1a6a12826..de2280bd9a0 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/setup.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenInitialVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ LLC Swagger, this is the initial swagger a service could do. - """, + """ ) diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/__init__.py index 8f9b9ed0989..0fcfec30886 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_configuration.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_configuration.py index d85a416422c..195b140bd0a 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_configuration.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instanc attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedrivenupdateone/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedrivenupdateone/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_llc_client.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_llc_client.py index a7304a61b84..e819b9f7df1 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_llc_client.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/_llc_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -30,8 +29,13 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = LLCClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.params = ParamsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/__init__.py index 62eae948512..9ada3654f53 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._llc_client import LLCClient - -__all__ = ["LLCClient"] +__all__ = ['LLCClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_configuration.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_configuration.py index 1e241cc72df..9de22ae932f 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_configuration.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class LLCClientConfiguration(Configuration): # pylint: disable=too-many-instanc attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(LLCClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "llcservicedrivenupdateone/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'llcservicedrivenupdateone/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_llc_client.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_llc_client.py index a25bd03cd1e..aa093fef8ca 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_llc_client.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/_llc_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class LLCClient: """LLC Swagger, this is the initial swagger a service could do. @@ -30,7 +29,12 @@ class LLCClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = LLCClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.params = ParamsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/__init__.py index 381fd4322b6..076a9bd8411 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParamsOperations __all__ = [ - "ParamsOperations", + 'ParamsOperations', ] diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py index 5146d969247..ce2bdefba8e 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/aio/operations/_operations.py @@ -8,33 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_params_delete_parameters_request, - build_params_get_new_operation_request, - build_params_get_optional_request, - build_params_get_required_request, - build_params_head_no_params_request, - build_params_post_parameters_request, - build_params_put_required_optional_request, -) - -T = TypeVar("T") +from ...operations._operations import build_params_delete_parameters_request, build_params_get_new_operation_request, build_params_get_optional_request, build_params_get_required_request, build_params_head_no_params_request, build_params_post_parameters_request, build_params_put_required_optional_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ParamsOperations: """ParamsOperations async operations. @@ -54,7 +38,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> Any: + async def head_no_params( + self, + *, + new_parameter: Optional[str] = None, + **kwargs: Any + ) -> Any: """Head request, no params. :keyword new_parameter: I'm a new input optional parameter. @@ -63,17 +52,22 @@ async def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_params_head_no_params_request( new_parameter=new_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -91,8 +85,16 @@ async def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: return deserialized + + @distributed_trace_async - async def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any) -> Any: + async def get_required( + self, + *, + parameter: str, + new_parameter: Optional[str] = None, + **kwargs: Any + ) -> Any: """Get true Boolean value on path. :keyword parameter: I am a required parameter. @@ -103,10 +105,13 @@ async def get_required(self, *, parameter: str, new_parameter: Optional[str] = N :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_params_get_required_request( parameter=parameter, new_parameter=new_parameter, @@ -114,7 +119,9 @@ async def get_required(self, *, parameter: str, new_parameter: Optional[str] = N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -132,6 +139,8 @@ async def get_required(self, *, parameter: str, new_parameter: Optional[str] = N return deserialized + + @distributed_trace_async async def put_required_optional( self, @@ -153,10 +162,13 @@ async def put_required_optional( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_params_put_required_optional_request( required_param=required_param, optional_param=optional_param, @@ -165,7 +177,9 @@ async def put_required_optional( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -183,8 +197,14 @@ async def put_required_optional( return deserialized + + @distributed_trace_async - async def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) -> Any: + async def post_parameters( + self, + parameter: Union[IO, JSONType], + **kwargs: Any + ) -> Any: """POST a JSON or a JPEG. :param parameter: I am a body parameter with a new content type. My only valid JSON entry is { @@ -196,17 +216,19 @@ async def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) - :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = parameter - elif content_type.split(";")[0] in ["image/jpeg"]: + elif content_type.split(";")[0] in ['image/jpeg']: _content = parameter else: raise ValueError( @@ -222,7 +244,9 @@ async def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -240,23 +264,34 @@ async def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) - return deserialized + + @distributed_trace_async - async def delete_parameters(self, **kwargs: Any) -> None: + async def delete_parameters( + self, + **kwargs: Any + ) -> None: """Delete something. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_params_delete_parameters_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_delete_parameters_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -267,9 +302,15 @@ async def delete_parameters(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def get_optional( - self, *, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any + self, + *, + optional_param: Optional[str] = None, + new_parameter: Optional[str] = None, + **kwargs: Any ) -> Any: """Get true Boolean value on path. @@ -281,10 +322,13 @@ async def get_optional( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_params_get_optional_request( optional_param=optional_param, new_parameter=new_parameter, @@ -292,7 +336,9 @@ async def get_optional( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -310,23 +356,34 @@ async def get_optional( return deserialized + + @distributed_trace_async - async def get_new_operation(self, **kwargs: Any) -> Any: + async def get_new_operation( + self, + **kwargs: Any + ) -> Any: """I'm a new operation. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_params_get_new_operation_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_get_new_operation_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -343,3 +400,5 @@ async def get_new_operation(self, **kwargs: Any) -> Any: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/__init__.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/__init__.py index 381fd4322b6..076a9bd8411 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/__init__.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParamsOperations __all__ = [ - "ParamsOperations", + 'ParamsOperations', ] diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py index bcf94495309..a13e5b85fbc 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/llcservicedrivenupdateoneversiontolerant/operations/_operations.py @@ -8,141 +8,195 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_params_head_no_params_request(*, new_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_params_head_no_params_request( + *, + new_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_params_get_required_request( - *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any + *, + parameter: str, + new_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter"] = _SERIALIZER.query("parameter", parameter, "str") + query_parameters['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_params_put_required_optional_request( - *, required_param: str, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any + *, + required_param: str, + optional_param: Optional[str] = None, + new_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["requiredParam"] = _SERIALIZER.query("required_param", required_param, "str") + query_parameters['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_params_post_parameters_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_params_post_parameters_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_params_delete_parameters_request(**kwargs: Any) -> HttpRequest: +def build_params_delete_parameters_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/serviceDriven/parameters" + url = '/serviceDriven/parameters' - return HttpRequest(method="DELETE", url=url, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + **kwargs + ) def build_params_get_optional_request( - *, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any + *, + optional_param: Optional[str] = None, + new_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/moreParameters" + url = '/serviceDriven/moreParameters' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if optional_param is not None: - query_parameters["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") + query_parameters['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') if new_parameter is not None: - query_parameters["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") + query_parameters['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_params_get_new_operation_request(**kwargs: Any) -> HttpRequest: +def build_params_get_new_operation_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/serviceDriven/newPath" + url = '/serviceDriven/newPath' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class ParamsOperations(object): """ParamsOperations operations. @@ -163,7 +217,12 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> Any: + def head_no_params( + self, + *, + new_parameter: Optional[str] = None, + **kwargs: Any + ) -> Any: """Head request, no params. :keyword new_parameter: I'm a new input optional parameter. @@ -172,17 +231,23 @@ def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: Any) :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_head_no_params_request( new_parameter=new_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -200,8 +265,16 @@ def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: Any) return deserialized + + @distributed_trace - def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any) -> Any: + def get_required( + self, + *, + parameter: str, + new_parameter: Optional[str] = None, + **kwargs: Any + ) -> Any: """Get true Boolean value on path. :keyword parameter: I am a required parameter. @@ -212,10 +285,14 @@ def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, * :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_get_required_request( parameter=parameter, new_parameter=new_parameter, @@ -223,7 +300,9 @@ def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, * request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -241,6 +320,8 @@ def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, * return deserialized + + @distributed_trace def put_required_optional( self, @@ -262,10 +343,14 @@ def put_required_optional( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_put_required_optional_request( required_param=required_param, optional_param=optional_param, @@ -274,7 +359,9 @@ def put_required_optional( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -292,8 +379,14 @@ def put_required_optional( return deserialized + + @distributed_trace - def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) -> Any: + def post_parameters( + self, + parameter: Union[IO, JSONType], + **kwargs: Any + ) -> Any: """POST a JSON or a JPEG. :param parameter: I am a body parameter with a new content type. My only valid JSON entry is { @@ -305,17 +398,19 @@ def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = parameter - elif content_type.split(";")[0] in ["image/jpeg"]: + elif content_type.split(";")[0] in ['image/jpeg']: _content = parameter else: raise ValueError( @@ -331,7 +426,9 @@ def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -349,23 +446,34 @@ def post_parameters(self, parameter: Union[IO, JSONType], **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def delete_parameters(self, **kwargs: Any) -> None: + def delete_parameters( + self, + **kwargs: Any + ) -> None: """Delete something. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_params_delete_parameters_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_delete_parameters_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -376,9 +484,15 @@ def delete_parameters(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def get_optional( - self, *, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any + self, + *, + optional_param: Optional[str] = None, + new_parameter: Optional[str] = None, + **kwargs: Any ) -> Any: """Get true Boolean value on path. @@ -390,10 +504,14 @@ def get_optional( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_get_optional_request( optional_param=optional_param, new_parameter=new_parameter, @@ -401,7 +519,9 @@ def get_optional( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -419,23 +539,34 @@ def get_optional( return deserialized + + @distributed_trace - def get_new_operation(self, **kwargs: Any) -> Any: + def get_new_operation( + self, + **kwargs: Any + ) -> Any: """I'm a new operation. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_params_get_new_operation_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_params_get_new_operation_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -452,3 +583,5 @@ def get_new_operation(self, **kwargs: Any) -> Any: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/setup.py b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/setup.py index b41f4d8f5e3..741668ce762 100644 --- a/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/setup.py +++ b/test/llc/version-tolerant/Expected/AcceptanceTests/LLCServiceDrivenUpdateOneVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ LLC Swagger, this is the initial swagger a service could do. - """, + """ ) diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_configuration.py index 4acced8a854..e918e6b5cbe 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "0.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "0.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_multiapi_service_client.py index a6626f945bb..2d72aa07042 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_configuration.py index 341d6e79ad5..bfa9e0555d2 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "0.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "0.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_multiapi_service_client.py index 9c644cf76d6..0c5659ddf2f 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py index 171cffdb605..ac25a77a6db 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -72,7 +71,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py index ae051ada29b..b3fdab613e3 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +107,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_configuration.py index 5d770748dd5..89a224c52b3 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_multiapi_service_client.py index 6ad7f51400f..e41d6938f76 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_configuration.py index 96c5f1578ed..30b6c6a9d4d 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_multiapi_service_client.py index f91bdba5bb6..d157dfe67a4 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py index 78ae35b1947..77ff4709fd7 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -64,7 +63,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +107,11 @@ async def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -147,7 +154,7 @@ async def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -181,8 +188,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -213,7 +219,11 @@ async def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -308,7 +318,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -318,7 +332,7 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -338,8 +352,7 @@ def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return await get_next(next_link) + return await get_next(next_link) return AsyncItemPaged( internal_get_next, extract_data @@ -355,8 +368,7 @@ async def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -393,7 +405,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py index 8fd69dbe06e..068c7926c32 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -72,7 +71,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py index 8bde1f680dd..891dd6493b0 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -25,7 +24,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -187,7 +186,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,7 +231,11 @@ def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -271,7 +278,7 @@ def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,8 +312,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -338,7 +344,11 @@ def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,7 +444,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -444,7 +458,7 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -464,8 +478,7 @@ def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) return ItemPaged( internal_get_next, extract_data @@ -481,8 +494,7 @@ def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -520,7 +532,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py index cd15f639c4e..5ff97df9edf 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +107,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_configuration.py index ec6815cd02d..2cca3f321e0 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_multiapi_service_client.py index cc0189c2904..b47f959789d 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_configuration.py index 6aedc9e2c54..b74d9352252 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_multiapi_service_client.py index 7ab133f0f5f..e74caf9d0f4 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py index 32ada3c8f83..2b78a21d342 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -60,7 +59,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,7 +117,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py index b06c3e2cae2..dadb7997b68 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,7 +131,11 @@ async def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py index 625bf102a48..c19aac44073 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,7 +75,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py index e8d61937351..24e9ff37ded 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +132,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,7 +191,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py index 049f3a29f00..63c9287db1f 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +147,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,7 +198,11 @@ def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py index 5a7ff8078f6..6fd9214b181 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +113,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_configuration.py index caf3ac23e7c..7ea92522e1c 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_multiapi_service_client.py index b273922e3f3..3b4d004efd9 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_configuration.py index 2e64a577236..70a475c193a 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_multiapi_service_client.py index eaf9e2f1d04..f0a780b0a50 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py index 7fc46b2b2f3..27c8685077f 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -72,7 +71,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,7 +130,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py index 310a317246d..ce46fdc275a 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py index b4515f20809..8363114b58a 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -94,7 +93,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,7 +139,11 @@ async def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py index 62a8d45b549..0a6886af27b 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -23,7 +22,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +134,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,7 +194,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py index 5feffee8987..6977e6f3b88 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -121,7 +120,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py index 17c7e99fe88..30439b77682 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +159,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +206,11 @@ def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_configuration.py index 24128be3455..3213278fb7a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_multiapi_service_client.py index a0ac7058e29..ec0c1f94f32 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_configuration.py index 2088c591e0d..25eb1ef291b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_configuration.py @@ -15,7 +15,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -23,7 +23,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_multiapi_service_client.py index 645ad5af4e0..5c8cab29782 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core.credentials import AzureKeyCredential from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py index 2e45242d6d0..26f6722d8cd 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -64,7 +63,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +107,11 @@ async def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -147,7 +154,7 @@ async def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -181,8 +188,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -213,7 +219,11 @@ async def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -309,7 +319,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -319,7 +333,7 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,8 +353,7 @@ def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return await get_next(next_link) + return await get_next(next_link) return AsyncItemPaged( internal_get_next, extract_data @@ -356,8 +369,7 @@ async def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -394,7 +406,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py index 1320280ff5a..69b5dbf4622 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -72,7 +71,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py index ac3d53c7d32..b2394652431 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -25,7 +24,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -187,7 +186,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,7 +231,11 @@ def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -271,7 +278,7 @@ def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,8 +312,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -338,7 +344,11 @@ def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -435,7 +445,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -445,7 +459,7 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -465,8 +479,7 @@ def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) return ItemPaged( internal_get_next, extract_data @@ -482,8 +495,7 @@ def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -521,7 +533,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py index f385d9aa9aa..d7625ad974c 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +107,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_configuration.py index d0448b1b102..e2a39d53ee7 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_multiapi_service_client.py index 0d9b1a2f103..1fde13fac5b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_configuration.py index 7634323026c..2222d158dcb 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_configuration.py @@ -15,7 +15,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -23,7 +23,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_multiapi_service_client.py index f23d214eb63..184675c2931 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core.credentials import AzureKeyCredential from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py index efe812ad8c9..1a454b06639 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -60,7 +59,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,7 +117,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py index c10ac5ce59e..7d0aa89f996 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,7 +131,11 @@ async def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py index 1c85101fadf..29e320adc9f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,7 +75,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py index 6a4cb821cbc..6b20936fd36 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +132,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,7 +191,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py index 1c55df9a2b7..b77b68412d3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +147,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,7 +198,11 @@ def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py index 7c0e10f5377..4bd4c8ef678 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +113,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_configuration.py index 37da046f705..1c82e9c3da6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_multiapi_service_client.py index 52d10c3cbce..24b48059e5d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_configuration.py index 7269e3a34b4..46b7b68524a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_configuration.py @@ -15,7 +15,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -23,7 +23,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_multiapi_service_client.py index ead5912e668..7e2cd580586 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core.credentials import AzureKeyCredential from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py index 88a422a1f66..7222e2f6a8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,7 +72,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,7 +131,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py index f31afc34838..748275f3b53 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py index 0bf7950065b..880954635e6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -94,7 +93,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,7 +139,11 @@ async def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py index 8baca0f77f3..135e0fd52cc 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -23,7 +22,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +134,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,7 +194,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py index 021ce28d50e..cb4e1efbff9 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -121,7 +120,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py index d74fac6604f..aed31249898 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +159,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +206,11 @@ def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_configuration.py index 7471f6eda13..33ab9a57f26 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_configuration.py @@ -19,7 +19,7 @@ VERSION = "unknown" -class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): +class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiCustomBaseUrlServiceClient. Note that all parameters used to create this instance are saved as instance @@ -29,7 +29,8 @@ class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param endpoint: Pass in https://localhost:3000. :type endpoint: str - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/_configuration.py index 53a4586558a..6187f7c20e2 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/_configuration.py @@ -17,7 +17,7 @@ VERSION = "unknown" -class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): +class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiCustomBaseUrlServiceClient. Note that all parameters used to create this instance are saved as instance @@ -27,7 +27,8 @@ class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param endpoint: Pass in https://localhost:3000. :type endpoint: str - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py index ef9f80d2dfc..b310fa7b9b1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -59,7 +58,11 @@ async def test( } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py index c0da7d77b46..9a08dd51654 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +96,11 @@ def test( } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_configuration.py index d5749f50424..221ed4a30da 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_configuration.py @@ -19,7 +19,7 @@ VERSION = "unknown" -class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): +class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiCustomBaseUrlServiceClient. Note that all parameters used to create this instance are saved as instance @@ -29,7 +29,8 @@ class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param endpoint: Pass in https://localhost:3000. :type endpoint: str - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/_configuration.py index 75dee1608cf..ce6659adc03 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/_configuration.py @@ -17,7 +17,7 @@ VERSION = "unknown" -class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): +class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiCustomBaseUrlServiceClient. Note that all parameters used to create this instance are saved as instance @@ -27,7 +27,8 @@ class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param endpoint: Pass in https://localhost:3000. :type endpoint: str - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py index b6ab01d9aab..21e4f4fdc50 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -59,7 +58,11 @@ async def test( } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py index 9a6a3afb5f2..4f623e709e2 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +96,11 @@ def test( } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_configuration.py index 0682558ae83..61b266982c3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_configuration.py @@ -19,7 +19,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -27,7 +27,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_multiapi_service_client.py index 3732e426267..11ffb6af5de 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_configuration.py index c5b6ad794af..ee987053488 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_configuration.py @@ -17,7 +17,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -25,7 +25,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_multiapi_service_client.py index 132c43cc627..ff30f950e84 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py index 5c9ee4c94ec..9d9254ec209 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -63,7 +62,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +106,11 @@ async def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -146,7 +153,7 @@ async def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -180,8 +187,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -212,7 +218,11 @@ async def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -307,7 +317,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -317,7 +331,7 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -337,8 +351,7 @@ def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return await get_next(next_link) + return await get_next(next_link) return AsyncItemPaged( internal_get_next, extract_data @@ -354,8 +367,7 @@ async def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -392,7 +404,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py index 6e3f0f83d22..e8a29bdcf13 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -71,7 +70,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py index f42f3b1a981..7106617737e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -24,7 +23,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -186,7 +185,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,7 +230,11 @@ def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -270,7 +277,7 @@ def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,8 +311,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -337,7 +343,11 @@ def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -433,7 +443,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -443,7 +457,7 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,8 +477,7 @@ def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) return ItemPaged( internal_get_next, extract_data @@ -480,8 +493,7 @@ def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -519,7 +531,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py index 344546ee5be..cb17725bbe8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -107,7 +106,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_configuration.py index 2add5013d7d..d0eda27ed54 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_configuration.py @@ -19,7 +19,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -27,7 +27,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_multiapi_service_client.py index 19c641421f5..ad76fdbcdca 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_configuration.py index fe3fd6e03a2..0f4efde6dbb 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_configuration.py @@ -17,7 +17,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -25,7 +25,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_multiapi_service_client.py index 3ffbcffaa24..04979d9238a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py index ed59e22eec2..c3c7f62d15e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -59,7 +58,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,7 +116,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py index 69fbf660f06..2d617fbdf37 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -81,7 +80,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,7 +130,11 @@ async def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py index 12a84e9ea69..8a98dfb06fa 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -75,7 +74,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py index 1008a328b94..08b6243d271 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +131,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -187,7 +190,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py index 022677ff329..1af7d62eb2b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +146,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,7 +197,11 @@ def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py index 486d41d2412..a2a5b61f9fc 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -113,7 +112,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_configuration.py index 3b1542955d1..6461d2f704e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_configuration.py @@ -19,7 +19,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -27,7 +27,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_multiapi_service_client.py index eaea6d11a1f..9f18d2c264c 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_configuration.py index 52a4ead4b37..9e288b1a105 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_configuration.py @@ -17,7 +17,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -25,7 +25,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_multiapi_service_client.py index 048c8e998e0..d2b321af6e2 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py index af0cd5fa616..30abc39bbda 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -71,7 +70,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,7 +129,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py index bda80f312f9..555dae0497d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -81,7 +80,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py index d1988aebf36..8d7b048c621 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -93,7 +92,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -135,7 +138,11 @@ async def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py index 10deb75e7db..dff42f65bfb 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -134,7 +133,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -190,7 +193,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py index 78233285e17..7aca6a0ba3a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -120,7 +119,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py index 8e865a553d8..0b30bd5517b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -21,7 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -159,7 +158,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,7 +205,11 @@ def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_configuration.py index 61d3c8f32b8..16a4305caa8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_multiapi_service_client.py index 02b1db826fe..f35a8cb2464 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py index ac96d6fc512..4b283a45266 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -25,7 +24,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -187,7 +186,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,7 +231,11 @@ def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -271,7 +278,7 @@ def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,8 +312,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -338,7 +344,11 @@ def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,7 +444,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -444,7 +458,7 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -464,8 +478,7 @@ def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) return ItemPaged( internal_get_next, extract_data @@ -481,8 +494,7 @@ def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -520,7 +532,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py index 63a1b75ffac..0afcc218157 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +107,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_configuration.py index 4e11e9166a4..bd969874385 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_multiapi_service_client.py index 85063c4ebd8..d37b22d362f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py index 8c6dec0ae4e..28209ca9968 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +132,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,7 +191,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py index 6eeb635b5f9..41c5ce42306 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +147,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,7 +198,11 @@ def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py index fc858480f93..903d4a04ef0 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +113,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_configuration.py index 25cb55ad7df..50a5fd5ad5b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_multiapi_service_client.py index 06238adc327..eee68bc5309 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py index 6de418d3c35..a0abede9145 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -23,7 +22,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +134,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,7 +194,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py index f8a2b8f9f8c..813309a27de 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -121,7 +120,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py index 00521866b49..00c484d5b50 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +159,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +206,11 @@ def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_configuration.py index 03d7eaed1ba..d3cf08a9739 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_multiapi_service_client.py index 5885c9795d1..91175ce4600 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_configuration.py index 8eb206e02fe..8e8f7b726b6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_multiapi_service_client.py index 36d7c82795a..cc43fc92a67 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py index 99f8de744d4..ebd351e2ab1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -64,7 +63,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +107,11 @@ async def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -147,7 +154,7 @@ async def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -181,8 +188,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -213,7 +219,11 @@ async def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -309,7 +319,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -319,7 +333,7 @@ async def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,8 +353,7 @@ def get_long_running_output(pipeline_response): async def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return await get_next(next_link) + return await get_next(next_link) return AsyncItemPaged( internal_get_next, extract_data @@ -356,8 +369,7 @@ async def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -394,7 +406,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py index 8ace7af71f7..34e6a2dcc6a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -72,7 +71,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py index 61c2e2baf6b..f14a3adef8c 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -25,7 +24,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -187,7 +186,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,7 +231,11 @@ def _test_lro_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -271,7 +278,7 @@ def begin_test_lro( :raises: ~azure.core.exceptions.HttpResponseError """ content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] lro_delay = kwargs.pop( 'polling_interval', @@ -305,8 +312,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore @@ -338,7 +344,11 @@ def _test_lro_and_paging_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -435,7 +445,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -445,7 +459,7 @@ def get_next(next_link=None): return pipeline_response - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PagingResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -465,8 +479,7 @@ def get_long_running_output(pipeline_response): def internal_get_next(next_link=None): if next_link is None: return pipeline_response - else: - return get_next(next_link) + return get_next(next_link) return ItemPaged( internal_get_next, extract_data @@ -482,8 +495,7 @@ def internal_get_next(next_link=None): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore @@ -521,7 +533,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py index 18fcdb2df10..e02f1feadba 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +107,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_configuration.py index 5174be13adb..522b1a7101f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_multiapi_service_client.py index 75e3057395d..6e60ca39738 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_configuration.py index 1a9bfd10278..8c858bb1389 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_multiapi_service_client.py index ff77a178e36..eab99792edc 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py index 5f4f06b82d2..1ac558b763e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -60,7 +59,11 @@ async def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,7 +117,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py index 3545ffe0a81..25cf4dc5cde 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,7 +131,11 @@ async def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py index 463d7d89c5d..f1d49e329c5 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,7 +75,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py index 3d2d5f02e72..7230d66aa2e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +132,11 @@ def test_one( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,7 +191,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py index 6236ddeb57f..6a62fd02468 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -148,7 +147,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,7 +198,11 @@ def test_three( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py index fda1e5e431e..be14d708492 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +113,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_configuration.py index d115e49b06c..2d7b5e2d64d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_configuration.py @@ -20,7 +20,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -28,7 +28,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_multiapi_service_client.py index 437ff6c6dc2..29f84818840 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_multiapi_service_client.py @@ -18,7 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.credentials import TokenCredential from azure.core.rest import HttpRequest, HttpResponse diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_configuration.py index fe4c0a18023..50f958e64c0 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_configuration.py @@ -18,7 +18,7 @@ VERSION = "unknown" -class MultiapiServiceClientConfiguration(Configuration): +class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultiapiServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class MultiapiServiceClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "3.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_multiapi_service_client.py index ec13b93fa03..6e37853dd19 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/_multiapi_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py index fbb896dfe57..c126cb61fce 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,7 +72,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,7 +131,11 @@ async def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py index db2af9c3ff4..0ec80d36844 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,7 +81,11 @@ async def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py index da96c1879e6..371bbaa2b0f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -94,7 +93,11 @@ async def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,7 +139,11 @@ async def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py index 4676f2ba2ef..36c026225b3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -23,7 +22,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +134,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,7 +194,11 @@ def test_different_calls( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py index 49d826f7d40..9d94da71b67 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -121,7 +120,11 @@ def test_two( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py index 46a681f22fd..75a5ca70590 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -22,7 +21,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +159,11 @@ def test_four( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +206,11 @@ def test_five( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/__init__.py index 82bd90b483e..f4e9ea3fdbc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AdditionalPropertiesClient"] +__all__ = ['AdditionalPropertiesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py index 0db71cb1e52..d6f15c1218b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AdditionalPropertiesClient(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.pets = PetsOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_configuration.py index 39a60241f8e..074f08bc8a4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AdditionalPropertiesClientConfiguration(Configuration): +class AdditionalPropertiesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AdditionalPropertiesClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AdditionalPropertiesClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AdditionalPropertiesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "additionalpropertiesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'additionalpropertiesclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/__init__.py index 43f6b8afe9d..044030f73fc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._additional_properties_client import AdditionalPropertiesClient - -__all__ = ["AdditionalPropertiesClient"] +__all__ = ['AdditionalPropertiesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py index f765184b8d5..460b7b8498e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AdditionalPropertiesClientConfiguration from .operations import PetsOperations - class AdditionalPropertiesClient: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AdditionalPropertiesClient: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AdditionalPropertiesClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.pets = PetsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_configuration.py index c431b41cf3a..d815acb6132 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AdditionalPropertiesClientConfiguration(Configuration): +class AdditionalPropertiesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AdditionalPropertiesClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AdditionalPropertiesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "additionalpropertiesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'additionalpropertiesclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/__init__.py index d049d68f253..194e6ef07bd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._pets_operations import PetsOperations __all__ = [ - "PetsOperations", + 'PetsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py index 91c2e361f0b..efe7d8917cc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,19 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._pets_operations import ( - build_create_ap_in_properties_request, - build_create_ap_in_properties_with_ap_string_request, - build_create_ap_object_request, - build_create_ap_string_request, - build_create_ap_true_request, - build_create_cat_ap_true_request, -) - -T = TypeVar("T") +from ...operations._pets_operations import build_create_ap_in_properties_request, build_create_ap_in_properties_with_ap_string_request, build_create_ap_object_request, build_create_ap_string_request, build_create_ap_true_request, build_create_cat_ap_true_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PetsOperations: """PetsOperations async operations. @@ -59,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def create_ap_true(self, create_parameters: "_models.PetAPTrue", **kwargs: Any) -> "_models.PetAPTrue": + async def create_ap_true( + self, + create_parameters: "_models.PetAPTrue", + **kwargs: Any + ) -> "_models.PetAPTrue": """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -69,23 +57,29 @@ async def create_ap_true(self, create_parameters: "_models.PetAPTrue", **kwargs: :rtype: ~additionalproperties.models.PetAPTrue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPTrue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPTrue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPTrue") + _json = self._serialize.body(create_parameters, 'PetAPTrue') request = build_create_ap_true_request( content_type=content_type, json=_json, - template_url=self.create_ap_true.metadata["url"], + template_url=self.create_ap_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,17 +87,22 @@ async def create_ap_true(self, create_parameters: "_models.PetAPTrue", **kwargs: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPTrue", pipeline_response) + deserialized = self._deserialize('PetAPTrue', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_true.metadata = {"url": "/additionalProperties/true"} # type: ignore + create_ap_true.metadata = {'url': '/additionalProperties/true'} # type: ignore + @distributed_trace_async - async def create_cat_ap_true(self, create_parameters: "_models.CatAPTrue", **kwargs: Any) -> "_models.CatAPTrue": + async def create_cat_ap_true( + self, + create_parameters: "_models.CatAPTrue", + **kwargs: Any + ) -> "_models.CatAPTrue": """Create a CatAPTrue which contains more properties than what is defined. :param create_parameters: @@ -113,23 +112,29 @@ async def create_cat_ap_true(self, create_parameters: "_models.CatAPTrue", **kwa :rtype: ~additionalproperties.models.CatAPTrue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.CatAPTrue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CatAPTrue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "CatAPTrue") + _json = self._serialize.body(create_parameters, 'CatAPTrue') request = build_create_cat_ap_true_request( content_type=content_type, json=_json, - template_url=self.create_cat_ap_true.metadata["url"], + template_url=self.create_cat_ap_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,17 +142,22 @@ async def create_cat_ap_true(self, create_parameters: "_models.CatAPTrue", **kwa error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("CatAPTrue", pipeline_response) + deserialized = self._deserialize('CatAPTrue', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_cat_ap_true.metadata = {"url": "/additionalProperties/true-subclass"} # type: ignore + create_cat_ap_true.metadata = {'url': '/additionalProperties/true-subclass'} # type: ignore + @distributed_trace_async - async def create_ap_object(self, create_parameters: "_models.PetAPObject", **kwargs: Any) -> "_models.PetAPObject": + async def create_ap_object( + self, + create_parameters: "_models.PetAPObject", + **kwargs: Any + ) -> "_models.PetAPObject": """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -157,23 +167,29 @@ async def create_ap_object(self, create_parameters: "_models.PetAPObject", **kwa :rtype: ~additionalproperties.models.PetAPObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPObject"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPObject"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPObject") + _json = self._serialize.body(create_parameters, 'PetAPObject') request = build_create_ap_object_request( content_type=content_type, json=_json, - template_url=self.create_ap_object.metadata["url"], + template_url=self.create_ap_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,17 +197,22 @@ async def create_ap_object(self, create_parameters: "_models.PetAPObject", **kwa error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPObject", pipeline_response) + deserialized = self._deserialize('PetAPObject', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_object.metadata = {"url": "/additionalProperties/type/object"} # type: ignore + create_ap_object.metadata = {'url': '/additionalProperties/type/object'} # type: ignore + @distributed_trace_async - async def create_ap_string(self, create_parameters: "_models.PetAPString", **kwargs: Any) -> "_models.PetAPString": + async def create_ap_string( + self, + create_parameters: "_models.PetAPString", + **kwargs: Any + ) -> "_models.PetAPString": """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -201,23 +222,29 @@ async def create_ap_string(self, create_parameters: "_models.PetAPString", **kwa :rtype: ~additionalproperties.models.PetAPString :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPString"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPString"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPString") + _json = self._serialize.body(create_parameters, 'PetAPString') request = build_create_ap_string_request( content_type=content_type, json=_json, - template_url=self.create_ap_string.metadata["url"], + template_url=self.create_ap_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -225,18 +252,21 @@ async def create_ap_string(self, create_parameters: "_models.PetAPString", **kwa error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPString", pipeline_response) + deserialized = self._deserialize('PetAPString', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_string.metadata = {"url": "/additionalProperties/type/string"} # type: ignore + create_ap_string.metadata = {'url': '/additionalProperties/type/string'} # type: ignore + @distributed_trace_async async def create_ap_in_properties( - self, create_parameters: "_models.PetAPInProperties", **kwargs: Any + self, + create_parameters: "_models.PetAPInProperties", + **kwargs: Any ) -> "_models.PetAPInProperties": """Create a Pet which contains more properties than what is defined. @@ -247,23 +277,29 @@ async def create_ap_in_properties( :rtype: ~additionalproperties.models.PetAPInProperties :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPInProperties"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPInProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPInProperties") + _json = self._serialize.body(create_parameters, 'PetAPInProperties') request = build_create_ap_in_properties_request( content_type=content_type, json=_json, - template_url=self.create_ap_in_properties.metadata["url"], + template_url=self.create_ap_in_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -271,18 +307,21 @@ async def create_ap_in_properties( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPInProperties", pipeline_response) + deserialized = self._deserialize('PetAPInProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_in_properties.metadata = {"url": "/additionalProperties/in/properties"} # type: ignore + create_ap_in_properties.metadata = {'url': '/additionalProperties/in/properties'} # type: ignore + @distributed_trace_async async def create_ap_in_properties_with_ap_string( - self, create_parameters: "_models.PetAPInPropertiesWithAPString", **kwargs: Any + self, + create_parameters: "_models.PetAPInPropertiesWithAPString", + **kwargs: Any ) -> "_models.PetAPInPropertiesWithAPString": """Create a Pet which contains more properties than what is defined. @@ -293,23 +332,29 @@ async def create_ap_in_properties_with_ap_string( :rtype: ~additionalproperties.models.PetAPInPropertiesWithAPString :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPInPropertiesWithAPString"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPInPropertiesWithAPString"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPInPropertiesWithAPString") + _json = self._serialize.body(create_parameters, 'PetAPInPropertiesWithAPString') request = build_create_ap_in_properties_with_ap_string_request( content_type=content_type, json=_json, - template_url=self.create_ap_in_properties_with_ap_string.metadata["url"], + template_url=self.create_ap_in_properties_with_ap_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -317,11 +362,12 @@ async def create_ap_in_properties_with_ap_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPInPropertiesWithAPString", pipeline_response) + deserialized = self._deserialize('PetAPInPropertiesWithAPString', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_in_properties_with_ap_string.metadata = {"url": "/additionalProperties/in/properties/with/additionalProperties/string"} # type: ignore + create_ap_in_properties_with_ap_string.metadata = {'url': '/additionalProperties/in/properties/with/additionalProperties/string'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py index 8c9afdd4038..4ed209b6d98 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py @@ -24,11 +24,11 @@ from ._models import PetAPTrue # type: ignore __all__ = [ - "CatAPTrue", - "Error", - "PetAPInProperties", - "PetAPInPropertiesWithAPString", - "PetAPObject", - "PetAPString", - "PetAPTrue", + 'CatAPTrue', + 'Error', + 'PetAPInProperties', + 'PetAPInPropertiesWithAPString', + 'PetAPObject', + 'PetAPString', + 'PetAPTrue', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models.py index cb2e0abd452..2655a4aa5bd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models.py @@ -29,18 +29,21 @@ class PetAPTrue(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -51,9 +54,9 @@ def __init__(self, **kwargs): :paramtype name: str """ super(PetAPTrue, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) - self.id = kwargs["id"] - self.name = kwargs.get("name", None) + self.additional_properties = kwargs.get('additional_properties', None) + self.id = kwargs['id'] + self.name = kwargs.get('name', None) self.status = None @@ -78,19 +81,22 @@ class CatAPTrue(PetAPTrue): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, - "friendly": {"key": "friendly", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, + 'friendly': {'key': 'friendly', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -103,7 +109,7 @@ def __init__(self, **kwargs): :paramtype friendly: bool """ super(CatAPTrue, self).__init__(**kwargs) - self.friendly = kwargs.get("friendly", None) + self.friendly = kwargs.get('friendly', None) class Error(msrest.serialization.Model): @@ -116,11 +122,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -128,8 +137,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class PetAPInProperties(msrest.serialization.Model): @@ -150,18 +159,21 @@ class PetAPInProperties(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, - "additional_properties": {"key": "additionalProperties", "type": "{float}"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, + 'additional_properties': {'key': 'additionalProperties', 'type': '{float}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: Required. :paramtype id: int @@ -171,10 +183,10 @@ def __init__(self, **kwargs): :paramtype additional_properties: dict[str, float] """ super(PetAPInProperties, self).__init__(**kwargs) - self.id = kwargs["id"] - self.name = kwargs.get("name", None) + self.id = kwargs['id'] + self.name = kwargs.get('name', None) self.status = None - self.additional_properties = kwargs.get("additional_properties", None) + self.additional_properties = kwargs.get('additional_properties', None) class PetAPInPropertiesWithAPString(msrest.serialization.Model): @@ -200,21 +212,24 @@ class PetAPInPropertiesWithAPString(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, - "odata_location": {"required": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, + 'odata_location': {'required': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{str}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, - "odata_location": {"key": "@odata\\.location", "type": "str"}, - "additional_properties1": {"key": "additionalProperties", "type": "{float}"}, + 'additional_properties': {'key': '', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, + 'odata_location': {'key': '@odata\\.location', 'type': 'str'}, + 'additional_properties1': {'key': 'additionalProperties', 'type': '{float}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -229,12 +244,12 @@ def __init__(self, **kwargs): :paramtype additional_properties1: dict[str, float] """ super(PetAPInPropertiesWithAPString, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) - self.id = kwargs["id"] - self.name = kwargs.get("name", None) + self.additional_properties = kwargs.get('additional_properties', None) + self.id = kwargs['id'] + self.name = kwargs.get('name', None) self.status = None - self.odata_location = kwargs["odata_location"] - self.additional_properties1 = kwargs.get("additional_properties1", None) + self.odata_location = kwargs['odata_location'] + self.additional_properties1 = kwargs.get('additional_properties1', None) class PetAPObject(msrest.serialization.Model): @@ -256,18 +271,21 @@ class PetAPObject(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -278,9 +296,9 @@ def __init__(self, **kwargs): :paramtype name: str """ super(PetAPObject, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) - self.id = kwargs["id"] - self.name = kwargs.get("name", None) + self.additional_properties = kwargs.get('additional_properties', None) + self.id = kwargs['id'] + self.name = kwargs.get('name', None) self.status = None @@ -303,18 +321,21 @@ class PetAPString(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{str}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -325,7 +346,7 @@ def __init__(self, **kwargs): :paramtype name: str """ super(PetAPString, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) - self.id = kwargs["id"] - self.name = kwargs.get("name", None) + self.additional_properties = kwargs.get('additional_properties', None) + self.id = kwargs['id'] + self.name = kwargs.get('name', None) self.status = None diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models_py3.py index 399f8ff525a..27d97536048 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_models_py3.py @@ -31,19 +31,24 @@ class PetAPTrue(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, } def __init__( - self, *, id: int, additional_properties: Optional[Dict[str, Any]] = None, name: Optional[str] = None, **kwargs + self, + *, + id: int, + additional_properties: Optional[Dict[str, Any]] = None, + name: Optional[str] = None, + **kwargs ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this @@ -82,16 +87,16 @@ class CatAPTrue(PetAPTrue): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, - "friendly": {"key": "friendly", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, + 'friendly': {'key': 'friendly', 'type': 'bool'}, } def __init__( @@ -128,11 +133,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -162,19 +173,24 @@ class PetAPInProperties(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, - "additional_properties": {"key": "additionalProperties", "type": "{float}"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, + 'additional_properties': {'key': 'additionalProperties', 'type': '{float}'}, } def __init__( - self, *, id: int, name: Optional[str] = None, additional_properties: Optional[Dict[str, float]] = None, **kwargs + self, + *, + id: int, + name: Optional[str] = None, + additional_properties: Optional[Dict[str, float]] = None, + **kwargs ): """ :keyword id: Required. @@ -214,18 +230,18 @@ class PetAPInPropertiesWithAPString(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, - "odata_location": {"required": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, + 'odata_location': {'required': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{str}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, - "odata_location": {"key": "@odata\\.location", "type": "str"}, - "additional_properties1": {"key": "additionalProperties", "type": "{float}"}, + 'additional_properties': {'key': '', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, + 'odata_location': {'key': '@odata\\.location', 'type': 'str'}, + 'additional_properties1': {'key': 'additionalProperties', 'type': '{float}'}, } def __init__( @@ -279,19 +295,24 @@ class PetAPObject(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, } def __init__( - self, *, id: int, additional_properties: Optional[Dict[str, Any]] = None, name: Optional[str] = None, **kwargs + self, + *, + id: int, + additional_properties: Optional[Dict[str, Any]] = None, + name: Optional[str] = None, + **kwargs ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this @@ -328,19 +349,24 @@ class PetAPString(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "status": {"readonly": True}, + 'id': {'required': True}, + 'status': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{str}"}, - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "bool"}, + 'additional_properties': {'key': '', 'type': '{str}'}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'bool'}, } def __init__( - self, *, id: int, additional_properties: Optional[Dict[str, str]] = None, name: Optional[str] = None, **kwargs + self, + *, + id: int, + additional_properties: Optional[Dict[str, str]] = None, + name: Optional[str] = None, + **kwargs ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/__init__.py index d049d68f253..194e6ef07bd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/__init__.py @@ -9,5 +9,5 @@ from ._pets_operations import PetsOperations __all__ = [ - "PetsOperations", + 'PetsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py index 3979ccb9316..f109c3f7a95 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -218,23 +210,29 @@ def create_ap_true( :rtype: ~additionalproperties.models.PetAPTrue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPTrue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPTrue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPTrue") + _json = self._serialize.body(create_parameters, 'PetAPTrue') request = build_create_ap_true_request( content_type=content_type, json=_json, - template_url=self.create_ap_true.metadata["url"], + template_url=self.create_ap_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -242,14 +240,15 @@ def create_ap_true( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPTrue", pipeline_response) + deserialized = self._deserialize('PetAPTrue', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_true.metadata = {"url": "/additionalProperties/true"} # type: ignore + create_ap_true.metadata = {'url': '/additionalProperties/true'} # type: ignore + @distributed_trace def create_cat_ap_true( @@ -267,23 +266,29 @@ def create_cat_ap_true( :rtype: ~additionalproperties.models.CatAPTrue :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.CatAPTrue"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CatAPTrue"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "CatAPTrue") + _json = self._serialize.body(create_parameters, 'CatAPTrue') request = build_create_cat_ap_true_request( content_type=content_type, json=_json, - template_url=self.create_cat_ap_true.metadata["url"], + template_url=self.create_cat_ap_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,14 +296,15 @@ def create_cat_ap_true( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("CatAPTrue", pipeline_response) + deserialized = self._deserialize('CatAPTrue', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_cat_ap_true.metadata = {"url": "/additionalProperties/true-subclass"} # type: ignore + create_cat_ap_true.metadata = {'url': '/additionalProperties/true-subclass'} # type: ignore + @distributed_trace def create_ap_object( @@ -316,23 +322,29 @@ def create_ap_object( :rtype: ~additionalproperties.models.PetAPObject :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPObject"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPObject"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPObject") + _json = self._serialize.body(create_parameters, 'PetAPObject') request = build_create_ap_object_request( content_type=content_type, json=_json, - template_url=self.create_ap_object.metadata["url"], + template_url=self.create_ap_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -340,14 +352,15 @@ def create_ap_object( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPObject", pipeline_response) + deserialized = self._deserialize('PetAPObject', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_object.metadata = {"url": "/additionalProperties/type/object"} # type: ignore + create_ap_object.metadata = {'url': '/additionalProperties/type/object'} # type: ignore + @distributed_trace def create_ap_string( @@ -365,23 +378,29 @@ def create_ap_string( :rtype: ~additionalproperties.models.PetAPString :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPString"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPString"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPString") + _json = self._serialize.body(create_parameters, 'PetAPString') request = build_create_ap_string_request( content_type=content_type, json=_json, - template_url=self.create_ap_string.metadata["url"], + template_url=self.create_ap_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -389,14 +408,15 @@ def create_ap_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPString", pipeline_response) + deserialized = self._deserialize('PetAPString', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_string.metadata = {"url": "/additionalProperties/type/string"} # type: ignore + create_ap_string.metadata = {'url': '/additionalProperties/type/string'} # type: ignore + @distributed_trace def create_ap_in_properties( @@ -414,23 +434,29 @@ def create_ap_in_properties( :rtype: ~additionalproperties.models.PetAPInProperties :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPInProperties"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPInProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPInProperties") + _json = self._serialize.body(create_parameters, 'PetAPInProperties') request = build_create_ap_in_properties_request( content_type=content_type, json=_json, - template_url=self.create_ap_in_properties.metadata["url"], + template_url=self.create_ap_in_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,14 +464,15 @@ def create_ap_in_properties( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPInProperties", pipeline_response) + deserialized = self._deserialize('PetAPInProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_in_properties.metadata = {"url": "/additionalProperties/in/properties"} # type: ignore + create_ap_in_properties.metadata = {'url': '/additionalProperties/in/properties'} # type: ignore + @distributed_trace def create_ap_in_properties_with_ap_string( @@ -463,23 +490,29 @@ def create_ap_in_properties_with_ap_string( :rtype: ~additionalproperties.models.PetAPInPropertiesWithAPString :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAPInPropertiesWithAPString"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAPInPropertiesWithAPString"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(create_parameters, "PetAPInPropertiesWithAPString") + _json = self._serialize.body(create_parameters, 'PetAPInPropertiesWithAPString') request = build_create_ap_in_properties_with_ap_string_request( content_type=content_type, json=_json, - template_url=self.create_ap_in_properties_with_ap_string.metadata["url"], + template_url=self.create_ap_in_properties_with_ap_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -487,11 +520,12 @@ def create_ap_in_properties_with_ap_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAPInPropertiesWithAPString", pipeline_response) + deserialized = self._deserialize('PetAPInPropertiesWithAPString', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_ap_in_properties_with_ap_string.metadata = {"url": "/additionalProperties/in/properties/with/additionalProperties/string"} # type: ignore + create_ap_in_properties_with_ap_string.metadata = {'url': '/additionalProperties/in/properties/with/additionalProperties/string'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py index afc03668fe3..1034510e10b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/__init__.py index 7e1dae047a1..f29d927007d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AnythingClient"] +__all__ = ['AnythingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py index 807a52c2f83..af135a55593 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py @@ -17,13 +17,13 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.rest import HttpRequest, HttpResponse - class AnythingClient(AnythingClientOperationsMixin): - """Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. + """Service client for testing basic anything types. Those schemas without types can be anything: + primitive, object, array. :param base_url: Service URL. Default value is 'http://localhost:3000'. :type base_url: str @@ -43,6 +43,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_configuration.py index 20dd340ae21..472e339348c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AnythingClientConfiguration(Configuration): +class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AnythingClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AnythingClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AnythingClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "anythingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'anythingclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/__init__.py index fbe1d346305..007b54da226 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._anything_client import AnythingClient - -__all__ = ["AnythingClient"] +__all__ = ['AnythingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py index 99e9820176f..00f211b229a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,15 +20,19 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AnythingClient(AnythingClientOperationsMixin): - """Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. + """Service client for testing basic anything types. Those schemas without types can be anything: + primitive, object, array. :param base_url: Service URL. Default value is 'http://localhost:3000'. :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AnythingClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +41,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_configuration.py index b5720beca20..377954d2dff 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AnythingClientConfiguration(Configuration): +class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AnythingClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AnythingClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "anythingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'anythingclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/__init__.py index f8a033838cd..d303f44b693 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._anything_client_operations import AnythingClientOperationsMixin __all__ = [ - "AnythingClientOperationsMixin", + 'AnythingClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py index 6be960d662c..0570089409e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,39 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ..._vendor import _convert_request -from ...operations._anything_client_operations import ( - build_get_array_request, - build_get_object_request, - build_get_string_request, - build_put_array_request, - build_put_object_request, - build_put_string_request, -) - -T = TypeVar("T") +from ...operations._anything_client_operations import build_get_array_request, build_get_object_request, build_get_string_request, build_put_array_request, build_put_object_request, build_put_string_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AnythingClientOperationsMixin: + @distributed_trace_async - async def get_object(self, **kwargs: Any) -> Any: + async def get_object( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an object as anything. Returns object { 'message': 'An object was successfully returned' }. @@ -46,34 +34,46 @@ async def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_object_request( - template_url=self.get_object.metadata["url"], + template_url=self.get_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_object.metadata = {"url": "/anything/object"} # type: ignore + get_object.metadata = {'url': '/anything/object'} # type: ignore + @distributed_trace_async - async def put_object(self, input: Any, **kwargs: Any) -> None: + async def put_object( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -84,23 +84,29 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(input, "object") + _json = self._serialize.body(input, 'object') request = build_put_object_request( content_type=content_type, json=_json, - template_url=self.put_object.metadata["url"], + template_url=self.put_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,10 +116,14 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_object.metadata = {"url": "/anything/object"} # type: ignore + put_object.metadata = {'url': '/anything/object'} # type: ignore + @distributed_trace_async - async def get_string(self, **kwargs: Any) -> Any: + async def get_string( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an string as anything. Returns string 'foo'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -121,34 +131,46 @@ async def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_request( - template_url=self.get_string.metadata["url"], + template_url=self.get_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string.metadata = {"url": "/anything/string"} # type: ignore + get_string.metadata = {'url': '/anything/string'} # type: ignore + @distributed_trace_async - async def put_string(self, input: Any, **kwargs: Any) -> None: + async def put_string( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to get an object error. @@ -159,23 +181,29 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(input, "object") + _json = self._serialize.body(input, 'object') request = build_put_string_request( content_type=content_type, json=_json, - template_url=self.put_string.metadata["url"], + template_url=self.put_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,10 +213,14 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_string.metadata = {"url": "/anything/string"} # type: ignore + put_string.metadata = {'url': '/anything/string'} # type: ignore + @distributed_trace_async - async def get_array(self, **kwargs: Any) -> Any: + async def get_array( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an array as anything. Returns string ['foo', 'bar']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -196,34 +228,46 @@ async def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_request( - template_url=self.get_array.metadata["url"], + template_url=self.get_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array.metadata = {"url": "/anything/array"} # type: ignore + get_array.metadata = {'url': '/anything/array'} # type: ignore + @distributed_trace_async - async def put_array(self, input: Any, **kwargs: Any) -> None: + async def put_array( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else to get an object error. @@ -234,23 +278,29 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(input, "object") + _json = self._serialize.body(input, 'object') request = build_put_array_request( content_type=content_type, json=_json, - template_url=self.put_array.metadata["url"], + template_url=self.put_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -260,4 +310,5 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_array.metadata = {"url": "/anything/array"} # type: ignore + put_array.metadata = {'url': '/anything/array'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/__init__.py index f8a033838cd..d303f44b693 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/__init__.py @@ -9,5 +9,5 @@ from ._anything_client_operations import AnythingClientOperationsMixin __all__ = [ - "AnythingClientOperationsMixin", + 'AnythingClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py index cc30d65d7a1..34d9781daa1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -26,9 +19,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -162,9 +154,11 @@ def build_put_array_request( # fmt: on class AnythingClientOperationsMixin(object): + @distributed_trace def get_object( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Any """Basic get that returns an object as anything. Returns object { 'message': 'An object was @@ -175,31 +169,39 @@ def get_object( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_object_request( - template_url=self.get_object.metadata["url"], + template_url=self.get_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_object.metadata = {"url": "/anything/object"} # type: ignore + get_object.metadata = {'url': '/anything/object'} # type: ignore + @distributed_trace def put_object( @@ -218,23 +220,29 @@ def put_object( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(input, "object") + _json = self._serialize.body(input, 'object') request = build_put_object_request( content_type=content_type, json=_json, - template_url=self.put_object.metadata["url"], + template_url=self.put_object.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -244,11 +252,13 @@ def put_object( if cls: return cls(pipeline_response, None, {}) - put_object.metadata = {"url": "/anything/object"} # type: ignore + put_object.metadata = {'url': '/anything/object'} # type: ignore + @distributed_trace def get_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Any """Basic get that returns an string as anything. Returns string 'foo'. @@ -258,31 +268,39 @@ def get_string( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_request( - template_url=self.get_string.metadata["url"], + template_url=self.get_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string.metadata = {"url": "/anything/string"} # type: ignore + get_string.metadata = {'url': '/anything/string'} # type: ignore + @distributed_trace def put_string( @@ -301,23 +319,29 @@ def put_string( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(input, "object") + _json = self._serialize.body(input, 'object') request = build_put_string_request( content_type=content_type, json=_json, - template_url=self.put_string.metadata["url"], + template_url=self.put_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,11 +351,13 @@ def put_string( if cls: return cls(pipeline_response, None, {}) - put_string.metadata = {"url": "/anything/string"} # type: ignore + put_string.metadata = {'url': '/anything/string'} # type: ignore + @distributed_trace def get_array( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Any """Basic get that returns an array as anything. Returns string ['foo', 'bar']. @@ -341,31 +367,39 @@ def get_array( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_request( - template_url=self.get_array.metadata["url"], + template_url=self.get_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array.metadata = {"url": "/anything/array"} # type: ignore + get_array.metadata = {'url': '/anything/array'} # type: ignore + @distributed_trace def put_array( @@ -384,23 +418,29 @@ def put_array( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(input, "object") + _json = self._serialize.body(input, 'object') request = build_put_array_request( content_type=content_type, json=_json, - template_url=self.put_array.metadata["url"], + template_url=self.put_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,4 +450,5 @@ def put_array( if cls: return cls(pipeline_response, None, {}) - put_array.metadata = {"url": "/anything/array"} # type: ignore + put_array.metadata = {'url': '/anything/array'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py index 5983ebe0fb1..13b9e2c8eb3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/__init__.py index c845d24af2c..e4684d784ee 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py index 671586ae804..2398a25e268 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATArrayService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_configuration.py index 31838f4dc03..009349e6f86 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/__init__.py index e216d69d910..9992f153487 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService - -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py index 69a5c2919ce..d6f7a9c339f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations - class AutoRestSwaggerBATArrayService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATArrayService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_configuration.py index 99fd3c7c6ab..71ef2cbc2a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/__init__.py index b2189a3ae1f..704181d72a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._array_operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py index efc0ed5ef2e..ff5a1defb0c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,83 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._array_operations import ( - build_get_array_empty_request, - build_get_array_item_empty_request, - build_get_array_item_null_request, - build_get_array_null_request, - build_get_array_valid_request, - build_get_base64_url_request, - build_get_boolean_invalid_null_request, - build_get_boolean_invalid_string_request, - build_get_boolean_tfft_request, - build_get_byte_invalid_null_request, - build_get_byte_valid_request, - build_get_complex_empty_request, - build_get_complex_item_empty_request, - build_get_complex_item_null_request, - build_get_complex_null_request, - build_get_complex_valid_request, - build_get_date_invalid_chars_request, - build_get_date_invalid_null_request, - build_get_date_time_invalid_chars_request, - build_get_date_time_invalid_null_request, - build_get_date_time_rfc1123_valid_request, - build_get_date_time_valid_request, - build_get_date_valid_request, - build_get_dictionary_empty_request, - build_get_dictionary_item_empty_request, - build_get_dictionary_item_null_request, - build_get_dictionary_null_request, - build_get_dictionary_valid_request, - build_get_double_invalid_null_request, - build_get_double_invalid_string_request, - build_get_double_valid_request, - build_get_duration_valid_request, - build_get_empty_request, - build_get_enum_valid_request, - build_get_float_invalid_null_request, - build_get_float_invalid_string_request, - build_get_float_valid_request, - build_get_int_invalid_null_request, - build_get_int_invalid_string_request, - build_get_integer_valid_request, - build_get_invalid_request, - build_get_long_invalid_null_request, - build_get_long_invalid_string_request, - build_get_long_valid_request, - build_get_null_request, - build_get_string_enum_valid_request, - build_get_string_valid_request, - build_get_string_with_invalid_request, - build_get_string_with_null_request, - build_get_uuid_invalid_chars_request, - build_get_uuid_valid_request, - build_put_array_valid_request, - build_put_boolean_tfft_request, - build_put_byte_valid_request, - build_put_complex_valid_request, - build_put_date_time_rfc1123_valid_request, - build_put_date_time_valid_request, - build_put_date_valid_request, - build_put_dictionary_valid_request, - build_put_double_valid_request, - build_put_duration_valid_request, - build_put_empty_request, - build_put_enum_valid_request, - build_put_float_valid_request, - build_put_integer_valid_request, - build_put_long_valid_request, - build_put_string_enum_valid_request, - build_put_string_valid_request, - build_put_uuid_valid_request, -) - -T = TypeVar("T") +from ...operations._array_operations import build_get_array_empty_request, build_get_array_item_empty_request, build_get_array_item_null_request, build_get_array_null_request, build_get_array_valid_request, build_get_base64_url_request, build_get_boolean_invalid_null_request, build_get_boolean_invalid_string_request, build_get_boolean_tfft_request, build_get_byte_invalid_null_request, build_get_byte_valid_request, build_get_complex_empty_request, build_get_complex_item_empty_request, build_get_complex_item_null_request, build_get_complex_null_request, build_get_complex_valid_request, build_get_date_invalid_chars_request, build_get_date_invalid_null_request, build_get_date_time_invalid_chars_request, build_get_date_time_invalid_null_request, build_get_date_time_rfc1123_valid_request, build_get_date_time_valid_request, build_get_date_valid_request, build_get_dictionary_empty_request, build_get_dictionary_item_empty_request, build_get_dictionary_item_null_request, build_get_dictionary_null_request, build_get_dictionary_valid_request, build_get_double_invalid_null_request, build_get_double_invalid_string_request, build_get_double_valid_request, build_get_duration_valid_request, build_get_empty_request, build_get_enum_valid_request, build_get_float_invalid_null_request, build_get_float_invalid_string_request, build_get_float_valid_request, build_get_int_invalid_null_request, build_get_int_invalid_string_request, build_get_integer_valid_request, build_get_invalid_request, build_get_long_invalid_null_request, build_get_long_invalid_string_request, build_get_long_valid_request, build_get_null_request, build_get_string_enum_valid_request, build_get_string_valid_request, build_get_string_with_invalid_request, build_get_string_with_null_request, build_get_uuid_invalid_chars_request, build_get_uuid_valid_request, build_put_array_valid_request, build_put_boolean_tfft_request, build_put_byte_valid_request, build_put_complex_valid_request, build_put_date_time_rfc1123_valid_request, build_put_date_time_valid_request, build_put_date_valid_request, build_put_dictionary_valid_request, build_put_double_valid_request, build_put_duration_valid_request, build_put_empty_request, build_put_enum_valid_request, build_put_float_valid_request, build_put_integer_valid_request, build_put_long_valid_request, build_put_string_enum_valid_request, build_put_string_valid_request, build_put_uuid_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ArrayOperations: +class ArrayOperations: # pylint: disable=too-many-public-methods """ArrayOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -123,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> List[int]: + async def get_null( + self, + **kwargs: Any + ) -> List[int]: """Get null array value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -131,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -149,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/array/null"} # type: ignore + get_null.metadata = {'url': '/array/null'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> List[int]: + async def get_invalid( + self, + **kwargs: Any + ) -> List[int]: """Get invalid array [1, 2, 3. :keyword callable cls: A custom type or function that will be passed the direct response @@ -167,17 +102,24 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,17 +127,21 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore + get_invalid.metadata = {'url': '/array/invalid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> List[int]: + async def get_empty( + self, + **kwargs: Any + ) -> List[int]: """Get empty array value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -203,17 +149,24 @@ async def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -221,17 +174,22 @@ async def get_empty(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/array/empty"} # type: ignore + get_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: + async def put_empty( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value empty []. :param array_body: @@ -241,23 +199,29 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,10 +232,14 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/array/empty"} # type: ignore + put_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace_async - async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: + async def get_boolean_tfft( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, false, false, true]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -279,17 +247,24 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -297,17 +272,22 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: + async def put_boolean_tfft( + self, + array_body: List[bool], + **kwargs: Any + ) -> None: """Set array value empty [true, false, false, true]. :param array_body: @@ -317,23 +297,29 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bool]") + _json = self._serialize.body(array_body, '[bool]') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,10 +330,14 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, null, false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -355,17 +345,24 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,17 +370,21 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/array/prim/boolean/true.null.false'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, 'boolean', false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -391,17 +392,24 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,17 +417,21 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/array/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace_async - async def get_integer_valid(self, **kwargs: Any) -> List[int]: + async def get_integer_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -427,17 +439,24 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -445,17 +464,22 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_integer_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -465,23 +489,29 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[int]") + _json = self._serialize.body(array_body, '[int]') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -492,10 +522,14 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -503,17 +537,24 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,17 +562,21 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/array/prim/integer/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -539,17 +584,24 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,17 +609,21 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/array/prim/integer/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_long_valid(self, **kwargs: Any) -> List[int]: + async def get_long_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -575,17 +631,24 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -593,17 +656,22 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_long_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -613,23 +681,29 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[long]") + _json = self._serialize.body(array_body, '[long]') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,10 +714,14 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -651,17 +729,24 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -669,17 +754,21 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/array/prim/long/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -687,17 +776,24 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -705,17 +801,21 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/array/prim/long/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_float_valid(self, **kwargs: Any) -> List[float]: + async def get_float_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -723,17 +823,24 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -741,17 +848,22 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_float_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -761,23 +873,29 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -788,10 +906,14 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -799,17 +921,24 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -817,17 +946,21 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/array/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -835,17 +968,24 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -853,17 +993,21 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/array/prim/float/1.number.0'} # type: ignore + @distributed_trace_async - async def get_double_valid(self, **kwargs: Any) -> List[float]: + async def get_double_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -871,17 +1015,24 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -889,17 +1040,22 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_double_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -909,23 +1065,29 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -936,10 +1098,14 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -947,17 +1113,24 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -965,17 +1138,21 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/array/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -983,17 +1160,24 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1001,17 +1185,21 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/array/prim/double/1.number.0'} # type: ignore + @distributed_trace_async - async def get_string_valid(self, **kwargs: Any) -> List[str]: + async def get_string_valid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1019,17 +1207,24 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1037,17 +1232,22 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_string_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1057,23 +1257,29 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1084,10 +1290,14 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: + async def get_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.FooEnum"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1095,17 +1305,24 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnu :rtype: list[str or ~bodyarray.models.FooEnum] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], + template_url=self.get_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1113,17 +1330,22 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnu error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + get_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], **kwargs: Any) -> None: + async def put_enum_valid( + self, + array_body: List[Union[str, "_models.FooEnum"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1133,23 +1355,29 @@ async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_enum_valid.metadata["url"], + template_url=self.put_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1160,10 +1388,14 @@ async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], if cls: return cls(pipeline_response, None, {}) - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + put_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0"]]: + async def get_string_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.Enum0"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1171,17 +1403,24 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models :rtype: list[str or ~bodyarray.models.Enum0] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.Enum0"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], + template_url=self.get_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1189,17 +1428,22 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + get_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1"]], **kwargs: Any) -> None: + async def put_string_enum_valid( + self, + array_body: List[Union[str, "_models.Enum1"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1209,23 +1453,29 @@ async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1 :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_enum_valid.metadata["url"], + template_url=self.put_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1236,10 +1486,14 @@ async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1 if cls: return cls(pipeline_response, None, {}) - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + put_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_string_with_null(self, **kwargs: Any) -> List[str]: + async def get_string_with_null( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', null, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1247,17 +1501,24 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1265,17 +1526,21 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/array/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace_async - async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: + async def get_string_with_invalid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', 123, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1283,17 +1548,24 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1301,17 +1573,21 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/array/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace_async - async def get_uuid_valid(self, **kwargs: Any) -> List[str]: + async def get_uuid_valid( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1320,17 +1596,24 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], + template_url=self.get_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1338,17 +1621,22 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + get_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace_async - async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_uuid_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1359,23 +1647,29 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_uuid_valid_request( content_type=content_type, json=_json, - template_url=self.put_uuid_valid.metadata["url"], + template_url=self.put_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1386,10 +1680,14 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + put_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace_async - async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: + async def get_uuid_invalid_chars( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1397,17 +1695,24 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], + template_url=self.get_uuid_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1415,17 +1720,21 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore + get_uuid_invalid_chars.metadata = {'url': '/array/prim/uuid/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_valid( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1433,17 +1742,24 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1451,17 +1767,22 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace_async - async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None: + async def put_date_valid( + self, + array_body: List[datetime.date], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. :param array_body: @@ -1471,23 +1792,29 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[date]") + _json = self._serialize.body(array_body, '[date]') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1498,10 +1825,14 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace_async - async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2012-01-01', null, '1776-07-04']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1509,17 +1840,24 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1527,17 +1865,21 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/array/prim/date/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2011-03-22', 'date']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1545,17 +1887,24 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1563,17 +1912,21 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/array/prim/date/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1582,17 +1935,24 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1600,17 +1960,22 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1621,23 +1986,29 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[iso-8601]") + _json = self._serialize.body(array_body, '[iso-8601]') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1648,10 +2019,14 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', null]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1659,17 +2034,24 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1677,17 +2059,21 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/array/prim/date-time/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1695,17 +2081,24 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1713,17 +2106,21 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/array/prim/date-time/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1732,17 +2129,24 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1750,17 +2154,22 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) + deserialized = self._deserialize('[rfc-1123]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_rfc1123_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1771,23 +2180,29 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[rfc-1123]") + _json = self._serialize.body(array_body, '[rfc-1123]') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1798,10 +2213,14 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: + async def get_duration_valid( + self, + **kwargs: Any + ) -> List[datetime.timedelta]: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1809,17 +2228,24 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1827,17 +2253,22 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) + deserialized = self._deserialize('[duration]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any) -> None: + async def put_duration_valid( + self, + array_body: List[datetime.timedelta], + **kwargs: Any + ) -> None: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :param array_body: @@ -1847,23 +2278,29 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[duration]") + _json = self._serialize.body(array_body, '[duration]') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1874,10 +2311,14 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_valid( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -1886,17 +2327,24 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1904,17 +2352,22 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: + async def put_byte_valid( + self, + array_body: List[bytearray], + **kwargs: Any + ) -> None: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -1925,23 +2378,29 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bytearray]") + _json = self._serialize.body(array_body, '[bytearray]') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1952,10 +2411,14 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_invalid_null( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1963,17 +2426,24 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1981,17 +2451,21 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/array/prim/byte/invalidnull'} # type: ignore + @distributed_trace_async - async def get_base64_url(self, **kwargs: Any) -> List[bytes]: + async def get_base64_url( + self, + **kwargs: Any + ) -> List[bytes]: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -2000,17 +2474,24 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2018,17 +2499,21 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) + deserialized = self._deserialize('[base64]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/array/prim/base64url/valid'} # type: ignore + @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type null value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2036,17 +2521,24 @@ async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2054,17 +2546,21 @@ async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/array/complex/null'} # type: ignore + @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get empty array of complex type []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2072,17 +2568,24 @@ async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2090,17 +2593,21 @@ async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/array/complex/empty'} # type: ignore + @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_item_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -2109,17 +2616,24 @@ async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2127,17 +2641,21 @@ async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/array/complex/itemnull'} # type: ignore + @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_item_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -2146,17 +2664,24 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"] :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2164,17 +2689,21 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/array/complex/itemempty'} # type: ignore + @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_valid( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2183,17 +2712,24 @@ async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2201,17 +2737,22 @@ async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace_async - async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: Any) -> None: + async def put_complex_valid( + self, + array_body: List["_models.Product"], + **kwargs: Any + ) -> None: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2222,23 +2763,29 @@ async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[Product]") + _json = self._serialize.body(array_body, '[Product]') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2249,10 +2796,14 @@ async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace_async - async def get_array_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get a null array. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2260,17 +2811,24 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2278,17 +2836,21 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore + get_array_null.metadata = {'url': '/array/array/null'} # type: ignore + @distributed_trace_async - async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an empty array []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2296,17 +2858,24 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2314,17 +2883,21 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/array/array/empty'} # type: ignore + @distributed_trace_async - async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2332,17 +2905,24 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2350,17 +2930,21 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/array/array/itemnull'} # type: ignore + @distributed_trace_async - async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2368,17 +2952,24 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2386,17 +2977,21 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/array/array/itemempty'} # type: ignore + @distributed_trace_async - async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: + async def get_array_valid( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2404,17 +2999,24 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2422,17 +3024,22 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace_async - async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: + async def put_array_valid( + self, + array_body: List[List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :param array_body: @@ -2442,23 +3049,29 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[[str]]") + _json = self._serialize.body(array_body, '[[str]]') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2469,10 +3082,14 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace_async - async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries with value null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2480,17 +3097,24 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2498,17 +3122,21 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/array/dictionary/null'} # type: ignore + @distributed_trace_async - async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2516,17 +3144,24 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2534,17 +3169,21 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/array/dictionary/empty'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2553,17 +3192,24 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2571,17 +3217,21 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/array/dictionary/itemnull'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2590,17 +3240,24 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2608,17 +3265,21 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/array/dictionary/itemempty'} # type: ignore + @distributed_trace_async - async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_valid( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2627,17 +3288,24 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2645,17 +3313,22 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + @distributed_trace_async - async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) -> None: + async def put_dictionary_valid( + self, + array_body: List[Dict[str, str]], + **kwargs: Any + ) -> None: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2666,23 +3339,29 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[{str}]") + _json = self._serialize.body(array_body, '[{str}]') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2693,4 +3372,5 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py index a4d2d993c02..7728241cd8f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py @@ -20,9 +20,9 @@ ) __all__ = [ - "Error", - "Product", - "Enum0", - "Enum1", - "FooEnum", + 'Error', + 'Product', + 'Enum0', + 'Enum1', + 'FooEnum', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_auto_rest_swagger_bat_array_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_auto_rest_swagger_bat_array_service_enums.py index 9ad0742e428..fb3ff53b36b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_auto_rest_swagger_bat_array_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_auto_rest_swagger_bat_array_service_enums.py @@ -17,14 +17,12 @@ class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO2 = "foo2" FOO3 = "foo3" - class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO1 = "foo1" FOO2 = "foo2" FOO3 = "foo3" - class FooEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO1 = "foo1" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models.py index a3dfbe1eb16..226a489fc2f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class Product(msrest.serialization.Model): @@ -46,11 +49,14 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword integer: :paramtype integer: int @@ -58,5 +64,5 @@ def __init__(self, **kwargs): :paramtype string: str """ super(Product, self).__init__(**kwargs) - self.integer = kwargs.get("integer", None) - self.string = kwargs.get("string", None) + self.integer = kwargs.get('integer', None) + self.string = kwargs.get('string', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models_py3.py index b37adff2989..2a4ce7f081b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -48,11 +54,17 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, *, integer: Optional[int] = None, string: Optional[str] = None, **kwargs): + def __init__( + self, + *, + integer: Optional[int] = None, + string: Optional[str] = None, + **kwargs + ): """ :keyword integer: :paramtype integer: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/__init__.py index b2189a3ae1f..704181d72a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/__init__.py @@ -9,5 +9,5 @@ from ._array_operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py index ad95adb212d..82ea258f948 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1489,7 +1481,7 @@ def build_put_dictionary_valid_request( ) # fmt: on -class ArrayOperations(object): +class ArrayOperations(object): # pylint: disable=too-many-public-methods """ArrayOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -1513,7 +1505,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get null array value. @@ -1523,17 +1516,24 @@ def get_null( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1541,18 +1541,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/array/null"} # type: ignore + get_null.metadata = {'url': '/array/null'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get invalid array [1, 2, 3. @@ -1562,17 +1564,24 @@ def get_invalid( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1580,18 +1589,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore + get_invalid.metadata = {'url': '/array/invalid'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get empty array value []. @@ -1601,17 +1612,24 @@ def get_empty( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1619,14 +1637,15 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/array/empty"} # type: ignore + get_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace def put_empty( @@ -1644,23 +1663,29 @@ def put_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1671,11 +1696,13 @@ def put_empty( if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/array/empty"} # type: ignore + put_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace def get_boolean_tfft( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, false, false, true]. @@ -1685,17 +1712,24 @@ def get_boolean_tfft( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1703,14 +1737,15 @@ def get_boolean_tfft( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace def put_boolean_tfft( @@ -1728,23 +1763,29 @@ def put_boolean_tfft( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bool]") + _json = self._serialize.body(array_body, '[bool]') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1755,11 +1796,13 @@ def put_boolean_tfft( if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace def get_boolean_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, null, false]. @@ -1769,17 +1812,24 @@ def get_boolean_invalid_null( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1787,18 +1837,20 @@ def get_boolean_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/array/prim/boolean/true.null.false'} # type: ignore + @distributed_trace def get_boolean_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, 'boolean', false]. @@ -1808,17 +1860,24 @@ def get_boolean_invalid_string( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1826,18 +1885,20 @@ def get_boolean_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/array/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace def get_integer_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, -1, 3, 300]. @@ -1847,17 +1908,24 @@ def get_integer_valid( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1865,14 +1933,15 @@ def get_integer_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def put_integer_valid( @@ -1890,23 +1959,29 @@ def put_integer_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[int]") + _json = self._serialize.body(array_body, '[int]') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1917,11 +1992,13 @@ def put_integer_valid( if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def get_int_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, null, 0]. @@ -1931,17 +2008,24 @@ def get_int_invalid_null( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1949,18 +2033,20 @@ def get_int_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/array/prim/integer/1.null.zero'} # type: ignore + @distributed_trace def get_int_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, 'integer', 0]. @@ -1970,17 +2056,24 @@ def get_int_invalid_string( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1988,18 +2081,20 @@ def get_int_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/array/prim/integer/1.integer.0'} # type: ignore + @distributed_trace def get_long_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, -1, 3, 300]. @@ -2009,17 +2104,24 @@ def get_long_valid( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2027,14 +2129,15 @@ def get_long_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def put_long_valid( @@ -2052,23 +2155,29 @@ def put_long_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[long]") + _json = self._serialize.body(array_body, '[long]') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2079,11 +2188,13 @@ def put_long_valid( if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def get_long_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get long array value [1, null, 0]. @@ -2093,17 +2204,24 @@ def get_long_invalid_null( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2111,18 +2229,20 @@ def get_long_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/array/prim/long/1.null.zero'} # type: ignore + @distributed_trace def get_long_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get long array value [1, 'integer', 0]. @@ -2132,17 +2252,24 @@ def get_long_invalid_string( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2150,18 +2277,20 @@ def get_long_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/array/prim/long/1.integer.0'} # type: ignore + @distributed_trace def get_float_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0, -0.01, 1.2e20]. @@ -2171,17 +2300,24 @@ def get_float_valid( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2189,14 +2325,15 @@ def get_float_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_float_valid( @@ -2214,23 +2351,29 @@ def put_float_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2241,11 +2384,13 @@ def put_float_valid( if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0.0, null, -1.2e20]. @@ -2255,17 +2400,24 @@ def get_float_invalid_null( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2273,18 +2425,20 @@ def get_float_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/array/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get boolean array value [1.0, 'number', 0.0]. @@ -2294,17 +2448,24 @@ def get_float_invalid_string( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2312,18 +2473,20 @@ def get_float_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/array/prim/float/1.number.0'} # type: ignore + @distributed_trace def get_double_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0, -0.01, 1.2e20]. @@ -2333,17 +2496,24 @@ def get_double_valid( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2351,14 +2521,15 @@ def get_double_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_double_valid( @@ -2376,23 +2547,29 @@ def put_double_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2403,11 +2580,13 @@ def put_double_valid( if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0.0, null, -1.2e20]. @@ -2417,17 +2596,24 @@ def get_double_invalid_null( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2435,18 +2621,20 @@ def get_double_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/array/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get boolean array value [1.0, 'number', 0.0]. @@ -2456,17 +2644,24 @@ def get_double_invalid_string( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2474,18 +2669,20 @@ def get_double_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/array/prim/double/1.number.0'} # type: ignore + @distributed_trace def get_string_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo1', 'foo2', 'foo3']. @@ -2495,17 +2692,24 @@ def get_string_valid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2513,14 +2717,15 @@ def get_string_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_string_valid( @@ -2538,23 +2743,29 @@ def put_string_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2565,11 +2776,13 @@ def put_string_valid( if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_enum_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Union[str, "_models.FooEnum"]] """Get enum array value ['foo1', 'foo2', 'foo3']. @@ -2579,17 +2792,24 @@ def get_enum_valid( :rtype: list[str or ~bodyarray.models.FooEnum] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], + template_url=self.get_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2597,14 +2817,15 @@ def get_enum_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + get_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_enum_valid( @@ -2622,23 +2843,29 @@ def put_enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_enum_valid.metadata["url"], + template_url=self.put_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2649,11 +2876,13 @@ def put_enum_valid( if cls: return cls(pipeline_response, None, {}) - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + put_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_string_enum_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Union[str, "_models.Enum0"]] """Get enum array value ['foo1', 'foo2', 'foo3']. @@ -2663,17 +2892,24 @@ def get_string_enum_valid( :rtype: list[str or ~bodyarray.models.Enum0] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.Enum0"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], + template_url=self.get_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2681,14 +2917,15 @@ def get_string_enum_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + get_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_string_enum_valid( @@ -2706,23 +2943,29 @@ def put_string_enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_enum_valid.metadata["url"], + template_url=self.put_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2733,11 +2976,13 @@ def put_string_enum_valid( if cls: return cls(pipeline_response, None, {}) - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + put_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_string_with_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo', null, 'foo2']. @@ -2747,17 +2992,24 @@ def get_string_with_null( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2765,18 +3017,20 @@ def get_string_with_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/array/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace def get_string_with_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo', 123, 'foo2']. @@ -2786,17 +3040,24 @@ def get_string_with_invalid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2804,18 +3065,20 @@ def get_string_with_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/array/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace def get_uuid_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', @@ -2826,17 +3089,24 @@ def get_uuid_valid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], + template_url=self.get_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2844,14 +3114,15 @@ def get_uuid_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + get_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace def put_uuid_valid( @@ -2870,23 +3141,29 @@ def put_uuid_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_uuid_valid_request( content_type=content_type, json=_json, - template_url=self.put_uuid_valid.metadata["url"], + template_url=self.put_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2897,11 +3174,13 @@ def put_uuid_valid( if cls: return cls(pipeline_response, None, {}) - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + put_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace def get_uuid_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. @@ -2911,17 +3190,24 @@ def get_uuid_invalid_chars( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], + template_url=self.get_uuid_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2929,18 +3215,20 @@ def get_uuid_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore + get_uuid_invalid_chars.metadata = {'url': '/array/prim/uuid/invalidchars'} # type: ignore + @distributed_trace def get_date_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. @@ -2950,17 +3238,24 @@ def get_date_valid( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2968,14 +3263,15 @@ def get_date_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace def put_date_valid( @@ -2993,23 +3289,29 @@ def put_date_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[date]") + _json = self._serialize.body(array_body, '[date]') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3020,11 +3322,13 @@ def put_date_valid( if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace def get_date_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get date array value ['2012-01-01', null, '1776-07-04']. @@ -3034,17 +3338,24 @@ def get_date_invalid_null( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3052,18 +3363,20 @@ def get_date_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/array/prim/date/invalidnull'} # type: ignore + @distributed_trace def get_date_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get date array value ['2011-03-22', 'date']. @@ -3073,17 +3386,24 @@ def get_date_invalid_chars( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3091,18 +3411,20 @@ def get_date_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/array/prim/date/invalidchars'} # type: ignore + @distributed_trace def get_date_time_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', @@ -3113,17 +3435,24 @@ def get_date_time_valid( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3131,14 +3460,15 @@ def get_date_time_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace def put_date_time_valid( @@ -3157,23 +3487,29 @@ def put_date_time_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[iso-8601]") + _json = self._serialize.body(array_body, '[iso-8601]') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3184,11 +3520,13 @@ def put_date_time_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace def get_date_time_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date array value ['2000-12-01t00:00:01z', null]. @@ -3198,17 +3536,24 @@ def get_date_time_invalid_null( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3216,18 +3561,20 @@ def get_date_time_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/array/prim/date-time/invalidnull'} # type: ignore + @distributed_trace def get_date_time_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date array value ['2000-12-01t00:00:01z', 'date-time']. @@ -3237,17 +3584,24 @@ def get_date_time_invalid_chars( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3255,18 +3609,20 @@ def get_date_time_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/array/prim/date-time/invalidchars'} # type: ignore + @distributed_trace def get_date_time_rfc1123_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', @@ -3277,17 +3633,24 @@ def get_date_time_rfc1123_valid( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3295,14 +3658,15 @@ def get_date_time_rfc1123_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) + deserialized = self._deserialize('[rfc-1123]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def put_date_time_rfc1123_valid( @@ -3321,23 +3685,29 @@ def put_date_time_rfc1123_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[rfc-1123]") + _json = self._serialize.body(array_body, '[rfc-1123]') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3348,11 +3718,13 @@ def put_date_time_rfc1123_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def get_duration_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.timedelta] """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. @@ -3362,17 +3734,24 @@ def get_duration_valid( :rtype: list[~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3380,14 +3759,15 @@ def get_duration_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) + deserialized = self._deserialize('[duration]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace def put_duration_valid( @@ -3405,23 +3785,29 @@ def put_duration_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[duration]") + _json = self._serialize.body(array_body, '[duration]') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3432,11 +3818,13 @@ def put_duration_valid( if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace def get_byte_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytearray] """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded @@ -3447,17 +3835,24 @@ def get_byte_valid( :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3465,14 +3860,15 @@ def get_byte_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace def put_byte_valid( @@ -3491,23 +3887,29 @@ def put_byte_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bytearray]") + _json = self._serialize.body(array_body, '[bytearray]') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3518,11 +3920,13 @@ def put_byte_valid( if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace def get_byte_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytearray] """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. @@ -3532,17 +3936,24 @@ def get_byte_invalid_null( :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3550,18 +3961,20 @@ def get_byte_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/array/prim/byte/invalidnull'} # type: ignore + @distributed_trace def get_base64_url( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytes] """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with @@ -3572,17 +3985,24 @@ def get_base64_url( :rtype: list[bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3590,18 +4010,20 @@ def get_base64_url( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) + deserialized = self._deserialize('[base64]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/array/prim/base64url/valid'} # type: ignore + @distributed_trace def get_complex_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type null value. @@ -3611,17 +4033,24 @@ def get_complex_null( :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3629,18 +4058,20 @@ def get_complex_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/array/complex/null'} # type: ignore + @distributed_trace def get_complex_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get empty array of complex type []. @@ -3650,17 +4081,24 @@ def get_complex_empty( :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3668,18 +4106,20 @@ def get_complex_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/array/complex/empty'} # type: ignore + @distributed_trace def get_complex_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, @@ -3690,17 +4130,24 @@ def get_complex_item_null( :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3708,18 +4155,20 @@ def get_complex_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/array/complex/itemnull'} # type: ignore + @distributed_trace def get_complex_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, @@ -3730,17 +4179,24 @@ def get_complex_item_empty( :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3748,18 +4204,20 @@ def get_complex_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/array/complex/itemempty'} # type: ignore + @distributed_trace def get_complex_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, @@ -3770,17 +4228,24 @@ def get_complex_valid( :rtype: list[~bodyarray.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3788,14 +4253,15 @@ def get_complex_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace def put_complex_valid( @@ -3814,23 +4280,29 @@ def put_complex_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[Product]") + _json = self._serialize.body(array_body, '[Product]') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3841,11 +4313,13 @@ def put_complex_valid( if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace def get_array_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get a null array. @@ -3855,17 +4329,24 @@ def get_array_null( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3873,18 +4354,20 @@ def get_array_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore + get_array_null.metadata = {'url': '/array/array/null'} # type: ignore + @distributed_trace def get_array_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an empty array []. @@ -3894,17 +4377,24 @@ def get_array_empty( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3912,18 +4402,20 @@ def get_array_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/array/array/empty'} # type: ignore + @distributed_trace def get_array_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. @@ -3933,17 +4425,24 @@ def get_array_item_null( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3951,18 +4450,20 @@ def get_array_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/array/array/itemnull'} # type: ignore + @distributed_trace def get_array_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. @@ -3972,17 +4473,24 @@ def get_array_item_empty( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3990,18 +4498,20 @@ def get_array_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/array/array/itemempty'} # type: ignore + @distributed_trace def get_array_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. @@ -4011,17 +4521,24 @@ def get_array_valid( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4029,14 +4546,15 @@ def get_array_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace def put_array_valid( @@ -4054,23 +4572,29 @@ def put_array_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[[str]]") + _json = self._serialize.body(array_body, '[[str]]') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4081,11 +4605,13 @@ def put_array_valid( if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace def get_dictionary_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries with value null. @@ -4095,17 +4621,24 @@ def get_dictionary_null( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4113,18 +4646,20 @@ def get_dictionary_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/array/dictionary/null'} # type: ignore + @distributed_trace def get_dictionary_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value []. @@ -4134,17 +4669,24 @@ def get_dictionary_empty( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4152,18 +4694,20 @@ def get_dictionary_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/array/dictionary/empty'} # type: ignore + @distributed_trace def get_dictionary_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4174,17 +4718,24 @@ def get_dictionary_item_null( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4192,18 +4743,20 @@ def get_dictionary_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/array/dictionary/itemnull'} # type: ignore + @distributed_trace def get_dictionary_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4214,17 +4767,24 @@ def get_dictionary_item_empty( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4232,18 +4792,20 @@ def get_dictionary_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/array/dictionary/itemempty'} # type: ignore + @distributed_trace def get_dictionary_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4254,17 +4816,24 @@ def get_dictionary_valid( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4272,14 +4841,15 @@ def get_dictionary_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + @distributed_trace def put_dictionary_valid( @@ -4298,23 +4868,29 @@ def put_dictionary_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[{str}]") + _json = self._serialize.body(array_body, '[{str}]') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4325,4 +4901,5 @@ def put_dictionary_valid( if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py index 877b4dde4a8..f570de0377a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py index 877b4dde4a8..f570de0377a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/__init__.py index d55ccad1f57..5960c353a89 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/__init__.py index d55ccad1f57..5960c353a89 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/__init__.py index c845d24af2c..e4684d784ee 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py index aa4888627b5..2d08effd9f7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATArrayService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_configuration.py index 31838f4dc03..009349e6f86 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/__init__.py index e216d69d910..9992f153487 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService - -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py index 835647b23e6..c16bb531137 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations - class AutoRestSwaggerBATArrayService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATArrayService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_configuration.py index 99fd3c7c6ab..71ef2cbc2a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/__init__.py index b2189a3ae1f..704181d72a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._array_operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py index adeca49d20d..3d6c0646ff6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,83 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._array_operations import ( - build_get_array_empty_request, - build_get_array_item_empty_request, - build_get_array_item_null_request, - build_get_array_null_request, - build_get_array_valid_request, - build_get_base64_url_request, - build_get_boolean_invalid_null_request, - build_get_boolean_invalid_string_request, - build_get_boolean_tfft_request, - build_get_byte_invalid_null_request, - build_get_byte_valid_request, - build_get_complex_empty_request, - build_get_complex_item_empty_request, - build_get_complex_item_null_request, - build_get_complex_null_request, - build_get_complex_valid_request, - build_get_date_invalid_chars_request, - build_get_date_invalid_null_request, - build_get_date_time_invalid_chars_request, - build_get_date_time_invalid_null_request, - build_get_date_time_rfc1123_valid_request, - build_get_date_time_valid_request, - build_get_date_valid_request, - build_get_dictionary_empty_request, - build_get_dictionary_item_empty_request, - build_get_dictionary_item_null_request, - build_get_dictionary_null_request, - build_get_dictionary_valid_request, - build_get_double_invalid_null_request, - build_get_double_invalid_string_request, - build_get_double_valid_request, - build_get_duration_valid_request, - build_get_empty_request, - build_get_enum_valid_request, - build_get_float_invalid_null_request, - build_get_float_invalid_string_request, - build_get_float_valid_request, - build_get_int_invalid_null_request, - build_get_int_invalid_string_request, - build_get_integer_valid_request, - build_get_invalid_request, - build_get_long_invalid_null_request, - build_get_long_invalid_string_request, - build_get_long_valid_request, - build_get_null_request, - build_get_string_enum_valid_request, - build_get_string_valid_request, - build_get_string_with_invalid_request, - build_get_string_with_null_request, - build_get_uuid_invalid_chars_request, - build_get_uuid_valid_request, - build_put_array_valid_request, - build_put_boolean_tfft_request, - build_put_byte_valid_request, - build_put_complex_valid_request, - build_put_date_time_rfc1123_valid_request, - build_put_date_time_valid_request, - build_put_date_valid_request, - build_put_dictionary_valid_request, - build_put_double_valid_request, - build_put_duration_valid_request, - build_put_empty_request, - build_put_enum_valid_request, - build_put_float_valid_request, - build_put_integer_valid_request, - build_put_long_valid_request, - build_put_string_enum_valid_request, - build_put_string_valid_request, - build_put_uuid_valid_request, -) - -T = TypeVar("T") +from ...operations._array_operations import build_get_array_empty_request, build_get_array_item_empty_request, build_get_array_item_null_request, build_get_array_null_request, build_get_array_valid_request, build_get_base64_url_request, build_get_boolean_invalid_null_request, build_get_boolean_invalid_string_request, build_get_boolean_tfft_request, build_get_byte_invalid_null_request, build_get_byte_valid_request, build_get_complex_empty_request, build_get_complex_item_empty_request, build_get_complex_item_null_request, build_get_complex_null_request, build_get_complex_valid_request, build_get_date_invalid_chars_request, build_get_date_invalid_null_request, build_get_date_time_invalid_chars_request, build_get_date_time_invalid_null_request, build_get_date_time_rfc1123_valid_request, build_get_date_time_valid_request, build_get_date_valid_request, build_get_dictionary_empty_request, build_get_dictionary_item_empty_request, build_get_dictionary_item_null_request, build_get_dictionary_null_request, build_get_dictionary_valid_request, build_get_double_invalid_null_request, build_get_double_invalid_string_request, build_get_double_valid_request, build_get_duration_valid_request, build_get_empty_request, build_get_enum_valid_request, build_get_float_invalid_null_request, build_get_float_invalid_string_request, build_get_float_valid_request, build_get_int_invalid_null_request, build_get_int_invalid_string_request, build_get_integer_valid_request, build_get_invalid_request, build_get_long_invalid_null_request, build_get_long_invalid_string_request, build_get_long_valid_request, build_get_null_request, build_get_string_enum_valid_request, build_get_string_valid_request, build_get_string_with_invalid_request, build_get_string_with_null_request, build_get_uuid_invalid_chars_request, build_get_uuid_valid_request, build_put_array_valid_request, build_put_boolean_tfft_request, build_put_byte_valid_request, build_put_complex_valid_request, build_put_date_time_rfc1123_valid_request, build_put_date_time_valid_request, build_put_date_valid_request, build_put_dictionary_valid_request, build_put_double_valid_request, build_put_duration_valid_request, build_put_empty_request, build_put_enum_valid_request, build_put_float_valid_request, build_put_integer_valid_request, build_put_long_valid_request, build_put_string_enum_valid_request, build_put_string_valid_request, build_put_uuid_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ArrayOperations: +class ArrayOperations: # pylint: disable=too-many-public-methods """ArrayOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -123,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> List[int]: + async def get_null( + self, + **kwargs: Any + ) -> List[int]: """Get null array value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -131,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -149,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/array/null"} # type: ignore + get_null.metadata = {'url': '/array/null'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> List[int]: + async def get_invalid( + self, + **kwargs: Any + ) -> List[int]: """Get invalid array [1, 2, 3. :keyword callable cls: A custom type or function that will be passed the direct response @@ -167,17 +102,24 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,17 +127,21 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore + get_invalid.metadata = {'url': '/array/invalid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> List[int]: + async def get_empty( + self, + **kwargs: Any + ) -> List[int]: """Get empty array value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -203,17 +149,24 @@ async def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -221,17 +174,22 @@ async def get_empty(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/array/empty"} # type: ignore + get_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: + async def put_empty( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value empty []. :param array_body: @@ -241,23 +199,29 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,10 +232,14 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/array/empty"} # type: ignore + put_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace_async - async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: + async def get_boolean_tfft( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, false, false, true]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -279,17 +247,24 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -297,17 +272,22 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: + async def put_boolean_tfft( + self, + array_body: List[bool], + **kwargs: Any + ) -> None: """Set array value empty [true, false, false, true]. :param array_body: @@ -317,23 +297,29 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bool]") + _json = self._serialize.body(array_body, '[bool]') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,10 +330,14 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, null, false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -355,17 +345,24 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,17 +370,21 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/array/prim/boolean/true.null.false'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, 'boolean', false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -391,17 +392,24 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,17 +417,21 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/array/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace_async - async def get_integer_valid(self, **kwargs: Any) -> List[int]: + async def get_integer_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -427,17 +439,24 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -445,17 +464,22 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_integer_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -465,23 +489,29 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[int]") + _json = self._serialize.body(array_body, '[int]') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -492,10 +522,14 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -503,17 +537,24 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,17 +562,21 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/array/prim/integer/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -539,17 +584,24 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,17 +609,21 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/array/prim/integer/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_long_valid(self, **kwargs: Any) -> List[int]: + async def get_long_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -575,17 +631,24 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -593,17 +656,22 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_long_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -613,23 +681,29 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[long]") + _json = self._serialize.body(array_body, '[long]') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,10 +714,14 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -651,17 +729,24 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -669,17 +754,21 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/array/prim/long/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -687,17 +776,24 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -705,17 +801,21 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/array/prim/long/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_float_valid(self, **kwargs: Any) -> List[float]: + async def get_float_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -723,17 +823,24 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -741,17 +848,22 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_float_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -761,23 +873,29 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -788,10 +906,14 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -799,17 +921,24 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -817,17 +946,21 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/array/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -835,17 +968,24 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -853,17 +993,21 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/array/prim/float/1.number.0'} # type: ignore + @distributed_trace_async - async def get_double_valid(self, **kwargs: Any) -> List[float]: + async def get_double_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -871,17 +1015,24 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -889,17 +1040,22 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_double_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -909,23 +1065,29 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -936,10 +1098,14 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -947,17 +1113,24 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -965,17 +1138,21 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/array/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -983,17 +1160,24 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1001,17 +1185,21 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/array/prim/double/1.number.0'} # type: ignore + @distributed_trace_async - async def get_string_valid(self, **kwargs: Any) -> List[str]: + async def get_string_valid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1019,17 +1207,24 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1037,17 +1232,22 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_string_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1057,23 +1257,29 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1084,10 +1290,14 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: + async def get_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.FooEnum"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1095,17 +1305,24 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnu :rtype: list[str or ~vanilla.body.array.models.FooEnum] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], + template_url=self.get_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1113,17 +1330,22 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnu error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + get_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], **kwargs: Any) -> None: + async def put_enum_valid( + self, + array_body: List[Union[str, "_models.FooEnum"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1133,23 +1355,29 @@ async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_enum_valid.metadata["url"], + template_url=self.put_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1160,10 +1388,14 @@ async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], if cls: return cls(pipeline_response, None, {}) - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + put_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0"]]: + async def get_string_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.Enum0"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1171,17 +1403,24 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models :rtype: list[str or ~vanilla.body.array.models.Enum0] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.Enum0"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], + template_url=self.get_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1189,17 +1428,22 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + get_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1"]], **kwargs: Any) -> None: + async def put_string_enum_valid( + self, + array_body: List[Union[str, "_models.Enum1"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1209,23 +1453,29 @@ async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1 :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_enum_valid.metadata["url"], + template_url=self.put_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1236,10 +1486,14 @@ async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1 if cls: return cls(pipeline_response, None, {}) - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + put_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_string_with_null(self, **kwargs: Any) -> List[str]: + async def get_string_with_null( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', null, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1247,17 +1501,24 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1265,17 +1526,21 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/array/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace_async - async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: + async def get_string_with_invalid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', 123, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1283,17 +1548,24 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1301,17 +1573,21 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/array/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace_async - async def get_uuid_valid(self, **kwargs: Any) -> List[str]: + async def get_uuid_valid( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1320,17 +1596,24 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], + template_url=self.get_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1338,17 +1621,22 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + get_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace_async - async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_uuid_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1359,23 +1647,29 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_uuid_valid_request( content_type=content_type, json=_json, - template_url=self.put_uuid_valid.metadata["url"], + template_url=self.put_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1386,10 +1680,14 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + put_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace_async - async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: + async def get_uuid_invalid_chars( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1397,17 +1695,24 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], + template_url=self.get_uuid_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1415,17 +1720,21 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore + get_uuid_invalid_chars.metadata = {'url': '/array/prim/uuid/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_valid( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1433,17 +1742,24 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1451,17 +1767,22 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace_async - async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None: + async def put_date_valid( + self, + array_body: List[datetime.date], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. :param array_body: @@ -1471,23 +1792,29 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[date]") + _json = self._serialize.body(array_body, '[date]') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1498,10 +1825,14 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace_async - async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2012-01-01', null, '1776-07-04']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1509,17 +1840,24 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1527,17 +1865,21 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/array/prim/date/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2011-03-22', 'date']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1545,17 +1887,24 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1563,17 +1912,21 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/array/prim/date/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1582,17 +1935,24 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1600,17 +1960,22 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1621,23 +1986,29 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[iso-8601]") + _json = self._serialize.body(array_body, '[iso-8601]') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1648,10 +2019,14 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', null]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1659,17 +2034,24 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1677,17 +2059,21 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/array/prim/date-time/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1695,17 +2081,24 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1713,17 +2106,21 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/array/prim/date-time/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1732,17 +2129,24 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1750,17 +2154,22 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) + deserialized = self._deserialize('[rfc-1123]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_rfc1123_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1771,23 +2180,29 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[rfc-1123]") + _json = self._serialize.body(array_body, '[rfc-1123]') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1798,10 +2213,14 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: + async def get_duration_valid( + self, + **kwargs: Any + ) -> List[datetime.timedelta]: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1809,17 +2228,24 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1827,17 +2253,22 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) + deserialized = self._deserialize('[duration]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any) -> None: + async def put_duration_valid( + self, + array_body: List[datetime.timedelta], + **kwargs: Any + ) -> None: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :param array_body: @@ -1847,23 +2278,29 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[duration]") + _json = self._serialize.body(array_body, '[duration]') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1874,10 +2311,14 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_valid( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -1886,17 +2327,24 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1904,17 +2352,22 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: + async def put_byte_valid( + self, + array_body: List[bytearray], + **kwargs: Any + ) -> None: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -1925,23 +2378,29 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bytearray]") + _json = self._serialize.body(array_body, '[bytearray]') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1952,10 +2411,14 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_invalid_null( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1963,17 +2426,24 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1981,17 +2451,21 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/array/prim/byte/invalidnull'} # type: ignore + @distributed_trace_async - async def get_base64_url(self, **kwargs: Any) -> List[bytes]: + async def get_base64_url( + self, + **kwargs: Any + ) -> List[bytes]: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -2000,17 +2474,24 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2018,17 +2499,21 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) + deserialized = self._deserialize('[base64]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/array/prim/base64url/valid'} # type: ignore + @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type null value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2036,17 +2521,24 @@ async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2054,17 +2546,21 @@ async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/array/complex/null'} # type: ignore + @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get empty array of complex type []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2072,17 +2568,24 @@ async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2090,17 +2593,21 @@ async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/array/complex/empty'} # type: ignore + @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_item_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -2109,17 +2616,24 @@ async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2127,17 +2641,21 @@ async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/array/complex/itemnull'} # type: ignore + @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_item_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -2146,17 +2664,24 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"] :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2164,17 +2689,21 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/array/complex/itemempty'} # type: ignore + @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_valid( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2183,17 +2712,24 @@ async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2201,17 +2737,22 @@ async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace_async - async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: Any) -> None: + async def put_complex_valid( + self, + array_body: List["_models.Product"], + **kwargs: Any + ) -> None: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2222,23 +2763,29 @@ async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[Product]") + _json = self._serialize.body(array_body, '[Product]') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2249,10 +2796,14 @@ async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace_async - async def get_array_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get a null array. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2260,17 +2811,24 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2278,17 +2836,21 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore + get_array_null.metadata = {'url': '/array/array/null'} # type: ignore + @distributed_trace_async - async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an empty array []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2296,17 +2858,24 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2314,17 +2883,21 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/array/array/empty'} # type: ignore + @distributed_trace_async - async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2332,17 +2905,24 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2350,17 +2930,21 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/array/array/itemnull'} # type: ignore + @distributed_trace_async - async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2368,17 +2952,24 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2386,17 +2977,21 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/array/array/itemempty'} # type: ignore + @distributed_trace_async - async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: + async def get_array_valid( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2404,17 +2999,24 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2422,17 +3024,22 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace_async - async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: + async def put_array_valid( + self, + array_body: List[List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :param array_body: @@ -2442,23 +3049,29 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[[str]]") + _json = self._serialize.body(array_body, '[[str]]') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2469,10 +3082,14 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace_async - async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries with value null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2480,17 +3097,24 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2498,17 +3122,21 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/array/dictionary/null'} # type: ignore + @distributed_trace_async - async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2516,17 +3144,24 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2534,17 +3169,21 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/array/dictionary/empty'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2553,17 +3192,24 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2571,17 +3217,21 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/array/dictionary/itemnull'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2590,17 +3240,24 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2608,17 +3265,21 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/array/dictionary/itemempty'} # type: ignore + @distributed_trace_async - async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_valid( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2627,17 +3288,24 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2645,17 +3313,22 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + @distributed_trace_async - async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) -> None: + async def put_dictionary_valid( + self, + array_body: List[Dict[str, str]], + **kwargs: Any + ) -> None: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2666,23 +3339,29 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[{str}]") + _json = self._serialize.body(array_body, '[{str}]') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2693,4 +3372,5 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py index a4d2d993c02..7728241cd8f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py @@ -20,9 +20,9 @@ ) __all__ = [ - "Error", - "Product", - "Enum0", - "Enum1", - "FooEnum", + 'Error', + 'Product', + 'Enum0', + 'Enum1', + 'FooEnum', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_auto_rest_swagger_bat_array_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_auto_rest_swagger_bat_array_service_enums.py index 9ad0742e428..fb3ff53b36b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_auto_rest_swagger_bat_array_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_auto_rest_swagger_bat_array_service_enums.py @@ -17,14 +17,12 @@ class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO2 = "foo2" FOO3 = "foo3" - class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO1 = "foo1" FOO2 = "foo2" FOO3 = "foo3" - class FooEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO1 = "foo1" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models.py index a3dfbe1eb16..226a489fc2f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class Product(msrest.serialization.Model): @@ -46,11 +49,14 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword integer: :paramtype integer: int @@ -58,5 +64,5 @@ def __init__(self, **kwargs): :paramtype string: str """ super(Product, self).__init__(**kwargs) - self.integer = kwargs.get("integer", None) - self.string = kwargs.get("string", None) + self.integer = kwargs.get('integer', None) + self.string = kwargs.get('string', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models_py3.py index b37adff2989..2a4ce7f081b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -48,11 +54,17 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, *, integer: Optional[int] = None, string: Optional[str] = None, **kwargs): + def __init__( + self, + *, + integer: Optional[int] = None, + string: Optional[str] = None, + **kwargs + ): """ :keyword integer: :paramtype integer: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/__init__.py index b2189a3ae1f..704181d72a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/__init__.py @@ -9,5 +9,5 @@ from ._array_operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py index 2ff3783c75e..5594083d2f7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1489,7 +1481,7 @@ def build_put_dictionary_valid_request( ) # fmt: on -class ArrayOperations(object): +class ArrayOperations(object): # pylint: disable=too-many-public-methods """ArrayOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -1513,7 +1505,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get null array value. @@ -1523,17 +1516,24 @@ def get_null( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1541,18 +1541,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/array/null"} # type: ignore + get_null.metadata = {'url': '/array/null'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get invalid array [1, 2, 3. @@ -1562,17 +1564,24 @@ def get_invalid( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1580,18 +1589,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore + get_invalid.metadata = {'url': '/array/invalid'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get empty array value []. @@ -1601,17 +1612,24 @@ def get_empty( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1619,14 +1637,15 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/array/empty"} # type: ignore + get_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace def put_empty( @@ -1644,23 +1663,29 @@ def put_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1671,11 +1696,13 @@ def put_empty( if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/array/empty"} # type: ignore + put_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace def get_boolean_tfft( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, false, false, true]. @@ -1685,17 +1712,24 @@ def get_boolean_tfft( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1703,14 +1737,15 @@ def get_boolean_tfft( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace def put_boolean_tfft( @@ -1728,23 +1763,29 @@ def put_boolean_tfft( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bool]") + _json = self._serialize.body(array_body, '[bool]') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1755,11 +1796,13 @@ def put_boolean_tfft( if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace def get_boolean_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, null, false]. @@ -1769,17 +1812,24 @@ def get_boolean_invalid_null( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1787,18 +1837,20 @@ def get_boolean_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/array/prim/boolean/true.null.false'} # type: ignore + @distributed_trace def get_boolean_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, 'boolean', false]. @@ -1808,17 +1860,24 @@ def get_boolean_invalid_string( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1826,18 +1885,20 @@ def get_boolean_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/array/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace def get_integer_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, -1, 3, 300]. @@ -1847,17 +1908,24 @@ def get_integer_valid( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1865,14 +1933,15 @@ def get_integer_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def put_integer_valid( @@ -1890,23 +1959,29 @@ def put_integer_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[int]") + _json = self._serialize.body(array_body, '[int]') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1917,11 +1992,13 @@ def put_integer_valid( if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def get_int_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, null, 0]. @@ -1931,17 +2008,24 @@ def get_int_invalid_null( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1949,18 +2033,20 @@ def get_int_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/array/prim/integer/1.null.zero'} # type: ignore + @distributed_trace def get_int_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, 'integer', 0]. @@ -1970,17 +2056,24 @@ def get_int_invalid_string( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1988,18 +2081,20 @@ def get_int_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/array/prim/integer/1.integer.0'} # type: ignore + @distributed_trace def get_long_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, -1, 3, 300]. @@ -2009,17 +2104,24 @@ def get_long_valid( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2027,14 +2129,15 @@ def get_long_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def put_long_valid( @@ -2052,23 +2155,29 @@ def put_long_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[long]") + _json = self._serialize.body(array_body, '[long]') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2079,11 +2188,13 @@ def put_long_valid( if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def get_long_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get long array value [1, null, 0]. @@ -2093,17 +2204,24 @@ def get_long_invalid_null( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2111,18 +2229,20 @@ def get_long_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/array/prim/long/1.null.zero'} # type: ignore + @distributed_trace def get_long_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get long array value [1, 'integer', 0]. @@ -2132,17 +2252,24 @@ def get_long_invalid_string( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2150,18 +2277,20 @@ def get_long_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/array/prim/long/1.integer.0'} # type: ignore + @distributed_trace def get_float_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0, -0.01, 1.2e20]. @@ -2171,17 +2300,24 @@ def get_float_valid( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2189,14 +2325,15 @@ def get_float_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_float_valid( @@ -2214,23 +2351,29 @@ def put_float_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2241,11 +2384,13 @@ def put_float_valid( if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0.0, null, -1.2e20]. @@ -2255,17 +2400,24 @@ def get_float_invalid_null( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2273,18 +2425,20 @@ def get_float_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/array/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get boolean array value [1.0, 'number', 0.0]. @@ -2294,17 +2448,24 @@ def get_float_invalid_string( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2312,18 +2473,20 @@ def get_float_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/array/prim/float/1.number.0'} # type: ignore + @distributed_trace def get_double_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0, -0.01, 1.2e20]. @@ -2333,17 +2496,24 @@ def get_double_valid( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2351,14 +2521,15 @@ def get_double_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_double_valid( @@ -2376,23 +2547,29 @@ def put_double_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2403,11 +2580,13 @@ def put_double_valid( if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0.0, null, -1.2e20]. @@ -2417,17 +2596,24 @@ def get_double_invalid_null( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2435,18 +2621,20 @@ def get_double_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/array/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get boolean array value [1.0, 'number', 0.0]. @@ -2456,17 +2644,24 @@ def get_double_invalid_string( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2474,18 +2669,20 @@ def get_double_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/array/prim/double/1.number.0'} # type: ignore + @distributed_trace def get_string_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo1', 'foo2', 'foo3']. @@ -2495,17 +2692,24 @@ def get_string_valid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2513,14 +2717,15 @@ def get_string_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_string_valid( @@ -2538,23 +2743,29 @@ def put_string_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2565,11 +2776,13 @@ def put_string_valid( if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_enum_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Union[str, "_models.FooEnum"]] """Get enum array value ['foo1', 'foo2', 'foo3']. @@ -2579,17 +2792,24 @@ def get_enum_valid( :rtype: list[str or ~vanilla.body.array.models.FooEnum] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], + template_url=self.get_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2597,14 +2817,15 @@ def get_enum_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + get_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_enum_valid( @@ -2622,23 +2843,29 @@ def put_enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_enum_valid.metadata["url"], + template_url=self.put_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2649,11 +2876,13 @@ def put_enum_valid( if cls: return cls(pipeline_response, None, {}) - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + put_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_string_enum_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Union[str, "_models.Enum0"]] """Get enum array value ['foo1', 'foo2', 'foo3']. @@ -2663,17 +2892,24 @@ def get_string_enum_valid( :rtype: list[str or ~vanilla.body.array.models.Enum0] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.Enum0"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], + template_url=self.get_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2681,14 +2917,15 @@ def get_string_enum_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + get_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_string_enum_valid( @@ -2706,23 +2943,29 @@ def put_string_enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_enum_valid.metadata["url"], + template_url=self.put_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2733,11 +2976,13 @@ def put_string_enum_valid( if cls: return cls(pipeline_response, None, {}) - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + put_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_string_with_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo', null, 'foo2']. @@ -2747,17 +2992,24 @@ def get_string_with_null( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2765,18 +3017,20 @@ def get_string_with_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/array/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace def get_string_with_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo', 123, 'foo2']. @@ -2786,17 +3040,24 @@ def get_string_with_invalid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2804,18 +3065,20 @@ def get_string_with_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/array/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace def get_uuid_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', @@ -2826,17 +3089,24 @@ def get_uuid_valid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], + template_url=self.get_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2844,14 +3114,15 @@ def get_uuid_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + get_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace def put_uuid_valid( @@ -2870,23 +3141,29 @@ def put_uuid_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_uuid_valid_request( content_type=content_type, json=_json, - template_url=self.put_uuid_valid.metadata["url"], + template_url=self.put_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2897,11 +3174,13 @@ def put_uuid_valid( if cls: return cls(pipeline_response, None, {}) - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + put_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace def get_uuid_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. @@ -2911,17 +3190,24 @@ def get_uuid_invalid_chars( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], + template_url=self.get_uuid_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2929,18 +3215,20 @@ def get_uuid_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore + get_uuid_invalid_chars.metadata = {'url': '/array/prim/uuid/invalidchars'} # type: ignore + @distributed_trace def get_date_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. @@ -2950,17 +3238,24 @@ def get_date_valid( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2968,14 +3263,15 @@ def get_date_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace def put_date_valid( @@ -2993,23 +3289,29 @@ def put_date_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[date]") + _json = self._serialize.body(array_body, '[date]') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3020,11 +3322,13 @@ def put_date_valid( if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace def get_date_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get date array value ['2012-01-01', null, '1776-07-04']. @@ -3034,17 +3338,24 @@ def get_date_invalid_null( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3052,18 +3363,20 @@ def get_date_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/array/prim/date/invalidnull'} # type: ignore + @distributed_trace def get_date_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get date array value ['2011-03-22', 'date']. @@ -3073,17 +3386,24 @@ def get_date_invalid_chars( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3091,18 +3411,20 @@ def get_date_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/array/prim/date/invalidchars'} # type: ignore + @distributed_trace def get_date_time_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', @@ -3113,17 +3435,24 @@ def get_date_time_valid( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3131,14 +3460,15 @@ def get_date_time_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace def put_date_time_valid( @@ -3157,23 +3487,29 @@ def put_date_time_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[iso-8601]") + _json = self._serialize.body(array_body, '[iso-8601]') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3184,11 +3520,13 @@ def put_date_time_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace def get_date_time_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date array value ['2000-12-01t00:00:01z', null]. @@ -3198,17 +3536,24 @@ def get_date_time_invalid_null( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3216,18 +3561,20 @@ def get_date_time_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/array/prim/date-time/invalidnull'} # type: ignore + @distributed_trace def get_date_time_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date array value ['2000-12-01t00:00:01z', 'date-time']. @@ -3237,17 +3584,24 @@ def get_date_time_invalid_chars( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3255,18 +3609,20 @@ def get_date_time_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/array/prim/date-time/invalidchars'} # type: ignore + @distributed_trace def get_date_time_rfc1123_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', @@ -3277,17 +3633,24 @@ def get_date_time_rfc1123_valid( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3295,14 +3658,15 @@ def get_date_time_rfc1123_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) + deserialized = self._deserialize('[rfc-1123]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def put_date_time_rfc1123_valid( @@ -3321,23 +3685,29 @@ def put_date_time_rfc1123_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[rfc-1123]") + _json = self._serialize.body(array_body, '[rfc-1123]') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3348,11 +3718,13 @@ def put_date_time_rfc1123_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def get_duration_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.timedelta] """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. @@ -3362,17 +3734,24 @@ def get_duration_valid( :rtype: list[~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3380,14 +3759,15 @@ def get_duration_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) + deserialized = self._deserialize('[duration]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace def put_duration_valid( @@ -3405,23 +3785,29 @@ def put_duration_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[duration]") + _json = self._serialize.body(array_body, '[duration]') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3432,11 +3818,13 @@ def put_duration_valid( if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace def get_byte_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytearray] """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded @@ -3447,17 +3835,24 @@ def get_byte_valid( :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3465,14 +3860,15 @@ def get_byte_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace def put_byte_valid( @@ -3491,23 +3887,29 @@ def put_byte_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bytearray]") + _json = self._serialize.body(array_body, '[bytearray]') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3518,11 +3920,13 @@ def put_byte_valid( if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace def get_byte_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytearray] """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. @@ -3532,17 +3936,24 @@ def get_byte_invalid_null( :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3550,18 +3961,20 @@ def get_byte_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/array/prim/byte/invalidnull'} # type: ignore + @distributed_trace def get_base64_url( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytes] """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with @@ -3572,17 +3985,24 @@ def get_base64_url( :rtype: list[bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3590,18 +4010,20 @@ def get_base64_url( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) + deserialized = self._deserialize('[base64]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/array/prim/base64url/valid'} # type: ignore + @distributed_trace def get_complex_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type null value. @@ -3611,17 +4033,24 @@ def get_complex_null( :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3629,18 +4058,20 @@ def get_complex_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/array/complex/null'} # type: ignore + @distributed_trace def get_complex_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get empty array of complex type []. @@ -3650,17 +4081,24 @@ def get_complex_empty( :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3668,18 +4106,20 @@ def get_complex_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/array/complex/empty'} # type: ignore + @distributed_trace def get_complex_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, @@ -3690,17 +4130,24 @@ def get_complex_item_null( :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3708,18 +4155,20 @@ def get_complex_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/array/complex/itemnull'} # type: ignore + @distributed_trace def get_complex_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, @@ -3730,17 +4179,24 @@ def get_complex_item_empty( :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3748,18 +4204,20 @@ def get_complex_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/array/complex/itemempty'} # type: ignore + @distributed_trace def get_complex_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, @@ -3770,17 +4228,24 @@ def get_complex_valid( :rtype: list[~vanilla.body.array.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3788,14 +4253,15 @@ def get_complex_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace def put_complex_valid( @@ -3814,23 +4280,29 @@ def put_complex_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[Product]") + _json = self._serialize.body(array_body, '[Product]') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3841,11 +4313,13 @@ def put_complex_valid( if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace def get_array_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get a null array. @@ -3855,17 +4329,24 @@ def get_array_null( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3873,18 +4354,20 @@ def get_array_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore + get_array_null.metadata = {'url': '/array/array/null'} # type: ignore + @distributed_trace def get_array_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an empty array []. @@ -3894,17 +4377,24 @@ def get_array_empty( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3912,18 +4402,20 @@ def get_array_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/array/array/empty'} # type: ignore + @distributed_trace def get_array_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. @@ -3933,17 +4425,24 @@ def get_array_item_null( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3951,18 +4450,20 @@ def get_array_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/array/array/itemnull'} # type: ignore + @distributed_trace def get_array_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. @@ -3972,17 +4473,24 @@ def get_array_item_empty( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3990,18 +4498,20 @@ def get_array_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/array/array/itemempty'} # type: ignore + @distributed_trace def get_array_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. @@ -4011,17 +4521,24 @@ def get_array_valid( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4029,14 +4546,15 @@ def get_array_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace def put_array_valid( @@ -4054,23 +4572,29 @@ def put_array_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[[str]]") + _json = self._serialize.body(array_body, '[[str]]') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4081,11 +4605,13 @@ def put_array_valid( if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace def get_dictionary_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries with value null. @@ -4095,17 +4621,24 @@ def get_dictionary_null( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4113,18 +4646,20 @@ def get_dictionary_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/array/dictionary/null'} # type: ignore + @distributed_trace def get_dictionary_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value []. @@ -4134,17 +4669,24 @@ def get_dictionary_empty( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4152,18 +4694,20 @@ def get_dictionary_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/array/dictionary/empty'} # type: ignore + @distributed_trace def get_dictionary_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4174,17 +4718,24 @@ def get_dictionary_item_null( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4192,18 +4743,20 @@ def get_dictionary_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/array/dictionary/itemnull'} # type: ignore + @distributed_trace def get_dictionary_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4214,17 +4767,24 @@ def get_dictionary_item_empty( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4232,18 +4792,20 @@ def get_dictionary_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/array/dictionary/itemempty'} # type: ignore + @distributed_trace def get_dictionary_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4254,17 +4816,24 @@ def get_dictionary_valid( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4272,14 +4841,15 @@ def get_dictionary_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + @distributed_trace def put_dictionary_valid( @@ -4298,23 +4868,29 @@ def put_dictionary_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[{str}]") + _json = self._serialize.body(array_body, '[{str}]') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4325,4 +4901,5 @@ def put_dictionary_valid( if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py index c845d24af2c..e4684d784ee 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py index d88cc82c6df..af493cb29aa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATArrayService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py index 31838f4dc03..009349e6f86 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py index e216d69d910..9992f153487 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService - -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py index dbba58965b9..27019ffd20b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations - class AutoRestSwaggerBATArrayService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATArrayService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py index 99fd3c7c6ab..71ef2cbc2a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py index b2189a3ae1f..704181d72a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._array_operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py index cdcc7f9602a..61f69fc1ade 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,83 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._array_operations_py3 import ( - build_get_array_empty_request, - build_get_array_item_empty_request, - build_get_array_item_null_request, - build_get_array_null_request, - build_get_array_valid_request, - build_get_base64_url_request, - build_get_boolean_invalid_null_request, - build_get_boolean_invalid_string_request, - build_get_boolean_tfft_request, - build_get_byte_invalid_null_request, - build_get_byte_valid_request, - build_get_complex_empty_request, - build_get_complex_item_empty_request, - build_get_complex_item_null_request, - build_get_complex_null_request, - build_get_complex_valid_request, - build_get_date_invalid_chars_request, - build_get_date_invalid_null_request, - build_get_date_time_invalid_chars_request, - build_get_date_time_invalid_null_request, - build_get_date_time_rfc1123_valid_request, - build_get_date_time_valid_request, - build_get_date_valid_request, - build_get_dictionary_empty_request, - build_get_dictionary_item_empty_request, - build_get_dictionary_item_null_request, - build_get_dictionary_null_request, - build_get_dictionary_valid_request, - build_get_double_invalid_null_request, - build_get_double_invalid_string_request, - build_get_double_valid_request, - build_get_duration_valid_request, - build_get_empty_request, - build_get_enum_valid_request, - build_get_float_invalid_null_request, - build_get_float_invalid_string_request, - build_get_float_valid_request, - build_get_int_invalid_null_request, - build_get_int_invalid_string_request, - build_get_integer_valid_request, - build_get_invalid_request, - build_get_long_invalid_null_request, - build_get_long_invalid_string_request, - build_get_long_valid_request, - build_get_null_request, - build_get_string_enum_valid_request, - build_get_string_valid_request, - build_get_string_with_invalid_request, - build_get_string_with_null_request, - build_get_uuid_invalid_chars_request, - build_get_uuid_valid_request, - build_put_array_valid_request, - build_put_boolean_tfft_request, - build_put_byte_valid_request, - build_put_complex_valid_request, - build_put_date_time_rfc1123_valid_request, - build_put_date_time_valid_request, - build_put_date_valid_request, - build_put_dictionary_valid_request, - build_put_double_valid_request, - build_put_duration_valid_request, - build_put_empty_request, - build_put_enum_valid_request, - build_put_float_valid_request, - build_put_integer_valid_request, - build_put_long_valid_request, - build_put_string_enum_valid_request, - build_put_string_valid_request, - build_put_uuid_valid_request, -) - -T = TypeVar("T") +from ...operations._array_operations_py3 import build_get_array_empty_request, build_get_array_item_empty_request, build_get_array_item_null_request, build_get_array_null_request, build_get_array_valid_request, build_get_base64_url_request, build_get_boolean_invalid_null_request, build_get_boolean_invalid_string_request, build_get_boolean_tfft_request, build_get_byte_invalid_null_request, build_get_byte_valid_request, build_get_complex_empty_request, build_get_complex_item_empty_request, build_get_complex_item_null_request, build_get_complex_null_request, build_get_complex_valid_request, build_get_date_invalid_chars_request, build_get_date_invalid_null_request, build_get_date_time_invalid_chars_request, build_get_date_time_invalid_null_request, build_get_date_time_rfc1123_valid_request, build_get_date_time_valid_request, build_get_date_valid_request, build_get_dictionary_empty_request, build_get_dictionary_item_empty_request, build_get_dictionary_item_null_request, build_get_dictionary_null_request, build_get_dictionary_valid_request, build_get_double_invalid_null_request, build_get_double_invalid_string_request, build_get_double_valid_request, build_get_duration_valid_request, build_get_empty_request, build_get_enum_valid_request, build_get_float_invalid_null_request, build_get_float_invalid_string_request, build_get_float_valid_request, build_get_int_invalid_null_request, build_get_int_invalid_string_request, build_get_integer_valid_request, build_get_invalid_request, build_get_long_invalid_null_request, build_get_long_invalid_string_request, build_get_long_valid_request, build_get_null_request, build_get_string_enum_valid_request, build_get_string_valid_request, build_get_string_with_invalid_request, build_get_string_with_null_request, build_get_uuid_invalid_chars_request, build_get_uuid_valid_request, build_put_array_valid_request, build_put_boolean_tfft_request, build_put_byte_valid_request, build_put_complex_valid_request, build_put_date_time_rfc1123_valid_request, build_put_date_time_valid_request, build_put_date_valid_request, build_put_dictionary_valid_request, build_put_double_valid_request, build_put_duration_valid_request, build_put_empty_request, build_put_enum_valid_request, build_put_float_valid_request, build_put_integer_valid_request, build_put_long_valid_request, build_put_string_enum_valid_request, build_put_string_valid_request, build_put_uuid_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ArrayOperations: +class ArrayOperations: # pylint: disable=too-many-public-methods """ArrayOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -123,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> List[int]: + async def get_null( + self, + **kwargs: Any + ) -> List[int]: """Get null array value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -131,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -149,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/array/null"} # type: ignore + get_null.metadata = {'url': '/array/null'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> List[int]: + async def get_invalid( + self, + **kwargs: Any + ) -> List[int]: """Get invalid array [1, 2, 3. :keyword callable cls: A custom type or function that will be passed the direct response @@ -167,17 +102,24 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,17 +127,21 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore + get_invalid.metadata = {'url': '/array/invalid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> List[int]: + async def get_empty( + self, + **kwargs: Any + ) -> List[int]: """Get empty array value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -203,17 +149,24 @@ async def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -221,17 +174,22 @@ async def get_empty(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/array/empty"} # type: ignore + get_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: + async def put_empty( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value empty []. :param array_body: @@ -241,23 +199,29 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,10 +232,14 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/array/empty"} # type: ignore + put_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace_async - async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: + async def get_boolean_tfft( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, false, false, true]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -279,17 +247,24 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -297,17 +272,22 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: + async def put_boolean_tfft( + self, + array_body: List[bool], + **kwargs: Any + ) -> None: """Set array value empty [true, false, false, true]. :param array_body: @@ -317,23 +297,29 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bool]") + _json = self._serialize.body(array_body, '[bool]') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,10 +330,14 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, null, false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -355,17 +345,24 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,17 +370,21 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/array/prim/boolean/true.null.false'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, 'boolean', false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -391,17 +392,24 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,17 +417,21 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/array/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace_async - async def get_integer_valid(self, **kwargs: Any) -> List[int]: + async def get_integer_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -427,17 +439,24 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -445,17 +464,22 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_integer_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -465,23 +489,29 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[int]") + _json = self._serialize.body(array_body, '[int]') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -492,10 +522,14 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -503,17 +537,24 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,17 +562,21 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/array/prim/integer/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -539,17 +584,24 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,17 +609,21 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/array/prim/integer/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_long_valid(self, **kwargs: Any) -> List[int]: + async def get_long_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -575,17 +631,24 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -593,17 +656,22 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_long_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -613,23 +681,29 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[long]") + _json = self._serialize.body(array_body, '[long]') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -640,10 +714,14 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -651,17 +729,24 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -669,17 +754,21 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/array/prim/long/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -687,17 +776,24 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -705,17 +801,21 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/array/prim/long/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_float_valid(self, **kwargs: Any) -> List[float]: + async def get_float_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -723,17 +823,24 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -741,17 +848,22 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_float_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -761,23 +873,29 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -788,10 +906,14 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -799,17 +921,24 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -817,17 +946,21 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/array/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -835,17 +968,24 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -853,17 +993,21 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/array/prim/float/1.number.0'} # type: ignore + @distributed_trace_async - async def get_double_valid(self, **kwargs: Any) -> List[float]: + async def get_double_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -871,17 +1015,24 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -889,17 +1040,22 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_double_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -909,23 +1065,29 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -936,10 +1098,14 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -947,17 +1113,24 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -965,17 +1138,21 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/array/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -983,17 +1160,24 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1001,17 +1185,21 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/array/prim/double/1.number.0'} # type: ignore + @distributed_trace_async - async def get_string_valid(self, **kwargs: Any) -> List[str]: + async def get_string_valid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1019,17 +1207,24 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1037,17 +1232,22 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_string_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1057,23 +1257,29 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1084,10 +1290,14 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: + async def get_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.FooEnum"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1095,17 +1305,24 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnu :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], + template_url=self.get_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1113,17 +1330,22 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnu error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + get_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], **kwargs: Any) -> None: + async def put_enum_valid( + self, + array_body: List[Union[str, "_models.FooEnum"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1133,23 +1355,29 @@ async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_enum_valid.metadata["url"], + template_url=self.put_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1160,10 +1388,14 @@ async def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], if cls: return cls(pipeline_response, None, {}) - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + put_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0"]]: + async def get_string_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.Enum0"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1171,17 +1403,24 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum0] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.Enum0"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], + template_url=self.get_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1189,17 +1428,22 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + get_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1"]], **kwargs: Any) -> None: + async def put_string_enum_valid( + self, + array_body: List[Union[str, "_models.Enum1"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1209,23 +1453,29 @@ async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1 :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_enum_valid.metadata["url"], + template_url=self.put_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1236,10 +1486,14 @@ async def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1 if cls: return cls(pipeline_response, None, {}) - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + put_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_string_with_null(self, **kwargs: Any) -> List[str]: + async def get_string_with_null( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', null, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1247,17 +1501,24 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1265,17 +1526,21 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/array/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace_async - async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: + async def get_string_with_invalid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', 123, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1283,17 +1548,24 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1301,17 +1573,21 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/array/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace_async - async def get_uuid_valid(self, **kwargs: Any) -> List[str]: + async def get_uuid_valid( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1320,17 +1596,24 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], + template_url=self.get_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1338,17 +1621,22 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + get_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace_async - async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_uuid_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1359,23 +1647,29 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_uuid_valid_request( content_type=content_type, json=_json, - template_url=self.put_uuid_valid.metadata["url"], + template_url=self.put_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1386,10 +1680,14 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + put_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace_async - async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: + async def get_uuid_invalid_chars( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1397,17 +1695,24 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], + template_url=self.get_uuid_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1415,17 +1720,21 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore + get_uuid_invalid_chars.metadata = {'url': '/array/prim/uuid/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_valid( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1433,17 +1742,24 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1451,17 +1767,22 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace_async - async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None: + async def put_date_valid( + self, + array_body: List[datetime.date], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. :param array_body: @@ -1471,23 +1792,29 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[date]") + _json = self._serialize.body(array_body, '[date]') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1498,10 +1825,14 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace_async - async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2012-01-01', null, '1776-07-04']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1509,17 +1840,24 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1527,17 +1865,21 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/array/prim/date/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2011-03-22', 'date']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1545,17 +1887,24 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1563,17 +1912,21 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/array/prim/date/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1582,17 +1935,24 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1600,17 +1960,22 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1621,23 +1986,29 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[iso-8601]") + _json = self._serialize.body(array_body, '[iso-8601]') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1648,10 +2019,14 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', null]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1659,17 +2034,24 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1677,17 +2059,21 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/array/prim/date-time/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1695,17 +2081,24 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1713,17 +2106,21 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/array/prim/date-time/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1732,17 +2129,24 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1750,17 +2154,22 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) + deserialized = self._deserialize('[rfc-1123]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_rfc1123_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1771,23 +2180,29 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[rfc-1123]") + _json = self._serialize.body(array_body, '[rfc-1123]') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1798,10 +2213,14 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: + async def get_duration_valid( + self, + **kwargs: Any + ) -> List[datetime.timedelta]: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1809,17 +2228,24 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1827,17 +2253,22 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) + deserialized = self._deserialize('[duration]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any) -> None: + async def put_duration_valid( + self, + array_body: List[datetime.timedelta], + **kwargs: Any + ) -> None: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :param array_body: @@ -1847,23 +2278,29 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[duration]") + _json = self._serialize.body(array_body, '[duration]') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1874,10 +2311,14 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_valid( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -1886,17 +2327,24 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1904,17 +2352,22 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: + async def put_byte_valid( + self, + array_body: List[bytearray], + **kwargs: Any + ) -> None: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -1925,23 +2378,29 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bytearray]") + _json = self._serialize.body(array_body, '[bytearray]') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1952,10 +2411,14 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_invalid_null( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1963,17 +2426,24 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1981,17 +2451,21 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/array/prim/byte/invalidnull'} # type: ignore + @distributed_trace_async - async def get_base64_url(self, **kwargs: Any) -> List[bytes]: + async def get_base64_url( + self, + **kwargs: Any + ) -> List[bytes]: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -2000,17 +2474,24 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2018,17 +2499,21 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) + deserialized = self._deserialize('[base64]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/array/prim/base64url/valid'} # type: ignore + @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type null value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2036,17 +2521,24 @@ async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2054,17 +2546,21 @@ async def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/array/complex/null'} # type: ignore + @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get empty array of complex type []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2072,17 +2568,24 @@ async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2090,17 +2593,21 @@ async def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/array/complex/empty'} # type: ignore + @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_item_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -2109,17 +2616,24 @@ async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2127,17 +2641,21 @@ async def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/array/complex/itemnull'} # type: ignore + @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_item_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -2146,17 +2664,24 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"] :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2164,17 +2689,21 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/array/complex/itemempty'} # type: ignore + @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: + async def get_complex_valid( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2183,17 +2712,24 @@ async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2201,17 +2737,22 @@ async def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace_async - async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: Any) -> None: + async def put_complex_valid( + self, + array_body: List["_models.Product"], + **kwargs: Any + ) -> None: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2222,23 +2763,29 @@ async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[Product]") + _json = self._serialize.body(array_body, '[Product]') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2249,10 +2796,14 @@ async def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace_async - async def get_array_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get a null array. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2260,17 +2811,24 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2278,17 +2836,21 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore + get_array_null.metadata = {'url': '/array/array/null'} # type: ignore + @distributed_trace_async - async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an empty array []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2296,17 +2858,24 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2314,17 +2883,21 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/array/array/empty'} # type: ignore + @distributed_trace_async - async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2332,17 +2905,24 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2350,17 +2930,21 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/array/array/itemnull'} # type: ignore + @distributed_trace_async - async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2368,17 +2952,24 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2386,17 +2977,21 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/array/array/itemempty'} # type: ignore + @distributed_trace_async - async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: + async def get_array_valid( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2404,17 +2999,24 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2422,17 +3024,22 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace_async - async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: + async def put_array_valid( + self, + array_body: List[List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :param array_body: @@ -2442,23 +3049,29 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[[str]]") + _json = self._serialize.body(array_body, '[[str]]') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2469,10 +3082,14 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace_async - async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries with value null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2480,17 +3097,24 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2498,17 +3122,21 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/array/dictionary/null'} # type: ignore + @distributed_trace_async - async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2516,17 +3144,24 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2534,17 +3169,21 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/array/dictionary/empty'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2553,17 +3192,24 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2571,17 +3217,21 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/array/dictionary/itemnull'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2590,17 +3240,24 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2608,17 +3265,21 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/array/dictionary/itemempty'} # type: ignore + @distributed_trace_async - async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_valid( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2627,17 +3288,24 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2645,17 +3313,22 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + @distributed_trace_async - async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) -> None: + async def put_dictionary_valid( + self, + array_body: List[Dict[str, str]], + **kwargs: Any + ) -> None: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2666,23 +3339,29 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[{str}]") + _json = self._serialize.body(array_body, '[{str}]') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2693,4 +3372,5 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py index a4d2d993c02..7728241cd8f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py @@ -20,9 +20,9 @@ ) __all__ = [ - "Error", - "Product", - "Enum0", - "Enum1", - "FooEnum", + 'Error', + 'Product', + 'Enum0', + 'Enum1', + 'FooEnum', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py index 9ad0742e428..fb3ff53b36b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py @@ -17,14 +17,12 @@ class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO2 = "foo2" FOO3 = "foo3" - class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO1 = "foo1" FOO2 = "foo2" FOO3 = "foo3" - class FooEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FOO1 = "foo1" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models.py index a3dfbe1eb16..226a489fc2f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class Product(msrest.serialization.Model): @@ -46,11 +49,14 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword integer: :paramtype integer: int @@ -58,5 +64,5 @@ def __init__(self, **kwargs): :paramtype string: str """ super(Product, self).__init__(**kwargs) - self.integer = kwargs.get("integer", None) - self.string = kwargs.get("string", None) + self.integer = kwargs.get('integer', None) + self.string = kwargs.get('string', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py index b37adff2989..2a4ce7f081b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -48,11 +54,17 @@ class Product(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, *, integer: Optional[int] = None, string: Optional[str] = None, **kwargs): + def __init__( + self, + *, + integer: Optional[int] = None, + string: Optional[str] = None, + **kwargs + ): """ :keyword integer: :paramtype integer: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py index ee383541f8a..4a5b67ad59d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py @@ -12,5 +12,5 @@ from ._array_operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py index aa61b44444e..32520da25f5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1490,7 +1482,7 @@ def build_put_dictionary_valid_request( ) # fmt: on -class ArrayOperations(object): +class ArrayOperations(object): # pylint: disable=too-many-public-methods """ArrayOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -1514,7 +1506,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get null array value. @@ -1524,17 +1517,24 @@ def get_null( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1542,18 +1542,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/array/null"} # type: ignore + get_null.metadata = {'url': '/array/null'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get invalid array [1, 2, 3. @@ -1563,17 +1565,24 @@ def get_invalid( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1581,18 +1590,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore + get_invalid.metadata = {'url': '/array/invalid'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get empty array value []. @@ -1602,17 +1613,24 @@ def get_empty( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1620,14 +1638,15 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/array/empty"} # type: ignore + get_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace def put_empty( @@ -1645,23 +1664,29 @@ def put_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1672,11 +1697,13 @@ def put_empty( if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/array/empty"} # type: ignore + put_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace def get_boolean_tfft( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, false, false, true]. @@ -1686,17 +1713,24 @@ def get_boolean_tfft( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1704,14 +1738,15 @@ def get_boolean_tfft( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace def put_boolean_tfft( @@ -1729,23 +1764,29 @@ def put_boolean_tfft( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bool]") + _json = self._serialize.body(array_body, '[bool]') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1756,11 +1797,13 @@ def put_boolean_tfft( if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace def get_boolean_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, null, false]. @@ -1770,17 +1813,24 @@ def get_boolean_invalid_null( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1788,18 +1838,20 @@ def get_boolean_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/array/prim/boolean/true.null.false'} # type: ignore + @distributed_trace def get_boolean_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bool] """Get boolean array value [true, 'boolean', false]. @@ -1809,17 +1861,24 @@ def get_boolean_invalid_string( :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1827,18 +1886,20 @@ def get_boolean_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/array/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace def get_integer_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, -1, 3, 300]. @@ -1848,17 +1909,24 @@ def get_integer_valid( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1866,14 +1934,15 @@ def get_integer_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def put_integer_valid( @@ -1891,23 +1960,29 @@ def put_integer_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[int]") + _json = self._serialize.body(array_body, '[int]') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1918,11 +1993,13 @@ def put_integer_valid( if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def get_int_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, null, 0]. @@ -1932,17 +2009,24 @@ def get_int_invalid_null( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1950,18 +2034,20 @@ def get_int_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/array/prim/integer/1.null.zero'} # type: ignore + @distributed_trace def get_int_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, 'integer', 0]. @@ -1971,17 +2057,24 @@ def get_int_invalid_string( :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1989,18 +2082,20 @@ def get_int_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/array/prim/integer/1.integer.0'} # type: ignore + @distributed_trace def get_long_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get integer array value [1, -1, 3, 300]. @@ -2010,17 +2105,24 @@ def get_long_valid( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2028,14 +2130,15 @@ def get_long_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def put_long_valid( @@ -2053,23 +2156,29 @@ def put_long_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[long]") + _json = self._serialize.body(array_body, '[long]') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2080,11 +2189,13 @@ def put_long_valid( if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def get_long_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get long array value [1, null, 0]. @@ -2094,17 +2205,24 @@ def get_long_invalid_null( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2112,18 +2230,20 @@ def get_long_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/array/prim/long/1.null.zero'} # type: ignore + @distributed_trace def get_long_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[int] """Get long array value [1, 'integer', 0]. @@ -2133,17 +2253,24 @@ def get_long_invalid_string( :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2151,18 +2278,20 @@ def get_long_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/array/prim/long/1.integer.0'} # type: ignore + @distributed_trace def get_float_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0, -0.01, 1.2e20]. @@ -2172,17 +2301,24 @@ def get_float_valid( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2190,14 +2326,15 @@ def get_float_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_float_valid( @@ -2215,23 +2352,29 @@ def put_float_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2242,11 +2385,13 @@ def put_float_valid( if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0.0, null, -1.2e20]. @@ -2256,17 +2401,24 @@ def get_float_invalid_null( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2274,18 +2426,20 @@ def get_float_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/array/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get boolean array value [1.0, 'number', 0.0]. @@ -2295,17 +2449,24 @@ def get_float_invalid_string( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2313,18 +2474,20 @@ def get_float_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/array/prim/float/1.number.0'} # type: ignore + @distributed_trace def get_double_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0, -0.01, 1.2e20]. @@ -2334,17 +2497,24 @@ def get_double_valid( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2352,14 +2522,15 @@ def get_double_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_double_valid( @@ -2377,23 +2548,29 @@ def put_double_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2404,11 +2581,13 @@ def put_double_valid( if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get float array value [0.0, null, -1.2e20]. @@ -2418,17 +2597,24 @@ def get_double_invalid_null( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2436,18 +2622,20 @@ def get_double_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/array/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[float] """Get boolean array value [1.0, 'number', 0.0]. @@ -2457,17 +2645,24 @@ def get_double_invalid_string( :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2475,18 +2670,20 @@ def get_double_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/array/prim/double/1.number.0'} # type: ignore + @distributed_trace def get_string_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo1', 'foo2', 'foo3']. @@ -2496,17 +2693,24 @@ def get_string_valid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2514,14 +2718,15 @@ def get_string_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_string_valid( @@ -2539,23 +2744,29 @@ def put_string_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2566,11 +2777,13 @@ def put_string_valid( if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_enum_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Union[str, "_models.FooEnum"]] """Get enum array value ['foo1', 'foo2', 'foo3']. @@ -2580,17 +2793,24 @@ def get_enum_valid( :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], + template_url=self.get_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2598,14 +2818,15 @@ def get_enum_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + get_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_enum_valid( @@ -2623,23 +2844,29 @@ def put_enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_enum_valid.metadata["url"], + template_url=self.put_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2650,11 +2877,13 @@ def put_enum_valid( if cls: return cls(pipeline_response, None, {}) - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + put_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_string_enum_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Union[str, "_models.Enum0"]] """Get enum array value ['foo1', 'foo2', 'foo3']. @@ -2664,17 +2893,24 @@ def get_string_enum_valid( :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum0] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.Enum0"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], + template_url=self.get_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2682,14 +2918,15 @@ def get_string_enum_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + get_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_string_enum_valid( @@ -2707,23 +2944,29 @@ def put_string_enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_enum_valid.metadata["url"], + template_url=self.put_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2734,11 +2977,13 @@ def put_string_enum_valid( if cls: return cls(pipeline_response, None, {}) - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + put_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_string_with_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo', null, 'foo2']. @@ -2748,17 +2993,24 @@ def get_string_with_null( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2766,18 +3018,20 @@ def get_string_with_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/array/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace def get_string_with_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get string array value ['foo', 123, 'foo2']. @@ -2787,17 +3041,24 @@ def get_string_with_invalid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2805,18 +3066,20 @@ def get_string_with_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/array/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace def get_uuid_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', @@ -2827,17 +3090,24 @@ def get_uuid_valid( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], + template_url=self.get_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2845,14 +3115,15 @@ def get_uuid_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + get_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace def put_uuid_valid( @@ -2871,23 +3142,29 @@ def put_uuid_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_uuid_valid_request( content_type=content_type, json=_json, - template_url=self.put_uuid_valid.metadata["url"], + template_url=self.put_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2898,11 +3175,13 @@ def put_uuid_valid( if cls: return cls(pipeline_response, None, {}) - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + put_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace def get_uuid_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[str] """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. @@ -2912,17 +3191,24 @@ def get_uuid_invalid_chars( :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], + template_url=self.get_uuid_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2930,18 +3216,20 @@ def get_uuid_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore + get_uuid_invalid_chars.metadata = {'url': '/array/prim/uuid/invalidchars'} # type: ignore + @distributed_trace def get_date_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. @@ -2951,17 +3239,24 @@ def get_date_valid( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2969,14 +3264,15 @@ def get_date_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace def put_date_valid( @@ -2994,23 +3290,29 @@ def put_date_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[date]") + _json = self._serialize.body(array_body, '[date]') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3021,11 +3323,13 @@ def put_date_valid( if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace def get_date_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get date array value ['2012-01-01', null, '1776-07-04']. @@ -3035,17 +3339,24 @@ def get_date_invalid_null( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3053,18 +3364,20 @@ def get_date_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/array/prim/date/invalidnull'} # type: ignore + @distributed_trace def get_date_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.date] """Get date array value ['2011-03-22', 'date']. @@ -3074,17 +3387,24 @@ def get_date_invalid_chars( :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3092,18 +3412,20 @@ def get_date_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/array/prim/date/invalidchars'} # type: ignore + @distributed_trace def get_date_time_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', @@ -3114,17 +3436,24 @@ def get_date_time_valid( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3132,14 +3461,15 @@ def get_date_time_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace def put_date_time_valid( @@ -3158,23 +3488,29 @@ def put_date_time_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[iso-8601]") + _json = self._serialize.body(array_body, '[iso-8601]') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3185,11 +3521,13 @@ def put_date_time_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace def get_date_time_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date array value ['2000-12-01t00:00:01z', null]. @@ -3199,17 +3537,24 @@ def get_date_time_invalid_null( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3217,18 +3562,20 @@ def get_date_time_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/array/prim/date-time/invalidnull'} # type: ignore + @distributed_trace def get_date_time_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date array value ['2000-12-01t00:00:01z', 'date-time']. @@ -3238,17 +3585,24 @@ def get_date_time_invalid_chars( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3256,18 +3610,20 @@ def get_date_time_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/array/prim/date-time/invalidchars'} # type: ignore + @distributed_trace def get_date_time_rfc1123_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.datetime] """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', @@ -3278,17 +3634,24 @@ def get_date_time_rfc1123_valid( :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3296,14 +3659,15 @@ def get_date_time_rfc1123_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) + deserialized = self._deserialize('[rfc-1123]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def put_date_time_rfc1123_valid( @@ -3322,23 +3686,29 @@ def put_date_time_rfc1123_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[rfc-1123]") + _json = self._serialize.body(array_body, '[rfc-1123]') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3349,11 +3719,13 @@ def put_date_time_rfc1123_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def get_duration_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[datetime.timedelta] """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. @@ -3363,17 +3735,24 @@ def get_duration_valid( :rtype: list[~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3381,14 +3760,15 @@ def get_duration_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) + deserialized = self._deserialize('[duration]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace def put_duration_valid( @@ -3406,23 +3786,29 @@ def put_duration_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[duration]") + _json = self._serialize.body(array_body, '[duration]') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3433,11 +3819,13 @@ def put_duration_valid( if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace def get_byte_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytearray] """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded @@ -3448,17 +3836,24 @@ def get_byte_valid( :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3466,14 +3861,15 @@ def get_byte_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace def put_byte_valid( @@ -3492,23 +3888,29 @@ def put_byte_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bytearray]") + _json = self._serialize.body(array_body, '[bytearray]') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3519,11 +3921,13 @@ def put_byte_valid( if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace def get_byte_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytearray] """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. @@ -3533,17 +3937,24 @@ def get_byte_invalid_null( :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3551,18 +3962,20 @@ def get_byte_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/array/prim/byte/invalidnull'} # type: ignore + @distributed_trace def get_base64_url( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[bytes] """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with @@ -3573,17 +3986,24 @@ def get_base64_url( :rtype: list[bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3591,18 +4011,20 @@ def get_base64_url( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) + deserialized = self._deserialize('[base64]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/array/prim/base64url/valid'} # type: ignore + @distributed_trace def get_complex_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type null value. @@ -3612,17 +4034,24 @@ def get_complex_null( :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3630,18 +4059,20 @@ def get_complex_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/array/complex/null'} # type: ignore + @distributed_trace def get_complex_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get empty array of complex type []. @@ -3651,17 +4082,24 @@ def get_complex_empty( :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3669,18 +4107,20 @@ def get_complex_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/array/complex/empty'} # type: ignore + @distributed_trace def get_complex_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, @@ -3691,17 +4131,24 @@ def get_complex_item_null( :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3709,18 +4156,20 @@ def get_complex_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/array/complex/itemnull'} # type: ignore + @distributed_trace def get_complex_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, @@ -3731,17 +4180,24 @@ def get_complex_item_empty( :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3749,18 +4205,20 @@ def get_complex_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/array/complex/itemempty'} # type: ignore + @distributed_trace def get_complex_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Product"] """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, @@ -3771,17 +4229,24 @@ def get_complex_valid( :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3789,14 +4254,15 @@ def get_complex_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace def put_complex_valid( @@ -3815,23 +4281,29 @@ def put_complex_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[Product]") + _json = self._serialize.body(array_body, '[Product]') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3842,11 +4314,13 @@ def put_complex_valid( if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace def get_array_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get a null array. @@ -3856,17 +4330,24 @@ def get_array_null( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3874,18 +4355,20 @@ def get_array_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore + get_array_null.metadata = {'url': '/array/array/null'} # type: ignore + @distributed_trace def get_array_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an empty array []. @@ -3895,17 +4378,24 @@ def get_array_empty( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3913,18 +4403,20 @@ def get_array_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/array/array/empty'} # type: ignore + @distributed_trace def get_array_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. @@ -3934,17 +4426,24 @@ def get_array_item_null( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3952,18 +4451,20 @@ def get_array_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/array/array/itemnull'} # type: ignore + @distributed_trace def get_array_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. @@ -3973,17 +4474,24 @@ def get_array_item_empty( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3991,18 +4499,20 @@ def get_array_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/array/array/itemempty'} # type: ignore + @distributed_trace def get_array_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[List[str]] """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. @@ -4012,17 +4522,24 @@ def get_array_valid( :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4030,14 +4547,15 @@ def get_array_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace def put_array_valid( @@ -4055,23 +4573,29 @@ def put_array_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[[str]]") + _json = self._serialize.body(array_body, '[[str]]') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4082,11 +4606,13 @@ def put_array_valid( if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace def get_dictionary_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries with value null. @@ -4096,17 +4622,24 @@ def get_dictionary_null( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4114,18 +4647,20 @@ def get_dictionary_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/array/dictionary/null'} # type: ignore + @distributed_trace def get_dictionary_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value []. @@ -4135,17 +4670,24 @@ def get_dictionary_empty( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4153,18 +4695,20 @@ def get_dictionary_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/array/dictionary/empty'} # type: ignore + @distributed_trace def get_dictionary_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4175,17 +4719,24 @@ def get_dictionary_item_null( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4193,18 +4744,20 @@ def get_dictionary_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/array/dictionary/itemnull'} # type: ignore + @distributed_trace def get_dictionary_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4215,17 +4768,24 @@ def get_dictionary_item_empty( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4233,18 +4793,20 @@ def get_dictionary_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/array/dictionary/itemempty'} # type: ignore + @distributed_trace def get_dictionary_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List[Dict[str, str]] """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': @@ -4255,17 +4817,24 @@ def get_dictionary_valid( :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4273,14 +4842,15 @@ def get_dictionary_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + @distributed_trace def put_dictionary_valid( @@ -4299,23 +4869,29 @@ def put_dictionary_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[{str}]") + _json = self._serialize.body(array_body, '[{str}]') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4326,4 +4902,5 @@ def put_dictionary_valid( if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py index 0c110b6c1e3..6a3b4c4db51 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -25,918 +18,1486 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/null") + url = kwargs.pop("template_url", '/array/null') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/invalid") + url = kwargs.pop("template_url", '/array/invalid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/empty") + url = kwargs.pop("template_url", '/array/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/empty") + url = kwargs.pop("template_url", '/array/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_tfft_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/boolean/tfft") + url = kwargs.pop("template_url", '/array/prim/boolean/tfft') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_boolean_tfft_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/boolean/tfft") + url = kwargs.pop("template_url", '/array/prim/boolean/tfft') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/boolean/true.null.false") + url = kwargs.pop("template_url", '/array/prim/boolean/true.null.false') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/boolean/true.boolean.false") + url = kwargs.pop("template_url", '/array/prim/boolean/true.boolean.false') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_integer_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/integer/1.-1.3.300") + url = kwargs.pop("template_url", '/array/prim/integer/1.-1.3.300') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_integer_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_integer_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/integer/1.-1.3.300") + url = kwargs.pop("template_url", '/array/prim/integer/1.-1.3.300') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_int_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/integer/1.null.zero") + url = kwargs.pop("template_url", '/array/prim/integer/1.null.zero') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_int_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/integer/1.integer.0") + url = kwargs.pop("template_url", '/array/prim/integer/1.integer.0') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_long_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/long/1.-1.3.300") + url = kwargs.pop("template_url", '/array/prim/long/1.-1.3.300') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_long_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/long/1.-1.3.300") + url = kwargs.pop("template_url", '/array/prim/long/1.-1.3.300') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_long_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/long/1.null.zero") + url = kwargs.pop("template_url", '/array/prim/long/1.null.zero') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_long_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/long/1.integer.0") + url = kwargs.pop("template_url", '/array/prim/long/1.integer.0') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_float_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/float/0--0.01-1.2e20") + url = kwargs.pop("template_url", '/array/prim/float/0--0.01-1.2e20') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_float_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/float/0--0.01-1.2e20") + url = kwargs.pop("template_url", '/array/prim/float/0--0.01-1.2e20') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_float_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/float/0.0-null-1.2e20") + url = kwargs.pop("template_url", '/array/prim/float/0.0-null-1.2e20') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_float_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/float/1.number.0") + url = kwargs.pop("template_url", '/array/prim/float/1.number.0') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_double_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/double/0--0.01-1.2e20") + url = kwargs.pop("template_url", '/array/prim/double/0--0.01-1.2e20') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_double_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_double_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/double/0--0.01-1.2e20") + url = kwargs.pop("template_url", '/array/prim/double/0--0.01-1.2e20') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_double_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/double/0.0-null-1.2e20") + url = kwargs.pop("template_url", '/array/prim/double/0.0-null-1.2e20') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_double_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/double/1.number.0") + url = kwargs.pop("template_url", '/array/prim/double/1.number.0') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/string/foo1.foo2.foo3") + url = kwargs.pop("template_url", '/array/prim/string/foo1.foo2.foo3') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_string_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_string_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/string/foo1.foo2.foo3") + url = kwargs.pop("template_url", '/array/prim/string/foo1.foo2.foo3') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_enum_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/enum/foo1.foo2.foo3") + url = kwargs.pop("template_url", '/array/prim/enum/foo1.foo2.foo3') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_enum_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/enum/foo1.foo2.foo3") + url = kwargs.pop("template_url", '/array/prim/enum/foo1.foo2.foo3') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_enum_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/string-enum/foo1.foo2.foo3") + url = kwargs.pop("template_url", '/array/prim/string-enum/foo1.foo2.foo3') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_string_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_string_enum_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/string-enum/foo1.foo2.foo3") + url = kwargs.pop("template_url", '/array/prim/string-enum/foo1.foo2.foo3') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: +def build_get_string_with_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/string/foo.null.foo2") + url = kwargs.pop("template_url", '/array/prim/string/foo.null.foo2') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_with_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/string/foo.123.foo2") + url = kwargs.pop("template_url", '/array/prim/string/foo.123.foo2') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_uuid_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/uuid/valid") + url = kwargs.pop("template_url", '/array/prim/uuid/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_uuid_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_uuid_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/uuid/valid") + url = kwargs.pop("template_url", '/array/prim/uuid/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_uuid_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_uuid_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/uuid/invalidchars") + url = kwargs.pop("template_url", '/array/prim/uuid/invalidchars') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date/valid") + url = kwargs.pop("template_url", '/array/prim/date/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_date_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date/valid") + url = kwargs.pop("template_url", '/array/prim/date/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_date_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date/invalidnull") + url = kwargs.pop("template_url", '/array/prim/date/invalidnull') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_date_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date/invalidchars") + url = kwargs.pop("template_url", '/array/prim/date/invalidchars') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date-time/valid") + url = kwargs.pop("template_url", '/array/prim/date-time/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_date_time_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date-time/valid") + url = kwargs.pop("template_url", '/array/prim/date-time/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date-time/invalidnull") + url = kwargs.pop("template_url", '/array/prim/date-time/invalidnull') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date-time/invalidchars") + url = kwargs.pop("template_url", '/array/prim/date-time/invalidchars') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_rfc1123_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date-time-rfc1123/valid") + url = kwargs.pop("template_url", '/array/prim/date-time-rfc1123/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_put_date_time_rfc1123_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/date-time-rfc1123/valid") + url = kwargs.pop("template_url", '/array/prim/date-time-rfc1123/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_duration_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/duration/valid") + url = kwargs.pop("template_url", '/array/prim/duration/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_duration_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_duration_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/duration/valid") + url = kwargs.pop("template_url", '/array/prim/duration/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_byte_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/byte/valid") + url = kwargs.pop("template_url", '/array/prim/byte/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_byte_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/byte/valid") + url = kwargs.pop("template_url", '/array/prim/byte/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_byte_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/byte/invalidnull") + url = kwargs.pop("template_url", '/array/prim/byte/invalidnull') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: +def build_get_base64_url_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/prim/base64url/valid") + url = kwargs.pop("template_url", '/array/prim/base64url/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/complex/null") + url = kwargs.pop("template_url", '/array/complex/null') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/complex/empty") + url = kwargs.pop("template_url", '/array/complex/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/complex/itemnull") + url = kwargs.pop("template_url", '/array/complex/itemnull') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/complex/itemempty") + url = kwargs.pop("template_url", '/array/complex/itemempty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/complex/valid") + url = kwargs.pop("template_url", '/array/complex/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_complex_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_complex_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/complex/valid") + url = kwargs.pop("template_url", '/array/complex/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_array_null_request(**kwargs: Any) -> HttpRequest: +def build_get_array_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/array/null") + url = kwargs.pop("template_url", '/array/array/null') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_array_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/array/empty") + url = kwargs.pop("template_url", '/array/array/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_array_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/array/itemnull") + url = kwargs.pop("template_url", '/array/array/itemnull') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_array_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/array/itemempty") + url = kwargs.pop("template_url", '/array/array/itemempty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_array_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/array/valid") + url = kwargs.pop("template_url", '/array/array/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_array_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/array/valid") + url = kwargs.pop("template_url", '/array/array/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/dictionary/null") + url = kwargs.pop("template_url", '/array/dictionary/null') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/dictionary/empty") + url = kwargs.pop("template_url", '/array/dictionary/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/dictionary/itemnull") + url = kwargs.pop("template_url", '/array/dictionary/itemnull') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/dictionary/itemempty") + url = kwargs.pop("template_url", '/array/dictionary/itemempty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/dictionary/valid") + url = kwargs.pop("template_url", '/array/dictionary/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_dictionary_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/array/dictionary/valid") + url = kwargs.pop("template_url", '/array/dictionary/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -class ArrayOperations(object): + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class ArrayOperations(object): # pylint: disable=too-many-public-methods """ArrayOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -959,7 +1520,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> List[int]: + def get_null( + self, + **kwargs: Any + ) -> List[int]: """Get null array value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -967,17 +1531,24 @@ def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -985,17 +1556,21 @@ def get_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/array/null"} # type: ignore + get_null.metadata = {'url': '/array/null'} # type: ignore + @distributed_trace - def get_invalid(self, **kwargs: Any) -> List[int]: + def get_invalid( + self, + **kwargs: Any + ) -> List[int]: """Get invalid array [1, 2, 3. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1003,17 +1578,24 @@ def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1021,17 +1603,21 @@ def get_invalid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore + get_invalid.metadata = {'url': '/array/invalid'} # type: ignore + @distributed_trace - def get_empty(self, **kwargs: Any) -> List[int]: + def get_empty( + self, + **kwargs: Any + ) -> List[int]: """Get empty array value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1039,17 +1625,24 @@ def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1057,17 +1650,22 @@ def get_empty(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/array/empty"} # type: ignore + get_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace - def put_empty(self, array_body: List[str], **kwargs: Any) -> None: + def put_empty( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value empty []. :param array_body: @@ -1077,23 +1675,29 @@ def put_empty(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1104,10 +1708,14 @@ def put_empty(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/array/empty"} # type: ignore + put_empty.metadata = {'url': '/array/empty'} # type: ignore + @distributed_trace - def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: + def get_boolean_tfft( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, false, false, true]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1115,17 +1723,24 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1133,17 +1748,22 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace - def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: + def put_boolean_tfft( + self, + array_body: List[bool], + **kwargs: Any + ) -> None: """Set array value empty [true, false, false, true]. :param array_body: @@ -1153,23 +1773,29 @@ def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bool]") + _json = self._serialize.body(array_body, '[bool]') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1180,10 +1806,14 @@ def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/array/prim/boolean/tfft'} # type: ignore + @distributed_trace - def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: + def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, null, false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1191,17 +1821,24 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1209,17 +1846,21 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/array/prim/boolean/true.null.false'} # type: ignore + @distributed_trace - def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: + def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, 'boolean', false]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1227,17 +1868,24 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1245,17 +1893,21 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) + deserialized = self._deserialize('[bool]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/array/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace - def get_integer_valid(self, **kwargs: Any) -> List[int]: + def get_integer_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1263,17 +1915,24 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1281,17 +1940,22 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace - def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: + def put_integer_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -1301,23 +1965,29 @@ def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[int]") + _json = self._serialize.body(array_body, '[int]') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1328,10 +1998,14 @@ def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/array/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace - def get_int_invalid_null(self, **kwargs: Any) -> List[int]: + def get_int_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1339,17 +2013,24 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1357,17 +2038,21 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/array/prim/integer/1.null.zero'} # type: ignore + @distributed_trace - def get_int_invalid_string(self, **kwargs: Any) -> List[int]: + def get_int_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1375,17 +2060,24 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1393,17 +2085,21 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) + deserialized = self._deserialize('[int]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/array/prim/integer/1.integer.0'} # type: ignore + @distributed_trace - def get_long_valid(self, **kwargs: Any) -> List[int]: + def get_long_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1411,17 +2107,24 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1429,17 +2132,22 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace - def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: + def put_long_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -1449,23 +2157,29 @@ def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[long]") + _json = self._serialize.body(array_body, '[long]') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1476,10 +2190,14 @@ def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/array/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace - def get_long_invalid_null(self, **kwargs: Any) -> List[int]: + def get_long_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, null, 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1487,17 +2205,24 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1505,17 +2230,21 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/array/prim/long/1.null.zero'} # type: ignore + @distributed_trace - def get_long_invalid_string(self, **kwargs: Any) -> List[int]: + def get_long_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, 'integer', 0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1523,17 +2252,24 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1541,17 +2277,21 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[long]", pipeline_response) + deserialized = self._deserialize('[long]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/array/prim/long/1.integer.0'} # type: ignore + @distributed_trace - def get_float_valid(self, **kwargs: Any) -> List[float]: + def get_float_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1559,17 +2299,24 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1577,17 +2324,22 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace - def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: + def put_float_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -1597,23 +2349,29 @@ def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1624,10 +2382,14 @@ def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/array/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace - def get_float_invalid_null(self, **kwargs: Any) -> List[float]: + def get_float_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1635,17 +2397,24 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1653,17 +2422,21 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/array/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace - def get_float_invalid_string(self, **kwargs: Any) -> List[float]: + def get_float_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1671,17 +2444,24 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1689,17 +2469,21 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/array/prim/float/1.number.0'} # type: ignore + @distributed_trace - def get_double_valid(self, **kwargs: Any) -> List[float]: + def get_double_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1707,17 +2491,24 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1725,17 +2516,22 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace - def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: + def put_double_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -1745,23 +2541,29 @@ def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[float]") + _json = self._serialize.body(array_body, '[float]') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1772,10 +2574,14 @@ def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/array/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace - def get_double_invalid_null(self, **kwargs: Any) -> List[float]: + def get_double_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1783,17 +2589,24 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1801,17 +2614,21 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/array/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace - def get_double_invalid_string(self, **kwargs: Any) -> List[float]: + def get_double_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1819,17 +2636,24 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1837,17 +2661,21 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) + deserialized = self._deserialize('[float]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/array/prim/double/1.number.0'} # type: ignore + @distributed_trace - def get_string_valid(self, **kwargs: Any) -> List[str]: + def get_string_valid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1855,17 +2683,24 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1873,17 +2708,22 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace - def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: + def put_string_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1893,23 +2733,29 @@ def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1920,10 +2766,14 @@ def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/array/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace - def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: + def get_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.FooEnum"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1931,17 +2781,24 @@ def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], + template_url=self.get_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1949,17 +2806,22 @@ def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + get_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace - def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], **kwargs: Any) -> None: + def put_enum_valid( + self, + array_body: List[Union[str, "_models.FooEnum"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1969,23 +2831,29 @@ def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], **kwar :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_enum_valid.metadata["url"], + template_url=self.put_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1996,10 +2864,14 @@ def put_enum_valid(self, array_body: List[Union[str, "_models.FooEnum"]], **kwar if cls: return cls(pipeline_response, None, {}) - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore + put_enum_valid.metadata = {'url': '/array/prim/enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace - def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0"]]: + def get_string_enum_valid( + self, + **kwargs: Any + ) -> List[Union[str, "_models.Enum0"]]: """Get enum array value ['foo1', 'foo2', 'foo3']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2007,17 +2879,24 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0 :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum0] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Union[str, "_models.Enum0"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], + template_url=self.get_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2025,17 +2904,22 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0 error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + get_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace - def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1"]], **kwargs: Any) -> None: + def put_string_enum_valid( + self, + array_body: List[Union[str, "_models.Enum1"]], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -2045,23 +2929,29 @@ def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1"]], * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_string_enum_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_enum_valid.metadata["url"], + template_url=self.put_string_enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2072,10 +2962,14 @@ def put_string_enum_valid(self, array_body: List[Union[str, "_models.Enum1"]], * if cls: return cls(pipeline_response, None, {}) - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore + put_string_enum_valid.metadata = {'url': '/array/prim/string-enum/foo1.foo2.foo3'} # type: ignore + @distributed_trace - def get_string_with_null(self, **kwargs: Any) -> List[str]: + def get_string_with_null( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', null, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2083,17 +2977,24 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2101,17 +3002,21 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/array/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace - def get_string_with_invalid(self, **kwargs: Any) -> List[str]: + def get_string_with_invalid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', 123, 'foo2']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2119,17 +3024,24 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2137,17 +3049,21 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/array/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace - def get_uuid_valid(self, **kwargs: Any) -> List[str]: + def get_uuid_valid( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -2156,17 +3072,24 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], + template_url=self.get_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2174,17 +3097,22 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + get_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace - def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: + def put_uuid_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -2195,23 +3123,29 @@ def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[str]") + _json = self._serialize.body(array_body, '[str]') request = build_put_uuid_valid_request( content_type=content_type, json=_json, - template_url=self.put_uuid_valid.metadata["url"], + template_url=self.put_uuid_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2222,10 +3156,14 @@ def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore + put_uuid_valid.metadata = {'url': '/array/prim/uuid/valid'} # type: ignore + @distributed_trace - def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: + def get_uuid_invalid_chars( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2233,17 +3171,24 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], + template_url=self.get_uuid_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2251,17 +3196,21 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore + get_uuid_invalid_chars.metadata = {'url': '/array/prim/uuid/invalidchars'} # type: ignore + @distributed_trace - def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: + def get_date_valid( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2269,17 +3218,24 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2287,17 +3243,22 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace - def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None: + def put_date_valid( + self, + array_body: List[datetime.date], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. :param array_body: @@ -2307,23 +3268,29 @@ def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[date]") + _json = self._serialize.body(array_body, '[date]') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2334,10 +3301,14 @@ def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/array/prim/date/valid'} # type: ignore + @distributed_trace - def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: + def get_date_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2012-01-01', null, '1776-07-04']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2345,17 +3316,24 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2363,17 +3341,21 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/array/prim/date/invalidnull'} # type: ignore + @distributed_trace - def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: + def get_date_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2011-03-22', 'date']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2381,17 +3363,24 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2399,17 +3388,21 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) + deserialized = self._deserialize('[date]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/array/prim/date/invalidchars'} # type: ignore + @distributed_trace - def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -2418,17 +3411,24 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2436,17 +3436,22 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace - def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + def put_date_time_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -2457,23 +3462,29 @@ def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[iso-8601]") + _json = self._serialize.body(array_body, '[iso-8601]') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2484,10 +3495,14 @@ def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/array/prim/date-time/valid'} # type: ignore + @distributed_trace - def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', null]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2495,17 +3510,24 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2513,17 +3535,21 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/array/prim/date-time/invalidnull'} # type: ignore + @distributed_trace - def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2531,17 +3557,24 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2549,17 +3582,21 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) + deserialized = self._deserialize('[iso-8601]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/array/prim/date-time/invalidchars'} # type: ignore + @distributed_trace - def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2568,17 +3605,24 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2586,17 +3630,22 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) + deserialized = self._deserialize('[rfc-1123]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace - def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + def put_date_time_rfc1123_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2607,23 +3656,29 @@ def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[rfc-1123]") + _json = self._serialize.body(array_body, '[rfc-1123]') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2634,10 +3689,14 @@ def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwa if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/array/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace - def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: + def get_duration_valid( + self, + **kwargs: Any + ) -> List[datetime.timedelta]: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2645,17 +3704,24 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2663,17 +3729,22 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) + deserialized = self._deserialize('[duration]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace - def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any) -> None: + def put_duration_valid( + self, + array_body: List[datetime.timedelta], + **kwargs: Any + ) -> None: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :param array_body: @@ -2683,23 +3754,29 @@ def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[duration]") + _json = self._serialize.body(array_body, '[duration]') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2710,10 +3787,14 @@ def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/array/prim/duration/valid'} # type: ignore + @distributed_trace - def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: + def get_byte_valid( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -2722,17 +3803,24 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2740,17 +3828,22 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace - def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: + def put_byte_valid( + self, + array_body: List[bytearray], + **kwargs: Any + ) -> None: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -2761,23 +3854,29 @@ def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[bytearray]") + _json = self._serialize.body(array_body, '[bytearray]') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2788,10 +3887,14 @@ def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/array/prim/byte/valid'} # type: ignore + @distributed_trace - def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: + def get_byte_invalid_null( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2799,17 +3902,24 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: :rtype: list[bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2817,17 +3927,21 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) + deserialized = self._deserialize('[bytearray]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/array/prim/byte/invalidnull'} # type: ignore + @distributed_trace - def get_base64_url(self, **kwargs: Any) -> List[bytes]: + def get_base64_url( + self, + **kwargs: Any + ) -> List[bytes]: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -2836,17 +3950,24 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2854,17 +3975,21 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) + deserialized = self._deserialize('[base64]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/array/prim/base64url/valid'} # type: ignore + @distributed_trace - def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: + def get_complex_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type null value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2872,17 +3997,24 @@ def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2890,17 +4022,21 @@ def get_complex_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/array/complex/null'} # type: ignore + @distributed_trace - def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: + def get_complex_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get empty array of complex type []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2908,17 +4044,24 @@ def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2926,17 +4069,21 @@ def get_complex_empty(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/array/complex/empty'} # type: ignore + @distributed_trace - def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: + def get_complex_item_null( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -2945,17 +4092,24 @@ def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2963,17 +4117,21 @@ def get_complex_item_null(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/array/complex/itemnull'} # type: ignore + @distributed_trace - def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"]: + def get_complex_item_empty( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -2982,17 +4140,24 @@ def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3000,17 +4165,21 @@ def get_complex_item_empty(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/array/complex/itemempty'} # type: ignore + @distributed_trace - def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: + def get_complex_valid( + self, + **kwargs: Any + ) -> List["_models.Product"]: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -3019,17 +4188,24 @@ def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Product"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Product"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3037,17 +4213,22 @@ def get_complex_valid(self, **kwargs: Any) -> List["_models.Product"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) + deserialized = self._deserialize('[Product]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace - def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: Any) -> None: + def put_complex_valid( + self, + array_body: List["_models.Product"], + **kwargs: Any + ) -> None: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -3058,23 +4239,29 @@ def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[Product]") + _json = self._serialize.body(array_body, '[Product]') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3085,10 +4272,14 @@ def put_complex_valid(self, array_body: List["_models.Product"], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/array/complex/valid'} # type: ignore + @distributed_trace - def get_array_null(self, **kwargs: Any) -> List[List[str]]: + def get_array_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get a null array. :keyword callable cls: A custom type or function that will be passed the direct response @@ -3096,17 +4287,24 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3114,17 +4312,21 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore + get_array_null.metadata = {'url': '/array/array/null'} # type: ignore + @distributed_trace - def get_array_empty(self, **kwargs: Any) -> List[List[str]]: + def get_array_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an empty array []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -3132,17 +4334,24 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3150,17 +4359,21 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/array/array/empty'} # type: ignore + @distributed_trace - def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: + def get_array_item_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -3168,17 +4381,24 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3186,17 +4406,21 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/array/array/itemnull'} # type: ignore + @distributed_trace - def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: + def get_array_item_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -3204,17 +4428,24 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3222,17 +4453,21 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/array/array/itemempty'} # type: ignore + @distributed_trace - def get_array_valid(self, **kwargs: Any) -> List[List[str]]: + def get_array_valid( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :keyword callable cls: A custom type or function that will be passed the direct response @@ -3240,17 +4475,24 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3258,17 +4500,22 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) + deserialized = self._deserialize('[[str]]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace - def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: + def put_array_valid( + self, + array_body: List[List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :param array_body: @@ -3278,23 +4525,29 @@ def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[[str]]") + _json = self._serialize.body(array_body, '[[str]]') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3305,10 +4558,14 @@ def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/array/array/valid'} # type: ignore + @distributed_trace - def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries with value null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -3316,17 +4573,24 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3334,17 +4598,21 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/array/dictionary/null'} # type: ignore + @distributed_trace - def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value []. :keyword callable cls: A custom type or function that will be passed the direct response @@ -3352,17 +4620,24 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3370,17 +4645,21 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/array/dictionary/empty'} # type: ignore + @distributed_trace - def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_item_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3389,17 +4668,24 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3407,17 +4693,21 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/array/dictionary/itemnull'} # type: ignore + @distributed_trace - def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3426,17 +4716,24 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3444,17 +4741,21 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/array/dictionary/itemempty'} # type: ignore + @distributed_trace - def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_valid( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3463,17 +4764,24 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3481,17 +4789,22 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) + deserialized = self._deserialize('[{str}]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + @distributed_trace - def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) -> None: + def put_dictionary_valid( + self, + array_body: List[Dict[str, str]], + **kwargs: Any + ) -> None: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3502,23 +4815,29 @@ def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "[{str}]") + _json = self._serialize.body(array_body, '[{str}]') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3529,4 +4848,5 @@ def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/array/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py index 877b4dde4a8..f570de0377a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/__init__.py index 04867b878c9..7d6d9918496 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["BinaryWithContentTypeApplicationJson"] +__all__ = ['BinaryWithContentTypeApplicationJson'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binarywithcontent_typeapplicationjson.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binarywithcontent_typeapplicationjson.py index 1362d322729..0f455e4ccb4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binarywithcontent_typeapplicationjson.py @@ -17,11 +17,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.rest import HttpRequest, HttpResponse - class BinaryWithContentTypeApplicationJson(object): """Sample for file with json and binary content type. @@ -46,6 +45,7 @@ def __init__( self._serialize.client_side_validation = False self.upload = UploadOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_configuration.py index 3b5ed5d76fd..55ed658bfa6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): +class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BinaryWithContentTypeApplicationJson. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(BinaryWithContentTypeApplicationJsonConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "binarywithcontenttypeapplicationjson/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'binarywithcontenttypeapplicationjson/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/__init__.py index a1aa9464094..a5fff7df533 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._binarywithcontent_typeapplicationjson import BinaryWithContentTypeApplicationJson - -__all__ = ["BinaryWithContentTypeApplicationJson"] +__all__ = ['BinaryWithContentTypeApplicationJson'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binarywithcontent_typeapplicationjson.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binarywithcontent_typeapplicationjson.py index 4cf15a45c15..8c3761e38ef 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binarywithcontent_typeapplicationjson.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BinaryWithContentTypeApplicationJson: """Sample for file with json and binary content type. @@ -30,7 +29,11 @@ class BinaryWithContentTypeApplicationJson: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = BinaryWithContentTypeApplicationJsonConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -40,7 +43,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.upload = UploadOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_configuration.py index 88da831735e..de97b10fb47 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): +class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BinaryWithContentTypeApplicationJson. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BinaryWithContentTypeApplicationJsonConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "binarywithcontenttypeapplicationjson/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'binarywithcontenttypeapplicationjson/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/__init__.py index 4d8dc9efe65..cf5ac63ac59 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._upload_operations import UploadOperations __all__ = [ - "UploadOperations", + 'UploadOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py index 79524b94191..44dfd14566d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, IO, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,11 +16,9 @@ from ..._vendor import _convert_request from ...operations._upload_operations import build_binary_request, build_file_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class UploadOperations: """UploadOperations async operations. @@ -47,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def file(self, file_param: IO, **kwargs: Any) -> None: + async def file( + self, + file_param: IO, + **kwargs: Any + ) -> None: """Uploading json file. :param file_param: JSON file with payload { "more": "cowbell" }. @@ -57,23 +52,29 @@ async def file(self, file_param: IO, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _content = file_param request = build_file_request( content_type=content_type, content=_content, - template_url=self.file.metadata["url"], + template_url=self.file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -83,10 +84,15 @@ async def file(self, file_param: IO, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - file.metadata = {"url": "/binary/file"} # type: ignore + file.metadata = {'url': '/binary/file'} # type: ignore + @distributed_trace_async - async def binary(self, file_param: IO, **kwargs: Any) -> None: + async def binary( + self, + file_param: IO, + **kwargs: Any + ) -> None: """Uploading binary file. :param file_param: Non-empty binary file. @@ -96,23 +102,29 @@ async def binary(self, file_param: IO, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_param request = build_binary_request( content_type=content_type, content=_content, - template_url=self.binary.metadata["url"], + template_url=self.binary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,4 +134,5 @@ async def binary(self, file_param: IO, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - binary.metadata = {"url": "/binary/octet"} # type: ignore + binary.metadata = {'url': '/binary/octet'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/__init__.py index 4d8dc9efe65..cf5ac63ac59 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/__init__.py @@ -9,5 +9,5 @@ from ._upload_operations import UploadOperations __all__ = [ - "UploadOperations", + 'UploadOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py index a384de70d0f..a39dd66196a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -26,9 +19,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, IO, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -113,23 +105,29 @@ def file( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _content = file_param request = build_file_request( content_type=content_type, content=_content, - template_url=self.file.metadata["url"], + template_url=self.file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -139,7 +137,8 @@ def file( if cls: return cls(pipeline_response, None, {}) - file.metadata = {"url": "/binary/file"} # type: ignore + file.metadata = {'url': '/binary/file'} # type: ignore + @distributed_trace def binary( @@ -157,23 +156,29 @@ def binary( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_param request = build_binary_request( content_type=content_type, content=_content, - template_url=self.binary.metadata["url"], + template_url=self.binary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,4 +188,5 @@ def binary( if cls: return cls(pipeline_response, None, {}) - binary.metadata = {"url": "/binary/octet"} # type: ignore + binary.metadata = {'url': '/binary/octet'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py index 772307d83f9..4a12c367eb1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Sample for file with json and binary content type. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/__init__.py index b7f0064df51..f7824a9f9db 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestBoolTestService"] +__all__ = ['AutoRestBoolTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py index 20c24eae8b5..80c8620325c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestBoolTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.bool = BoolOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_configuration.py index db8c41b81b2..368fc032cb3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestBoolTestServiceConfiguration(Configuration): +class AutoRestBoolTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestBoolTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestBoolTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestBoolTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestbooltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestbooltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/__init__.py index 00f063d07bf..6807a1e64da 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_bool_test_service import AutoRestBoolTestService - -__all__ = ["AutoRestBoolTestService"] +__all__ = ['AutoRestBoolTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py index 9ac7998d5a3..814d804ba6d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestBoolTestServiceConfiguration from .operations import BoolOperations - class AutoRestBoolTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestBoolTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestBoolTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.bool = BoolOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_configuration.py index 759e32fbf2e..8016efed0d0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestBoolTestServiceConfiguration(Configuration): +class AutoRestBoolTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestBoolTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestBoolTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestbooltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestbooltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/__init__.py index 6c60f972135..2e89438bdde 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._bool_operations import BoolOperations __all__ = [ - "BoolOperations", + 'BoolOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py index 6e7cd8e58cb..350531abf88 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,19 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._bool_operations import ( - build_get_false_request, - build_get_invalid_request, - build_get_null_request, - build_get_true_request, - build_put_false_request, - build_put_true_request, -) - -T = TypeVar("T") +from ...operations._bool_operations import build_get_false_request, build_get_invalid_request, build_get_null_request, build_get_true_request, build_put_false_request, build_put_true_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class BoolOperations: """BoolOperations async operations. @@ -59,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_true(self, **kwargs: Any) -> bool: + async def get_true( + self, + **kwargs: Any + ) -> bool: """Get true Boolean value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -67,17 +54,24 @@ async def get_true(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_true_request( - template_url=self.get_true.metadata["url"], + template_url=self.get_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,17 +79,21 @@ async def get_true(self, **kwargs: Any) -> bool: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_true.metadata = {"url": "/bool/true"} # type: ignore + get_true.metadata = {'url': '/bool/true'} # type: ignore + @distributed_trace_async - async def put_true(self, **kwargs: Any) -> None: + async def put_true( + self, + **kwargs: Any + ) -> None: """Set Boolean value true. :keyword bool_body: The default value is True. Note that overriding this default value may @@ -106,22 +104,29 @@ async def put_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", True) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', True) # type: bool + request = build_put_true_request( content_type=content_type, json=bool_body, - template_url=self.put_true.metadata["url"], + template_url=self.put_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,10 +137,14 @@ async def put_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_true.metadata = {"url": "/bool/true"} # type: ignore + put_true.metadata = {'url': '/bool/true'} # type: ignore + @distributed_trace_async - async def get_false(self, **kwargs: Any) -> bool: + async def get_false( + self, + **kwargs: Any + ) -> bool: """Get false Boolean value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -143,17 +152,24 @@ async def get_false(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_false_request( - template_url=self.get_false.metadata["url"], + template_url=self.get_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,17 +177,21 @@ async def get_false(self, **kwargs: Any) -> bool: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_false.metadata = {"url": "/bool/false"} # type: ignore + get_false.metadata = {'url': '/bool/false'} # type: ignore + @distributed_trace_async - async def put_false(self, **kwargs: Any) -> None: + async def put_false( + self, + **kwargs: Any + ) -> None: """Set Boolean value false. :keyword bool_body: The default value is False. Note that overriding this default value may @@ -182,22 +202,29 @@ async def put_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", False) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', False) # type: bool + request = build_put_false_request( content_type=content_type, json=bool_body, - template_url=self.put_false.metadata["url"], + template_url=self.put_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -208,10 +235,14 @@ async def put_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_false.metadata = {"url": "/bool/false"} # type: ignore + put_false.metadata = {'url': '/bool/false'} # type: ignore + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[bool]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[bool]: """Get null Boolean value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -219,17 +250,24 @@ async def get_null(self, **kwargs: Any) -> Optional[bool]: :rtype: bool or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -237,17 +275,21 @@ async def get_null(self, **kwargs: Any) -> Optional[bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/bool/null"} # type: ignore + get_null.metadata = {'url': '/bool/null'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> bool: + async def get_invalid( + self, + **kwargs: Any + ) -> bool: """Get invalid Boolean value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -255,17 +297,24 @@ async def get_invalid(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,11 +322,12 @@ async def get_invalid(self, **kwargs: Any) -> bool: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/bool/invalid"} # type: ignore + get_invalid.metadata = {'url': '/bool/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/__init__.py index 6c60f972135..2e89438bdde 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/__init__.py @@ -9,5 +9,5 @@ from ._bool_operations import BoolOperations __all__ = [ - "BoolOperations", + 'BoolOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py index a382cce7af7..9822ae4341f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -192,7 +184,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_true( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Get true Boolean value. @@ -202,17 +195,24 @@ def get_true( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_true_request( - template_url=self.get_true.metadata["url"], + template_url=self.get_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -220,18 +220,20 @@ def get_true( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_true.metadata = {"url": "/bool/true"} # type: ignore + get_true.metadata = {'url': '/bool/true'} # type: ignore + @distributed_trace def put_true( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Set Boolean value true. @@ -244,22 +246,29 @@ def put_true( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", True) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', True) # type: bool + request = build_put_true_request( content_type=content_type, json=bool_body, - template_url=self.put_true.metadata["url"], + template_url=self.put_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,11 +279,13 @@ def put_true( if cls: return cls(pipeline_response, None, {}) - put_true.metadata = {"url": "/bool/true"} # type: ignore + put_true.metadata = {'url': '/bool/true'} # type: ignore + @distributed_trace def get_false( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Get false Boolean value. @@ -284,17 +295,24 @@ def get_false( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_false_request( - template_url=self.get_false.metadata["url"], + template_url=self.get_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -302,18 +320,20 @@ def get_false( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_false.metadata = {"url": "/bool/false"} # type: ignore + get_false.metadata = {'url': '/bool/false'} # type: ignore + @distributed_trace def put_false( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Set Boolean value false. @@ -326,22 +346,29 @@ def put_false( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", False) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', False) # type: bool + request = build_put_false_request( content_type=content_type, json=bool_body, - template_url=self.put_false.metadata["url"], + template_url=self.put_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -352,11 +379,13 @@ def put_false( if cls: return cls(pipeline_response, None, {}) - put_false.metadata = {"url": "/bool/false"} # type: ignore + put_false.metadata = {'url': '/bool/false'} # type: ignore + @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[bool] """Get null Boolean value. @@ -366,17 +395,24 @@ def get_null( :rtype: bool or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -384,18 +420,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/bool/null"} # type: ignore + get_null.metadata = {'url': '/bool/null'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Get invalid Boolean value. @@ -405,17 +443,24 @@ def get_invalid( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -423,11 +468,12 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/bool/invalid"} # type: ignore + get_invalid.metadata = {'url': '/bool/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py index 374eaef7983..ebc098fd1cc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/__init__.py index c8aff8de0a0..910d784dc9b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATByteService"] +__all__ = ['AutoRestSwaggerBATByteService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py index b00fbecd6bb..da8d61d4b6f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATByteService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.byte = ByteOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_configuration.py index ff076785142..ace10347959 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATByteServiceConfiguration(Configuration): +class AutoRestSwaggerBATByteServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATByteService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATByteServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATByteServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatbyteservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatbyteservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/__init__.py index 6ee1bab4379..073b055af7f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_byte_service import AutoRestSwaggerBATByteService - -__all__ = ["AutoRestSwaggerBATByteService"] +__all__ = ['AutoRestSwaggerBATByteService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py index 52afe9ed761..489f298bbd8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATByteServiceConfiguration from .operations import ByteOperations - class AutoRestSwaggerBATByteService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATByteService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATByteServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.byte = ByteOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_configuration.py index 9262696cc4f..b1345d6f694 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATByteServiceConfiguration(Configuration): +class AutoRestSwaggerBATByteServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATByteService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATByteServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatbyteservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatbyteservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/__init__.py index 1b75de6ee3a..749f4f28fc2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._byte_operations import ByteOperations __all__ = [ - "ByteOperations", + 'ByteOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py index c35da62e0c0..319c6b953e3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,18 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._byte_operations import ( - build_get_empty_request, - build_get_invalid_request, - build_get_non_ascii_request, - build_get_null_request, - build_put_non_ascii_request, -) - -T = TypeVar("T") +from ...operations._byte_operations import build_get_empty_request, build_get_invalid_request, build_get_non_ascii_request, build_get_null_request, build_put_non_ascii_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ByteOperations: """ByteOperations async operations. @@ -58,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> bytearray: + async def get_null( + self, + **kwargs: Any + ) -> bytearray: """Get null byte value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -66,17 +54,24 @@ async def get_null(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,17 +79,21 @@ async def get_null(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/byte/null"} # type: ignore + get_null.metadata = {'url': '/byte/null'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> bytearray: + async def get_empty( + self, + **kwargs: Any + ) -> bytearray: """Get empty byte value ''. :keyword callable cls: A custom type or function that will be passed the direct response @@ -102,17 +101,24 @@ async def get_empty(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,17 +126,21 @@ async def get_empty(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/byte/empty"} # type: ignore + get_empty.metadata = {'url': '/byte/empty'} # type: ignore + @distributed_trace_async - async def get_non_ascii(self, **kwargs: Any) -> bytearray: + async def get_non_ascii( + self, + **kwargs: Any + ) -> bytearray: """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,17 +148,24 @@ async def get_non_ascii(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_non_ascii_request( - template_url=self.get_non_ascii.metadata["url"], + template_url=self.get_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,17 +173,22 @@ async def get_non_ascii(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + get_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace_async - async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: + async def put_non_ascii( + self, + byte_body: bytearray, + **kwargs: Any + ) -> None: """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :param byte_body: Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). @@ -176,23 +198,29 @@ async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(byte_body, "bytearray") + _json = self._serialize.body(byte_body, 'bytearray') request = build_put_non_ascii_request( content_type=content_type, json=_json, - template_url=self.put_non_ascii.metadata["url"], + template_url=self.put_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,10 +231,14 @@ async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + put_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> bytearray: + async def get_invalid( + self, + **kwargs: Any + ) -> bytearray: """Get invalid byte value ':::SWAGGER::::'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -214,17 +246,24 @@ async def get_invalid(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,11 +271,12 @@ async def get_invalid(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/byte/invalid"} # type: ignore + get_invalid.metadata = {'url': '/byte/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/__init__.py index 1b75de6ee3a..749f4f28fc2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/__init__.py @@ -9,5 +9,5 @@ from ._byte_operations import ByteOperations __all__ = [ - "ByteOperations", + 'ByteOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py index 670b66e18ff..0a64d7bdbf1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -164,7 +156,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get null byte value. @@ -174,17 +167,24 @@ def get_null( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -192,18 +192,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/byte/null"} # type: ignore + get_null.metadata = {'url': '/byte/null'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get empty byte value ''. @@ -213,17 +215,24 @@ def get_empty( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -231,18 +240,20 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/byte/empty"} # type: ignore + get_empty.metadata = {'url': '/byte/empty'} # type: ignore + @distributed_trace def get_non_ascii( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). @@ -252,17 +263,24 @@ def get_non_ascii( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_non_ascii_request( - template_url=self.get_non_ascii.metadata["url"], + template_url=self.get_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,14 +288,15 @@ def get_non_ascii( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + get_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace def put_non_ascii( @@ -295,23 +314,29 @@ def put_non_ascii( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(byte_body, "bytearray") + _json = self._serialize.body(byte_body, 'bytearray') request = build_put_non_ascii_request( content_type=content_type, json=_json, - template_url=self.put_non_ascii.metadata["url"], + template_url=self.put_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -322,11 +347,13 @@ def put_non_ascii( if cls: return cls(pipeline_response, None, {}) - put_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + put_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get invalid byte value ':::SWAGGER::::'. @@ -336,17 +363,24 @@ def get_invalid( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -354,11 +388,12 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/byte/invalid"} # type: ignore + get_invalid.metadata = {'url': '/byte/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py index 158f73d896a..84a5162110e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/__init__.py index 23e1493020b..c911f0a90c0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ClassName"] +__all__ = ['ClassName'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py index 3cb420b9909..25a0f92a6ff 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class ClassName(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.byte = ByteOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_configuration.py index 5d3ead8be52..a007fa12d99 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class ClassNameConfiguration(Configuration): +class ClassNameConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ClassName. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class ClassNameConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(ClassNameConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "package-name/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'package-name/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/__init__.py index 3d6fed9a05c..8c2e3c6ee3c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._class_name import ClassName - -__all__ = ["ClassName"] +__all__ = ['ClassName'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py index 34e641bc32a..f6f75bd6fa2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import ClassNameConfiguration from .operations import ByteOperations - class ClassName: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class ClassName: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = ClassNameConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.byte = ByteOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_configuration.py index 180c56814e9..d69fdb10501 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class ClassNameConfiguration(Configuration): +class ClassNameConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ClassName. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ClassNameConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "package-name/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'package-name/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/__init__.py index 1b75de6ee3a..749f4f28fc2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._byte_operations import ByteOperations __all__ = [ - "ByteOperations", + 'ByteOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py index 35360e49641..3dbf9993818 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,18 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._byte_operations import ( - build_get_empty_request, - build_get_invalid_request, - build_get_non_ascii_request, - build_get_null_request, - build_put_non_ascii_request, -) - -T = TypeVar("T") +from ...operations._byte_operations import build_get_empty_request, build_get_invalid_request, build_get_non_ascii_request, build_get_null_request, build_put_non_ascii_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ByteOperations: """ByteOperations async operations. @@ -58,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> bytearray: + async def get_null( + self, + **kwargs: Any + ) -> bytearray: """Get null byte value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -66,17 +54,24 @@ async def get_null(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,17 +79,21 @@ async def get_null(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/byte/null"} # type: ignore + get_null.metadata = {'url': '/byte/null'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> bytearray: + async def get_empty( + self, + **kwargs: Any + ) -> bytearray: """Get empty byte value ''. :keyword callable cls: A custom type or function that will be passed the direct response @@ -102,17 +101,24 @@ async def get_empty(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,17 +126,21 @@ async def get_empty(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/byte/empty"} # type: ignore + get_empty.metadata = {'url': '/byte/empty'} # type: ignore + @distributed_trace_async - async def get_non_ascii(self, **kwargs: Any) -> bytearray: + async def get_non_ascii( + self, + **kwargs: Any + ) -> bytearray: """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :keyword callable cls: A custom type or function that will be passed the direct response @@ -138,17 +148,24 @@ async def get_non_ascii(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_non_ascii_request( - template_url=self.get_non_ascii.metadata["url"], + template_url=self.get_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,17 +173,22 @@ async def get_non_ascii(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + get_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace_async - async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: + async def put_non_ascii( + self, + byte_body: bytearray, + **kwargs: Any + ) -> None: """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :param byte_body: Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). @@ -176,23 +198,29 @@ async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(byte_body, "bytearray") + _json = self._serialize.body(byte_body, 'bytearray') request = build_put_non_ascii_request( content_type=content_type, json=_json, - template_url=self.put_non_ascii.metadata["url"], + template_url=self.put_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,10 +231,14 @@ async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + put_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> bytearray: + async def get_invalid( + self, + **kwargs: Any + ) -> bytearray: """Get invalid byte value ':::SWAGGER::::'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -214,17 +246,24 @@ async def get_invalid(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -232,11 +271,12 @@ async def get_invalid(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/byte/invalid"} # type: ignore + get_invalid.metadata = {'url': '/byte/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/__init__.py index 1b75de6ee3a..749f4f28fc2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/__init__.py @@ -9,5 +9,5 @@ from ._byte_operations import ByteOperations __all__ = [ - "ByteOperations", + 'ByteOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py index 878f5f01bf4..08ef6fd3bce 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -164,7 +156,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get null byte value. @@ -174,17 +167,24 @@ def get_null( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -192,18 +192,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/byte/null"} # type: ignore + get_null.metadata = {'url': '/byte/null'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get empty byte value ''. @@ -213,17 +215,24 @@ def get_empty( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -231,18 +240,20 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/byte/empty"} # type: ignore + get_empty.metadata = {'url': '/byte/empty'} # type: ignore + @distributed_trace def get_non_ascii( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). @@ -252,17 +263,24 @@ def get_non_ascii( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_non_ascii_request( - template_url=self.get_non_ascii.metadata["url"], + template_url=self.get_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,14 +288,15 @@ def get_non_ascii( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + get_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace def put_non_ascii( @@ -295,23 +314,29 @@ def put_non_ascii( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(byte_body, "bytearray") + _json = self._serialize.body(byte_body, 'bytearray') request = build_put_non_ascii_request( content_type=content_type, json=_json, - template_url=self.put_non_ascii.metadata["url"], + template_url=self.put_non_ascii.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -322,11 +347,13 @@ def put_non_ascii( if cls: return cls(pipeline_response, None, {}) - put_non_ascii.metadata = {"url": "/byte/nonAscii"} # type: ignore + put_non_ascii.metadata = {'url': '/byte/nonAscii'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get invalid byte value ':::SWAGGER::::'. @@ -336,17 +363,24 @@ def get_invalid( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -354,11 +388,12 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/byte/invalid"} # type: ignore + get_invalid.metadata = {'url': '/byte/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py index 941c608a307..a17fbbf99af 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/__init__.py index fd3f96ec0e5..f0dfc13a72f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py index f9824d1a50e..7aa7a812e65 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py @@ -14,26 +14,15 @@ from . import models from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - -class AutoRestComplexTestService(object): +class AutoRestComplexTestService(object): # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -79,14 +68,11 @@ def __init__( self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_configuration.py index 392fc9a4aab..63bf9b3e957 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_configuration.py @@ -18,37 +18,41 @@ from typing import Any -class AutoRestComplexTestServiceConfiguration(Configuration): +class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestComplexTestService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestcomplextestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestcomplextestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/__init__.py index 4c5493d4555..a5cab1e6f99 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_complex_test_service import AutoRestComplexTestService - -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py index f492c4b975b..7fb55a830ef 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -15,20 +15,9 @@ from .. import models from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) - - -class AutoRestComplexTestService: +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations + +class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -56,7 +45,11 @@ class AutoRestComplexTestService: :paramtype api_version: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -69,15 +62,16 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_configuration.py index 3a0eb727003..e968e56c41a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_configuration.py @@ -14,31 +14,39 @@ from .._version import VERSION -class AutoRestComplexTestServiceConfiguration(Configuration): +class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestComplexTestService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestcomplextestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestcomplextestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/__init__.py index ad0a93ac37c..84f771f755a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/__init__.py @@ -17,13 +17,13 @@ from ._flattencomplex_operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py index 853ff64473c..aacdddcdcfe 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,18 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._array_operations import ( - build_get_empty_request, - build_get_not_provided_request, - build_get_valid_request, - build_put_empty_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._array_operations import build_get_empty_request, build_get_not_provided_request, build_get_valid_request, build_put_empty_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ArrayOperations: """ArrayOperations async operations. @@ -58,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -66,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplex.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: + async def put_valid( + self, + array: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Put complex types with array property. :param array: @@ -104,24 +104,30 @@ async def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,10 +138,14 @@ async def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": + async def get_empty( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property which is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -143,17 +153,24 @@ async def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplex.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,17 +178,22 @@ async def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: + async def put_empty( + self, + array: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Put complex types with array property which is empty. :param array: @@ -181,24 +203,30 @@ async def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,10 +237,14 @@ async def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": + async def get_not_provided( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property while server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -220,17 +252,24 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplex.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -238,11 +277,12 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/array/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/array/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py index cffb59a2ae6..8dfd866a426 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,19 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._basic_operations import ( - build_get_empty_request, - build_get_invalid_request, - build_get_not_provided_request, - build_get_null_request, - build_get_valid_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._basic_operations import build_get_empty_request, build_get_invalid_request, build_get_not_provided_request, build_get_null_request, build_get_valid_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class BasicOperations: """BasicOperations async operations. @@ -59,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Basic": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Basic": """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -67,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Basic", + **kwargs: Any + ) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. @@ -105,25 +104,31 @@ async def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Basic") + _json = self._serialize.body(complex_body, 'Basic') request = build_put_valid_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -134,10 +139,14 @@ async def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> "_models.Basic": + async def get_invalid( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type that is invalid for the local strong type. :keyword callable cls: A custom type or function that will be passed the direct response @@ -145,17 +154,24 @@ async def get_invalid(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,17 +179,21 @@ async def get_invalid(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/complex/basic/invalid"} # type: ignore + get_invalid.metadata = {'url': '/complex/basic/invalid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> "_models.Basic": + async def get_empty( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type that is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -181,17 +201,24 @@ async def get_empty(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -199,17 +226,21 @@ async def get_empty(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/basic/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/basic/empty'} # type: ignore + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> "_models.Basic": + async def get_null( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type whose properties are null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -217,17 +248,24 @@ async def get_null(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,17 +273,21 @@ async def get_null(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/basic/null"} # type: ignore + get_null.metadata = {'url': '/complex/basic/null'} # type: ignore + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> "_models.Basic": + async def get_not_provided( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type while the server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -253,17 +295,24 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -271,11 +320,12 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/basic/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/basic/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py index d60676ae845..fb12b9afc80 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,19 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._dictionary_operations import ( - build_get_empty_request, - build_get_not_provided_request, - build_get_null_request, - build_get_valid_request, - build_put_empty_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._dictionary_operations import build_get_empty_request, build_get_not_provided_request, build_get_null_request, build_get_valid_request, build_put_empty_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DictionaryOperations: """DictionaryOperations async operations. @@ -59,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -67,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + async def put_valid( + self, + default_program: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """Put complex types with dictionary property. :param default_program: Dictionary of :code:``. @@ -105,24 +104,30 @@ async def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,10 +138,14 @@ async def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kw if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_empty( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property which is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,17 +153,24 @@ async def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -162,17 +178,22 @@ async def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + async def put_empty( + self, + default_program: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """Put complex types with dictionary property which is empty. :param default_program: Dictionary of :code:``. @@ -182,24 +203,30 @@ async def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -210,10 +237,14 @@ async def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kw if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_null( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property which is null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -221,17 +252,24 @@ async def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,17 +277,21 @@ async def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/dictionary/typed/null"} # type: ignore + get_null.metadata = {'url': '/complex/dictionary/typed/null'} # type: ignore + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_not_provided( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property while server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -257,17 +299,24 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -275,11 +324,12 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/dictionary/typed/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/dictionary/typed/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py index b3e679fcea7..74d8f3e1d22 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._flattencomplex_operations import build_get_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FlattencomplexOperations: """FlattencomplexOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.MyBaseType": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.MyBaseType": """get_valid. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,28 +54,36 @@ async def get_valid(self, **kwargs: Any) -> "_models.MyBaseType": :rtype: ~bodycomplex.models.MyBaseType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyBaseType"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyBaseType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyBaseType", pipeline_response) + deserialized = self._deserialize('MyBaseType', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/flatten/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/flatten/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py index 8d80429a2ae..dafc67c10a6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._inheritance_operations import build_get_valid_request, build_put_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class InheritanceOperations: """InheritanceOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Siamese": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Siamese": """Get complex types that extend others. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Siamese": :rtype: ~bodycomplex.models.Siamese :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Siamese"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Siamese"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -78,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Siamese": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Siamese", pipeline_response) + deserialized = self._deserialize('Siamese', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Siamese", + **kwargs: Any + ) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, @@ -100,23 +106,29 @@ async def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Siamese") + _json = self._serialize.body(complex_body, 'Siamese') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,4 +139,5 @@ async def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py index 0f33b96f862..109d86fe02e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._polymorphicrecursive_operations import build_get_valid_request, build_put_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PolymorphicrecursiveOperations: """PolymorphicrecursiveOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Fish": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Fish": """Get complex types that are polymorphic and have recursive references. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": :rtype: ~bodycomplex.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -78,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -150,23 +156,29 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,4 +189,5 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py index d4c3b40feb1..f0b68821c23 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,22 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._polymorphism_operations import ( - build_get_complicated_request, - build_get_composed_with_discriminator_request, - build_get_composed_without_discriminator_request, - build_get_dot_syntax_request, - build_get_valid_request, - build_put_complicated_request, - build_put_missing_discriminator_request, - build_put_valid_missing_required_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._polymorphism_operations import build_get_complicated_request, build_get_composed_with_discriminator_request, build_get_composed_without_discriminator_request, build_get_dot_syntax_request, build_get_valid_request, build_put_complicated_request, build_put_missing_discriminator_request, build_put_valid_missing_required_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PolymorphismOperations: """PolymorphismOperations async operations. @@ -62,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Fish": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Fish": """Get complex types that are polymorphic. :keyword callable cls: A custom type or function that will be passed the direct response @@ -70,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": :rtype: ~bodycomplex.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -140,23 +136,29 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -167,10 +169,14 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace_async - async def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": + async def get_dot_syntax( + self, + **kwargs: Any + ) -> "_models.DotFish": """Get complex types that are polymorphic, JSON key contains a dot. :keyword callable cls: A custom type or function that will be passed the direct response @@ -178,17 +184,24 @@ async def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": :rtype: ~bodycomplex.models.DotFish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dot_syntax_request( - template_url=self.get_dot_syntax.metadata["url"], + template_url=self.get_dot_syntax.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -196,17 +209,21 @@ async def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFish", pipeline_response) + deserialized = self._deserialize('DotFish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dot_syntax.metadata = {"url": "/complex/polymorphism/dotsyntax"} # type: ignore + get_dot_syntax.metadata = {'url': '/complex/polymorphism/dotsyntax'} # type: ignore + @distributed_trace_async - async def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFishMarket": + async def get_composed_with_discriminator( + self, + **kwargs: Any + ) -> "_models.DotFishMarket": """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -216,17 +233,24 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFi :rtype: ~bodycomplex.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_with_discriminator_request( - template_url=self.get_composed_with_discriminator.metadata["url"], + template_url=self.get_composed_with_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -234,17 +258,21 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFi error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_with_discriminator.metadata = {"url": "/complex/polymorphism/composedWithDiscriminator"} # type: ignore + get_composed_with_discriminator.metadata = {'url': '/complex/polymorphism/composedWithDiscriminator'} # type: ignore + @distributed_trace_async - async def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.DotFishMarket": + async def get_composed_without_discriminator( + self, + **kwargs: Any + ) -> "_models.DotFishMarket": """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -254,17 +282,24 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.Do :rtype: ~bodycomplex.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_without_discriminator_request( - template_url=self.get_composed_without_discriminator.metadata["url"], + template_url=self.get_composed_without_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,17 +307,21 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.Do error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_without_discriminator.metadata = {"url": "/complex/polymorphism/composedWithoutDiscriminator"} # type: ignore + get_composed_without_discriminator.metadata = {'url': '/complex/polymorphism/composedWithoutDiscriminator'} # type: ignore + @distributed_trace_async - async def get_complicated(self, **kwargs: Any) -> "_models.Salmon": + async def get_complicated( + self, + **kwargs: Any + ) -> "_models.Salmon": """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -291,17 +330,24 @@ async def get_complicated(self, **kwargs: Any) -> "_models.Salmon": :rtype: ~bodycomplex.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complicated_request( - template_url=self.get_complicated.metadata["url"], + template_url=self.get_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -309,17 +355,22 @@ async def get_complicated(self, **kwargs: Any) -> "_models.Salmon": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + get_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace_async - async def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) -> None: + async def put_complicated( + self, + complex_body: "_models.Salmon", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -330,23 +381,29 @@ async def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_complicated_request( content_type=content_type, json=_json, - template_url=self.put_complicated.metadata["url"], + template_url=self.put_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -357,10 +414,15 @@ async def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + put_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace_async - async def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwargs: Any) -> "_models.Salmon": + async def put_missing_discriminator( + self, + complex_body: "_models.Salmon", + **kwargs: Any + ) -> "_models.Salmon": """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: @@ -370,23 +432,29 @@ async def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwar :rtype: ~bodycomplex.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_missing_discriminator_request( content_type=content_type, json=_json, - template_url=self.put_missing_discriminator.metadata["url"], + template_url=self.put_missing_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -394,17 +462,22 @@ async def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwar error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_missing_discriminator.metadata = {"url": "/complex/polymorphism/missingdiscriminator"} # type: ignore + put_missing_discriminator.metadata = {'url': '/complex/polymorphism/missingdiscriminator'} # type: ignore + @distributed_trace_async - async def put_valid_missing_required(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + async def put_valid_missing_required( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -441,23 +514,29 @@ async def put_valid_missing_required(self, complex_body: "_models.Fish", **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_missing_required_request( content_type=content_type, json=_json, - template_url=self.put_valid_missing_required.metadata["url"], + template_url=self.put_valid_missing_required.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -468,4 +547,5 @@ async def put_valid_missing_required(self, complex_body: "_models.Fish", **kwarg if cls: return cls(pipeline_response, None, {}) - put_valid_missing_required.metadata = {"url": "/complex/polymorphism/missingrequired/invalid"} # type: ignore + put_valid_missing_required.metadata = {'url': '/complex/polymorphism/missingrequired/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py index 9d4593b8fb5..3c3a0232067 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,36 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._primitive_operations import ( - build_get_bool_request, - build_get_byte_request, - build_get_date_request, - build_get_date_time_request, - build_get_date_time_rfc1123_request, - build_get_double_request, - build_get_duration_request, - build_get_float_request, - build_get_int_request, - build_get_long_request, - build_get_string_request, - build_put_bool_request, - build_put_byte_request, - build_put_date_request, - build_put_date_time_request, - build_put_date_time_rfc1123_request, - build_put_double_request, - build_put_duration_request, - build_put_float_request, - build_put_int_request, - build_put_long_request, - build_put_string_request, -) - -T = TypeVar("T") +from ...operations._primitive_operations import build_get_bool_request, build_get_byte_request, build_get_date_request, build_get_date_time_request, build_get_date_time_rfc1123_request, build_get_double_request, build_get_duration_request, build_get_float_request, build_get_int_request, build_get_long_request, build_get_string_request, build_put_bool_request, build_put_byte_request, build_put_date_request, build_put_date_time_request, build_put_date_time_rfc1123_request, build_put_double_request, build_put_duration_request, build_put_float_request, build_put_int_request, build_put_long_request, build_put_string_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class PrimitiveOperations: +class PrimitiveOperations: # pylint: disable=too-many-public-methods """PrimitiveOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -76,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_int(self, **kwargs: Any) -> "_models.IntWrapper": + async def get_int( + self, + **kwargs: Any + ) -> "_models.IntWrapper": """Get complex types with integer properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -84,17 +55,24 @@ async def get_int(self, **kwargs: Any) -> "_models.IntWrapper": :rtype: ~bodycomplex.models.IntWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.IntWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_request( - template_url=self.get_int.metadata["url"], + template_url=self.get_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,17 +80,22 @@ async def get_int(self, **kwargs: Any) -> "_models.IntWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("IntWrapper", pipeline_response) + deserialized = self._deserialize('IntWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + get_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace_async - async def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> None: + async def put_int( + self, + complex_body: "_models.IntWrapper", + **kwargs: Any + ) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. @@ -122,23 +105,29 @@ async def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "IntWrapper") + _json = self._serialize.body(complex_body, 'IntWrapper') request = build_put_int_request( content_type=content_type, json=_json, - template_url=self.put_int.metadata["url"], + template_url=self.put_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -149,10 +138,14 @@ async def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + put_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace_async - async def get_long(self, **kwargs: Any) -> "_models.LongWrapper": + async def get_long( + self, + **kwargs: Any + ) -> "_models.LongWrapper": """Get complex types with long properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -160,17 +153,24 @@ async def get_long(self, **kwargs: Any) -> "_models.LongWrapper": :rtype: ~bodycomplex.models.LongWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.LongWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_request( - template_url=self.get_long.metadata["url"], + template_url=self.get_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,17 +178,22 @@ async def get_long(self, **kwargs: Any) -> "_models.LongWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("LongWrapper", pipeline_response) + deserialized = self._deserialize('LongWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + get_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace_async - async def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> None: + async def put_long( + self, + complex_body: "_models.LongWrapper", + **kwargs: Any + ) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. @@ -198,23 +203,29 @@ async def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "LongWrapper") + _json = self._serialize.body(complex_body, 'LongWrapper') request = build_put_long_request( content_type=content_type, json=_json, - template_url=self.put_long.metadata["url"], + template_url=self.put_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -225,10 +236,14 @@ async def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + put_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace_async - async def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": + async def get_float( + self, + **kwargs: Any + ) -> "_models.FloatWrapper": """Get complex types with float properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -236,17 +251,24 @@ async def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": :rtype: ~bodycomplex.models.FloatWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.FloatWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.FloatWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_request( - template_url=self.get_float.metadata["url"], + template_url=self.get_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -254,17 +276,22 @@ async def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("FloatWrapper", pipeline_response) + deserialized = self._deserialize('FloatWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + get_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace_async - async def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) -> None: + async def put_float( + self, + complex_body: "_models.FloatWrapper", + **kwargs: Any + ) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. @@ -274,23 +301,29 @@ async def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "FloatWrapper") + _json = self._serialize.body(complex_body, 'FloatWrapper') request = build_put_float_request( content_type=content_type, json=_json, - template_url=self.put_float.metadata["url"], + template_url=self.put_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -301,10 +334,14 @@ async def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + put_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace_async - async def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": + async def get_double( + self, + **kwargs: Any + ) -> "_models.DoubleWrapper": """Get complex types with double properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -312,17 +349,24 @@ async def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": :rtype: ~bodycomplex.models.DoubleWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DoubleWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DoubleWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_request( - template_url=self.get_double.metadata["url"], + template_url=self.get_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -330,17 +374,22 @@ async def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DoubleWrapper", pipeline_response) + deserialized = self._deserialize('DoubleWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + get_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace_async - async def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) -> None: + async def put_double( + self, + complex_body: "_models.DoubleWrapper", + **kwargs: Any + ) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and @@ -351,23 +400,29 @@ async def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DoubleWrapper") + _json = self._serialize.body(complex_body, 'DoubleWrapper') request = build_put_double_request( content_type=content_type, json=_json, - template_url=self.put_double.metadata["url"], + template_url=self.put_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,10 +433,14 @@ async def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + put_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace_async - async def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": + async def get_bool( + self, + **kwargs: Any + ) -> "_models.BooleanWrapper": """Get complex types with bool properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -389,17 +448,24 @@ async def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": :rtype: ~bodycomplex.models.BooleanWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.BooleanWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.BooleanWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_bool_request( - template_url=self.get_bool.metadata["url"], + template_url=self.get_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,17 +473,22 @@ async def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("BooleanWrapper", pipeline_response) + deserialized = self._deserialize('BooleanWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + get_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace_async - async def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) -> None: + async def put_bool( + self, + complex_body: "_models.BooleanWrapper", + **kwargs: Any + ) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. @@ -427,23 +498,29 @@ async def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "BooleanWrapper") + _json = self._serialize.body(complex_body, 'BooleanWrapper') request = build_put_bool_request( content_type=content_type, json=_json, - template_url=self.put_bool.metadata["url"], + template_url=self.put_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -454,10 +531,14 @@ async def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + put_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace_async - async def get_string(self, **kwargs: Any) -> "_models.StringWrapper": + async def get_string( + self, + **kwargs: Any + ) -> "_models.StringWrapper": """Get complex types with string properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -465,17 +546,24 @@ async def get_string(self, **kwargs: Any) -> "_models.StringWrapper": :rtype: ~bodycomplex.models.StringWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StringWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StringWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_request( - template_url=self.get_string.metadata["url"], + template_url=self.get_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -483,17 +571,22 @@ async def get_string(self, **kwargs: Any) -> "_models.StringWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("StringWrapper", pipeline_response) + deserialized = self._deserialize('StringWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + get_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace_async - async def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) -> None: + async def put_string( + self, + complex_body: "_models.StringWrapper", + **kwargs: Any + ) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. @@ -503,23 +596,29 @@ async def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "StringWrapper") + _json = self._serialize.body(complex_body, 'StringWrapper') request = build_put_string_request( content_type=content_type, json=_json, - template_url=self.put_string.metadata["url"], + template_url=self.put_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -530,10 +629,14 @@ async def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + put_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace_async - async def get_date(self, **kwargs: Any) -> "_models.DateWrapper": + async def get_date( + self, + **kwargs: Any + ) -> "_models.DateWrapper": """Get complex types with date properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -541,17 +644,24 @@ async def get_date(self, **kwargs: Any) -> "_models.DateWrapper": :rtype: ~bodycomplex.models.DateWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DateWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DateWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_request( - template_url=self.get_date.metadata["url"], + template_url=self.get_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -559,17 +669,22 @@ async def get_date(self, **kwargs: Any) -> "_models.DateWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DateWrapper", pipeline_response) + deserialized = self._deserialize('DateWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + get_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace_async - async def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> None: + async def put_date( + self, + complex_body: "_models.DateWrapper", + **kwargs: Any + ) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. @@ -579,23 +694,29 @@ async def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DateWrapper") + _json = self._serialize.body(complex_body, 'DateWrapper') request = build_put_date_request( content_type=content_type, json=_json, - template_url=self.put_date.metadata["url"], + template_url=self.put_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,10 +727,14 @@ async def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + put_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace_async - async def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": + async def get_date_time( + self, + **kwargs: Any + ) -> "_models.DatetimeWrapper": """Get complex types with datetime properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -617,17 +742,24 @@ async def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": :rtype: ~bodycomplex.models.DatetimeWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DatetimeWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatetimeWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_request( - template_url=self.get_date_time.metadata["url"], + template_url=self.get_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -635,17 +767,22 @@ async def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DatetimeWrapper", pipeline_response) + deserialized = self._deserialize('DatetimeWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + get_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace_async - async def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: Any) -> None: + async def put_date_time( + self, + complex_body: "_models.DatetimeWrapper", + **kwargs: Any + ) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -655,23 +792,29 @@ async def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DatetimeWrapper") + _json = self._serialize.body(complex_body, 'DatetimeWrapper') request = build_put_date_time_request( content_type=content_type, json=_json, - template_url=self.put_date_time.metadata["url"], + template_url=self.put_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -682,10 +825,14 @@ async def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: if cls: return cls(pipeline_response, None, {}) - put_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + put_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace_async - async def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123Wrapper": + async def get_date_time_rfc1123( + self, + **kwargs: Any + ) -> "_models.Datetimerfc1123Wrapper": """Get complex types with datetimeRfc1123 properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -693,17 +840,24 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123 :rtype: ~bodycomplex.models.Datetimerfc1123Wrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Datetimerfc1123Wrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datetimerfc1123Wrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_request( - template_url=self.get_date_time_rfc1123.metadata["url"], + template_url=self.get_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,17 +865,22 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123 error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Datetimerfc1123Wrapper", pipeline_response) + deserialized = self._deserialize('Datetimerfc1123Wrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + get_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace_async - async def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrapper", **kwargs: Any) -> None: + async def put_date_time_rfc1123( + self, + complex_body: "_models.Datetimerfc1123Wrapper", + **kwargs: Any + ) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 @@ -732,23 +891,29 @@ async def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrap :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Datetimerfc1123Wrapper") + _json = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') request = build_put_date_time_rfc1123_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123.metadata["url"], + template_url=self.put_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -759,10 +924,14 @@ async def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrap if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + put_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace_async - async def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": + async def get_duration( + self, + **kwargs: Any + ) -> "_models.DurationWrapper": """Get complex types with duration properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -770,17 +939,24 @@ async def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": :rtype: ~bodycomplex.models.DurationWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DurationWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DurationWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_request( - template_url=self.get_duration.metadata["url"], + template_url=self.get_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -788,17 +964,22 @@ async def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DurationWrapper", pipeline_response) + deserialized = self._deserialize('DurationWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + get_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace_async - async def put_duration(self, field: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: + async def put_duration( + self, + field: Optional[datetime.timedelta] = None, + **kwargs: Any + ) -> None: """Put complex types with duration properties. :param field: @@ -808,24 +989,30 @@ async def put_duration(self, field: Optional[datetime.timedelta] = None, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DurationWrapper(field=field) - _json = self._serialize.body(_complex_body, "DurationWrapper") + _json = self._serialize.body(_complex_body, 'DurationWrapper') request = build_put_duration_request( content_type=content_type, json=_json, - template_url=self.put_duration.metadata["url"], + template_url=self.put_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -836,10 +1023,14 @@ async def put_duration(self, field: Optional[datetime.timedelta] = None, **kwarg if cls: return cls(pipeline_response, None, {}) - put_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + put_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace_async - async def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": + async def get_byte( + self, + **kwargs: Any + ) -> "_models.ByteWrapper": """Get complex types with byte properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -847,17 +1038,24 @@ async def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": :rtype: ~bodycomplex.models.ByteWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ByteWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ByteWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_request( - template_url=self.get_byte.metadata["url"], + template_url=self.get_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -865,17 +1063,22 @@ async def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ByteWrapper", pipeline_response) + deserialized = self._deserialize('ByteWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + get_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + @distributed_trace_async - async def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> None: + async def put_byte( + self, + field: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Put complex types with byte properties. :param field: @@ -885,24 +1088,30 @@ async def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ByteWrapper(field=field) - _json = self._serialize.body(_complex_body, "ByteWrapper") + _json = self._serialize.body(_complex_body, 'ByteWrapper') request = build_put_byte_request( content_type=content_type, json=_json, - template_url=self.put_byte.metadata["url"], + template_url=self.put_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -913,4 +1122,5 @@ async def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + put_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py index 989e5c6b0f0..8a644027b9f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._readonlyproperty_operations import build_get_valid_request, build_put_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ReadonlypropertyOperations: """ReadonlypropertyOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.ReadonlyObj": """Get complex types that have readonly properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": :rtype: ~bodycomplex.models.ReadonlyObj :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ReadonlyObj"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReadonlyObj"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -78,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ReadonlyObj", pipeline_response) + deserialized = self._deserialize('ReadonlyObj', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: + async def put_valid( + self, + size: Optional[int] = None, + **kwargs: Any + ) -> None: """Put complex types that have readonly properties. :param size: @@ -98,24 +104,30 @@ async def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ReadonlyObj(size=size) - _json = self._serialize.body(_complex_body, "ReadonlyObj") + _json = self._serialize.body(_complex_body, 'ReadonlyObj') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,4 +138,5 @@ async def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py index 1730a2d0886..9eef844bef0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py @@ -80,39 +80,39 @@ ) __all__ = [ - "ArrayWrapper", - "Basic", - "BooleanWrapper", - "ByteWrapper", - "Cat", - "Cookiecuttershark", - "DateWrapper", - "DatetimeWrapper", - "Datetimerfc1123Wrapper", - "DictionaryWrapper", - "Dog", - "DotFish", - "DotFishMarket", - "DotSalmon", - "DoubleWrapper", - "DurationWrapper", - "Error", - "Fish", - "FloatWrapper", - "Goblinshark", - "IntWrapper", - "LongWrapper", - "MyBaseType", - "MyDerivedType", - "Pet", - "ReadonlyObj", - "Salmon", - "Sawshark", - "Shark", - "Siamese", - "SmartSalmon", - "StringWrapper", - "CMYKColors", - "GoblinSharkColor", - "MyKind", + 'ArrayWrapper', + 'Basic', + 'BooleanWrapper', + 'ByteWrapper', + 'Cat', + 'Cookiecuttershark', + 'DateWrapper', + 'DatetimeWrapper', + 'Datetimerfc1123Wrapper', + 'DictionaryWrapper', + 'Dog', + 'DotFish', + 'DotFishMarket', + 'DotSalmon', + 'DoubleWrapper', + 'DurationWrapper', + 'Error', + 'Fish', + 'FloatWrapper', + 'Goblinshark', + 'IntWrapper', + 'LongWrapper', + 'MyBaseType', + 'MyDerivedType', + 'Pet', + 'ReadonlyObj', + 'Salmon', + 'Sawshark', + 'Shark', + 'Siamese', + 'SmartSalmon', + 'StringWrapper', + 'CMYKColors', + 'GoblinSharkColor', + 'MyKind', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_auto_rest_complex_test_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_auto_rest_complex_test_service_enums.py index dd6d79768e0..a0e2ace8230 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_auto_rest_complex_test_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_auto_rest_complex_test_service_enums.py @@ -18,9 +18,9 @@ class CMYKColors(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): YELLOW = "YELLOW" BLAC_K = "blacK" - class GoblinSharkColor(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Colors possible""" + """Colors possible + """ PINK = "pink" GRAY = "gray" @@ -30,7 +30,6 @@ class GoblinSharkColor(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Lowercase RED. LOWER_RED = "red" - class MyKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): KIND1 = "Kind1" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models.py index cfb234e9e2e..0b15a536c87 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models.py @@ -18,16 +18,19 @@ class ArrayWrapper(msrest.serialization.Model): """ _attribute_map = { - "array": {"key": "array", "type": "[str]"}, + 'array': {'key': 'array', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword array: :paramtype array: list[str] """ super(ArrayWrapper, self).__init__(**kwargs) - self.array = kwargs.get("array", None) + self.array = kwargs.get('array', None) class Basic(msrest.serialization.Model): @@ -43,12 +46,15 @@ class Basic(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: Basic Id. :paramtype id: int @@ -59,9 +65,9 @@ def __init__(self, **kwargs): :paramtype color: str or ~bodycomplex.models.CMYKColors """ super(Basic, self).__init__(**kwargs) - self.id = kwargs.get("id", None) - self.name = kwargs.get("name", None) - self.color = kwargs.get("color", None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.color = kwargs.get('color', None) class BooleanWrapper(msrest.serialization.Model): @@ -74,11 +80,14 @@ class BooleanWrapper(msrest.serialization.Model): """ _attribute_map = { - "field_true": {"key": "field_true", "type": "bool"}, - "field_false": {"key": "field_false", "type": "bool"}, + 'field_true': {'key': 'field_true', 'type': 'bool'}, + 'field_false': {'key': 'field_false', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field_true: :paramtype field_true: bool @@ -86,8 +95,8 @@ def __init__(self, **kwargs): :paramtype field_false: bool """ super(BooleanWrapper, self).__init__(**kwargs) - self.field_true = kwargs.get("field_true", None) - self.field_false = kwargs.get("field_false", None) + self.field_true = kwargs.get('field_true', None) + self.field_false = kwargs.get('field_false', None) class ByteWrapper(msrest.serialization.Model): @@ -98,16 +107,19 @@ class ByteWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "bytearray"}, + 'field': {'key': 'field', 'type': 'bytearray'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field: :paramtype field: bytearray """ super(ByteWrapper, self).__init__(**kwargs) - self.field = kwargs.get("field", None) + self.field = kwargs.get('field', None) class Pet(msrest.serialization.Model): @@ -120,11 +132,14 @@ class Pet(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -132,8 +147,8 @@ def __init__(self, **kwargs): :paramtype name: str """ super(Pet, self).__init__(**kwargs) - self.id = kwargs.get("id", None) - self.name = kwargs.get("name", None) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) class Cat(Pet): @@ -150,13 +165,16 @@ class Cat(Pet): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, - "hates": {"key": "hates", "type": "[Dog]"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, + 'hates': {'key': 'hates', 'type': '[Dog]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -168,8 +186,8 @@ def __init__(self, **kwargs): :paramtype hates: list[~bodycomplex.models.Dog] """ super(Cat, self).__init__(**kwargs) - self.color = kwargs.get("color", None) - self.hates = kwargs.get("hates", None) + self.color = kwargs.get('color', None) + self.hates = kwargs.get('hates', None) class Fish(msrest.serialization.Model): @@ -191,20 +209,25 @@ class Fish(msrest.serialization.Model): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, } - _subtype_map = {"fishtype": {"salmon": "Salmon", "shark": "Shark"}} + _subtype_map = { + 'fishtype': {'salmon': 'Salmon', 'shark': 'Shark'} + } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -215,9 +238,9 @@ def __init__(self, **kwargs): """ super(Fish, self).__init__(**kwargs) self.fishtype = None # type: Optional[str] - self.species = kwargs.get("species", None) - self.length = kwargs["length"] - self.siblings = kwargs.get("siblings", None) + self.species = kwargs.get('species', None) + self.length = kwargs['length'] + self.siblings = kwargs.get('siblings', None) class Shark(Fish): @@ -243,25 +266,28 @@ class Shark(Fish): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, } _subtype_map = { - "fishtype": {"cookiecuttershark": "Cookiecuttershark", "goblin": "Goblinshark", "sawshark": "Sawshark"} + 'fishtype': {'cookiecuttershark': 'Cookiecuttershark', 'goblin': 'Goblinshark', 'sawshark': 'Sawshark'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -275,9 +301,9 @@ def __init__(self, **kwargs): :paramtype birthday: ~datetime.datetime """ super(Shark, self).__init__(**kwargs) - self.fishtype = "shark" # type: str - self.age = kwargs.get("age", None) - self.birthday = kwargs["birthday"] + self.fishtype = 'shark' # type: str + self.age = kwargs.get('age', None) + self.birthday = kwargs['birthday'] class Cookiecuttershark(Shark): @@ -300,21 +326,24 @@ class Cookiecuttershark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -328,7 +357,7 @@ def __init__(self, **kwargs): :paramtype birthday: ~datetime.datetime """ super(Cookiecuttershark, self).__init__(**kwargs) - self.fishtype = "cookiecuttershark" # type: str + self.fishtype = 'cookiecuttershark' # type: str class Datetimerfc1123Wrapper(msrest.serialization.Model): @@ -341,11 +370,14 @@ class Datetimerfc1123Wrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "rfc-1123"}, - "now": {"key": "now", "type": "rfc-1123"}, + 'field': {'key': 'field', 'type': 'rfc-1123'}, + 'now': {'key': 'now', 'type': 'rfc-1123'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.datetime @@ -353,8 +385,8 @@ def __init__(self, **kwargs): :paramtype now: ~datetime.datetime """ super(Datetimerfc1123Wrapper, self).__init__(**kwargs) - self.field = kwargs.get("field", None) - self.now = kwargs.get("now", None) + self.field = kwargs.get('field', None) + self.now = kwargs.get('now', None) class DatetimeWrapper(msrest.serialization.Model): @@ -367,11 +399,14 @@ class DatetimeWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "iso-8601"}, - "now": {"key": "now", "type": "iso-8601"}, + 'field': {'key': 'field', 'type': 'iso-8601'}, + 'now': {'key': 'now', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.datetime @@ -379,8 +414,8 @@ def __init__(self, **kwargs): :paramtype now: ~datetime.datetime """ super(DatetimeWrapper, self).__init__(**kwargs) - self.field = kwargs.get("field", None) - self.now = kwargs.get("now", None) + self.field = kwargs.get('field', None) + self.now = kwargs.get('now', None) class DateWrapper(msrest.serialization.Model): @@ -393,11 +428,14 @@ class DateWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "date"}, - "leap": {"key": "leap", "type": "date"}, + 'field': {'key': 'field', 'type': 'date'}, + 'leap': {'key': 'leap', 'type': 'date'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.date @@ -405,8 +443,8 @@ def __init__(self, **kwargs): :paramtype leap: ~datetime.date """ super(DateWrapper, self).__init__(**kwargs) - self.field = kwargs.get("field", None) - self.leap = kwargs.get("leap", None) + self.field = kwargs.get('field', None) + self.leap = kwargs.get('leap', None) class DictionaryWrapper(msrest.serialization.Model): @@ -417,16 +455,19 @@ class DictionaryWrapper(msrest.serialization.Model): """ _attribute_map = { - "default_program": {"key": "defaultProgram", "type": "{str}"}, + 'default_program': {'key': 'defaultProgram', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword default_program: Dictionary of :code:``. :paramtype default_program: dict[str, str] """ super(DictionaryWrapper, self).__init__(**kwargs) - self.default_program = kwargs.get("default_program", None) + self.default_program = kwargs.get('default_program', None) class Dog(Pet): @@ -441,12 +482,15 @@ class Dog(Pet): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "food": {"key": "food", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'food': {'key': 'food', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -456,7 +500,7 @@ def __init__(self, **kwargs): :paramtype food: str """ super(Dog, self).__init__(**kwargs) - self.food = kwargs.get("food", None) + self.food = kwargs.get('food', None) class DotFish(msrest.serialization.Model): @@ -474,24 +518,29 @@ class DotFish(msrest.serialization.Model): """ _validation = { - "fish_type": {"required": True}, + 'fish_type': {'required': True}, } _attribute_map = { - "fish_type": {"key": "fish\\.type", "type": "str"}, - "species": {"key": "species", "type": "str"}, + 'fish_type': {'key': 'fish\\.type', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, } - _subtype_map = {"fish_type": {"DotSalmon": "DotSalmon"}} + _subtype_map = { + 'fish_type': {'DotSalmon': 'DotSalmon'} + } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str """ super(DotFish, self).__init__(**kwargs) self.fish_type = None # type: Optional[str] - self.species = kwargs.get("species", None) + self.species = kwargs.get('species', None) class DotFishMarket(msrest.serialization.Model): @@ -508,13 +557,16 @@ class DotFishMarket(msrest.serialization.Model): """ _attribute_map = { - "sample_salmon": {"key": "sampleSalmon", "type": "DotSalmon"}, - "salmons": {"key": "salmons", "type": "[DotSalmon]"}, - "sample_fish": {"key": "sampleFish", "type": "DotFish"}, - "fishes": {"key": "fishes", "type": "[DotFish]"}, + 'sample_salmon': {'key': 'sampleSalmon', 'type': 'DotSalmon'}, + 'salmons': {'key': 'salmons', 'type': '[DotSalmon]'}, + 'sample_fish': {'key': 'sampleFish', 'type': 'DotFish'}, + 'fishes': {'key': 'fishes', 'type': '[DotFish]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword sample_salmon: :paramtype sample_salmon: ~bodycomplex.models.DotSalmon @@ -526,10 +578,10 @@ def __init__(self, **kwargs): :paramtype fishes: list[~bodycomplex.models.DotFish] """ super(DotFishMarket, self).__init__(**kwargs) - self.sample_salmon = kwargs.get("sample_salmon", None) - self.salmons = kwargs.get("salmons", None) - self.sample_fish = kwargs.get("sample_fish", None) - self.fishes = kwargs.get("fishes", None) + self.sample_salmon = kwargs.get('sample_salmon', None) + self.salmons = kwargs.get('salmons', None) + self.sample_fish = kwargs.get('sample_fish', None) + self.fishes = kwargs.get('fishes', None) class DotSalmon(DotFish): @@ -548,17 +600,20 @@ class DotSalmon(DotFish): """ _validation = { - "fish_type": {"required": True}, + 'fish_type': {'required': True}, } _attribute_map = { - "fish_type": {"key": "fish\\.type", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, + 'fish_type': {'key': 'fish\\.type', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -568,9 +623,9 @@ def __init__(self, **kwargs): :paramtype iswild: bool """ super(DotSalmon, self).__init__(**kwargs) - self.fish_type = "DotSalmon" # type: str - self.location = kwargs.get("location", None) - self.iswild = kwargs.get("iswild", None) + self.fish_type = 'DotSalmon' # type: str + self.location = kwargs.get('location', None) + self.iswild = kwargs.get('iswild', None) class DoubleWrapper(msrest.serialization.Model): @@ -586,14 +641,14 @@ class DoubleWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "float"}, - "field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": { - "key": "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose", - "type": "float", - }, + 'field1': {'key': 'field1', 'type': 'float'}, + 'field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose': {'key': 'field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field1: :paramtype field1: float @@ -604,13 +659,8 @@ def __init__(self, **kwargs): float """ super(DoubleWrapper, self).__init__(**kwargs) - self.field1 = kwargs.get("field1", None) - self.field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = ( - kwargs.get( - "field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose", - None, - ) - ) + self.field1 = kwargs.get('field1', None) + self.field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = kwargs.get('field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose', None) class DurationWrapper(msrest.serialization.Model): @@ -621,16 +671,19 @@ class DurationWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "duration"}, + 'field': {'key': 'field', 'type': 'duration'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.timedelta """ super(DurationWrapper, self).__init__(**kwargs) - self.field = kwargs.get("field", None) + self.field = kwargs.get('field', None) class Error(msrest.serialization.Model): @@ -643,11 +696,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -655,8 +711,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class FloatWrapper(msrest.serialization.Model): @@ -669,11 +725,14 @@ class FloatWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "float"}, - "field2": {"key": "field2", "type": "float"}, + 'field1': {'key': 'field1', 'type': 'float'}, + 'field2': {'key': 'field2', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field1: :paramtype field1: float @@ -681,8 +740,8 @@ def __init__(self, **kwargs): :paramtype field2: float """ super(FloatWrapper, self).__init__(**kwargs) - self.field1 = kwargs.get("field1", None) - self.field2 = kwargs.get("field2", None) + self.field1 = kwargs.get('field1', None) + self.field2 = kwargs.get('field2', None) class Goblinshark(Shark): @@ -710,23 +769,26 @@ class Goblinshark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, - "jawsize": {"key": "jawsize", "type": "int"}, - "color": {"key": "color", "type": "str"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, + 'jawsize': {'key': 'jawsize', 'type': 'int'}, + 'color': {'key': 'color', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -745,9 +807,9 @@ def __init__(self, **kwargs): :paramtype color: str or ~bodycomplex.models.GoblinSharkColor """ super(Goblinshark, self).__init__(**kwargs) - self.fishtype = "goblin" # type: str - self.jawsize = kwargs.get("jawsize", None) - self.color = kwargs.get("color", "gray") + self.fishtype = 'goblin' # type: str + self.jawsize = kwargs.get('jawsize', None) + self.color = kwargs.get('color', "gray") class IntWrapper(msrest.serialization.Model): @@ -760,11 +822,14 @@ class IntWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "int"}, - "field2": {"key": "field2", "type": "int"}, + 'field1': {'key': 'field1', 'type': 'int'}, + 'field2': {'key': 'field2', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field1: :paramtype field1: int @@ -772,8 +837,8 @@ def __init__(self, **kwargs): :paramtype field2: int """ super(IntWrapper, self).__init__(**kwargs) - self.field1 = kwargs.get("field1", None) - self.field2 = kwargs.get("field2", None) + self.field1 = kwargs.get('field1', None) + self.field2 = kwargs.get('field2', None) class LongWrapper(msrest.serialization.Model): @@ -786,11 +851,14 @@ class LongWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "long"}, - "field2": {"key": "field2", "type": "long"}, + 'field1': {'key': 'field1', 'type': 'long'}, + 'field2': {'key': 'field2', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field1: :paramtype field1: long @@ -798,8 +866,8 @@ def __init__(self, **kwargs): :paramtype field2: long """ super(LongWrapper, self).__init__(**kwargs) - self.field1 = kwargs.get("field1", None) - self.field2 = kwargs.get("field2", None) + self.field1 = kwargs.get('field1', None) + self.field2 = kwargs.get('field2', None) class MyBaseType(msrest.serialization.Model): @@ -819,18 +887,23 @@ class MyBaseType(msrest.serialization.Model): """ _validation = { - "kind": {"required": True}, + 'kind': {'required': True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "prop_b1": {"key": "propB1", "type": "str"}, - "prop_bh1": {"key": "helper.propBH1", "type": "str"}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'prop_b1': {'key': 'propB1', 'type': 'str'}, + 'prop_bh1': {'key': 'helper.propBH1', 'type': 'str'}, } - _subtype_map = {"kind": {"Kind1": "MyDerivedType"}} + _subtype_map = { + 'kind': {'Kind1': 'MyDerivedType'} + } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword prop_b1: :paramtype prop_b1: str @@ -839,8 +912,8 @@ def __init__(self, **kwargs): """ super(MyBaseType, self).__init__(**kwargs) self.kind = None # type: Optional[str] - self.prop_b1 = kwargs.get("prop_b1", None) - self.prop_bh1 = kwargs.get("prop_bh1", None) + self.prop_b1 = kwargs.get('prop_b1', None) + self.prop_bh1 = kwargs.get('prop_bh1', None) class MyDerivedType(MyBaseType): @@ -859,17 +932,20 @@ class MyDerivedType(MyBaseType): """ _validation = { - "kind": {"required": True}, + 'kind': {'required': True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "prop_b1": {"key": "propB1", "type": "str"}, - "prop_bh1": {"key": "helper.propBH1", "type": "str"}, - "prop_d1": {"key": "propD1", "type": "str"}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'prop_b1': {'key': 'propB1', 'type': 'str'}, + 'prop_bh1': {'key': 'helper.propBH1', 'type': 'str'}, + 'prop_d1': {'key': 'propD1', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword prop_b1: :paramtype prop_b1: str @@ -879,8 +955,8 @@ def __init__(self, **kwargs): :paramtype prop_d1: str """ super(MyDerivedType, self).__init__(**kwargs) - self.kind = "Kind1" # type: str - self.prop_d1 = kwargs.get("prop_d1", None) + self.kind = 'Kind1' # type: str + self.prop_d1 = kwargs.get('prop_d1', None) class ReadonlyObj(msrest.serialization.Model): @@ -895,22 +971,25 @@ class ReadonlyObj(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, + 'id': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "size": {"key": "size", "type": "int"}, + 'id': {'key': 'id', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword size: :paramtype size: int """ super(ReadonlyObj, self).__init__(**kwargs) self.id = None - self.size = kwargs.get("size", None) + self.size = kwargs.get('size', None) class Salmon(Fish): @@ -936,22 +1015,27 @@ class Salmon(Fish): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, } - _subtype_map = {"fishtype": {"smart_salmon": "SmartSalmon"}} + _subtype_map = { + 'fishtype': {'smart_salmon': 'SmartSalmon'} + } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -965,9 +1049,9 @@ def __init__(self, **kwargs): :paramtype iswild: bool """ super(Salmon, self).__init__(**kwargs) - self.fishtype = "salmon" # type: str - self.location = kwargs.get("location", None) - self.iswild = kwargs.get("iswild", None) + self.fishtype = 'salmon' # type: str + self.location = kwargs.get('location', None) + self.iswild = kwargs.get('iswild', None) class Sawshark(Shark): @@ -992,22 +1076,25 @@ class Sawshark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, - "picture": {"key": "picture", "type": "bytearray"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, + 'picture': {'key': 'picture', 'type': 'bytearray'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -1023,8 +1110,8 @@ def __init__(self, **kwargs): :paramtype picture: bytearray """ super(Sawshark, self).__init__(**kwargs) - self.fishtype = "sawshark" # type: str - self.picture = kwargs.get("picture", None) + self.fishtype = 'sawshark' # type: str + self.picture = kwargs.get('picture', None) class Siamese(Cat): @@ -1043,14 +1130,17 @@ class Siamese(Cat): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, - "hates": {"key": "hates", "type": "[Dog]"}, - "breed": {"key": "breed", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, + 'hates': {'key': 'hates', 'type': '[Dog]'}, + 'breed': {'key': 'breed', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -1064,7 +1154,7 @@ def __init__(self, **kwargs): :paramtype breed: str """ super(Siamese, self).__init__(**kwargs) - self.breed = kwargs.get("breed", None) + self.breed = kwargs.get('breed', None) class SmartSalmon(Salmon): @@ -1092,22 +1182,25 @@ class SmartSalmon(Salmon): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, - "additional_properties": {"key": "", "type": "{object}"}, - "college_degree": {"key": "college_degree", "type": "str"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'college_degree': {'key': 'college_degree', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -1126,9 +1219,9 @@ def __init__(self, **kwargs): :paramtype college_degree: str """ super(SmartSalmon, self).__init__(**kwargs) - self.fishtype = "smart_salmon" # type: str - self.additional_properties = kwargs.get("additional_properties", None) - self.college_degree = kwargs.get("college_degree", None) + self.fishtype = 'smart_salmon' # type: str + self.additional_properties = kwargs.get('additional_properties', None) + self.college_degree = kwargs.get('college_degree', None) class StringWrapper(msrest.serialization.Model): @@ -1143,12 +1236,15 @@ class StringWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "str"}, - "empty": {"key": "empty", "type": "str"}, - "null": {"key": "null", "type": "str"}, + 'field': {'key': 'field', 'type': 'str'}, + 'empty': {'key': 'empty', 'type': 'str'}, + 'null': {'key': 'null', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field: :paramtype field: str @@ -1158,6 +1254,6 @@ def __init__(self, **kwargs): :paramtype null: str """ super(StringWrapper, self).__init__(**kwargs) - self.field = kwargs.get("field", None) - self.empty = kwargs.get("empty", None) - self.null = kwargs.get("null", None) + self.field = kwargs.get('field', None) + self.empty = kwargs.get('empty', None) + self.null = kwargs.get('null', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models_py3.py index ffa1464339f..0d62973ff0d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_models_py3.py @@ -23,10 +23,15 @@ class ArrayWrapper(msrest.serialization.Model): """ _attribute_map = { - "array": {"key": "array", "type": "[str]"}, + 'array': {'key': 'array', 'type': '[str]'}, } - def __init__(self, *, array: Optional[List[str]] = None, **kwargs): + def __init__( + self, + *, + array: Optional[List[str]] = None, + **kwargs + ): """ :keyword array: :paramtype array: list[str] @@ -48,9 +53,9 @@ class Basic(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, } def __init__( @@ -86,11 +91,17 @@ class BooleanWrapper(msrest.serialization.Model): """ _attribute_map = { - "field_true": {"key": "field_true", "type": "bool"}, - "field_false": {"key": "field_false", "type": "bool"}, + 'field_true': {'key': 'field_true', 'type': 'bool'}, + 'field_false': {'key': 'field_false', 'type': 'bool'}, } - def __init__(self, *, field_true: Optional[bool] = None, field_false: Optional[bool] = None, **kwargs): + def __init__( + self, + *, + field_true: Optional[bool] = None, + field_false: Optional[bool] = None, + **kwargs + ): """ :keyword field_true: :paramtype field_true: bool @@ -110,10 +121,15 @@ class ByteWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "bytearray"}, + 'field': {'key': 'field', 'type': 'bytearray'}, } - def __init__(self, *, field: Optional[bytearray] = None, **kwargs): + def __init__( + self, + *, + field: Optional[bytearray] = None, + **kwargs + ): """ :keyword field: :paramtype field: bytearray @@ -132,11 +148,17 @@ class Pet(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, id: Optional[int] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -162,10 +184,10 @@ class Cat(Pet): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, - "hates": {"key": "hates", "type": "[Dog]"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, + 'hates': {'key': 'hates', 'type': '[Dog]'}, } def __init__( @@ -211,21 +233,28 @@ class Fish(msrest.serialization.Model): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, } - _subtype_map = {"fishtype": {"salmon": "Salmon", "shark": "Shark"}} + _subtype_map = { + 'fishtype': {'salmon': 'Salmon', 'shark': 'Shark'} + } def __init__( - self, *, length: float, species: Optional[str] = None, siblings: Optional[List["Fish"]] = None, **kwargs + self, + *, + length: float, + species: Optional[str] = None, + siblings: Optional[List["Fish"]] = None, + **kwargs ): """ :keyword species: @@ -265,22 +294,22 @@ class Shark(Fish): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, } _subtype_map = { - "fishtype": {"cookiecuttershark": "Cookiecuttershark", "goblin": "Goblinshark", "sawshark": "Sawshark"} + 'fishtype': {'cookiecuttershark': 'Cookiecuttershark', 'goblin': 'Goblinshark', 'sawshark': 'Sawshark'} } def __init__( @@ -306,7 +335,7 @@ def __init__( :paramtype birthday: ~datetime.datetime """ super(Shark, self).__init__(species=species, length=length, siblings=siblings, **kwargs) - self.fishtype = "shark" # type: str + self.fishtype = 'shark' # type: str self.age = age self.birthday = birthday @@ -331,18 +360,18 @@ class Cookiecuttershark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, } def __init__( @@ -367,10 +396,8 @@ def __init__( :keyword birthday: Required. :paramtype birthday: ~datetime.datetime """ - super(Cookiecuttershark, self).__init__( - species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs - ) - self.fishtype = "cookiecuttershark" # type: str + super(Cookiecuttershark, self).__init__(species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs) + self.fishtype = 'cookiecuttershark' # type: str class Datetimerfc1123Wrapper(msrest.serialization.Model): @@ -383,11 +410,17 @@ class Datetimerfc1123Wrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "rfc-1123"}, - "now": {"key": "now", "type": "rfc-1123"}, + 'field': {'key': 'field', 'type': 'rfc-1123'}, + 'now': {'key': 'now', 'type': 'rfc-1123'}, } - def __init__(self, *, field: Optional[datetime.datetime] = None, now: Optional[datetime.datetime] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.datetime] = None, + now: Optional[datetime.datetime] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.datetime @@ -409,11 +442,17 @@ class DatetimeWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "iso-8601"}, - "now": {"key": "now", "type": "iso-8601"}, + 'field': {'key': 'field', 'type': 'iso-8601'}, + 'now': {'key': 'now', 'type': 'iso-8601'}, } - def __init__(self, *, field: Optional[datetime.datetime] = None, now: Optional[datetime.datetime] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.datetime] = None, + now: Optional[datetime.datetime] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.datetime @@ -435,11 +474,17 @@ class DateWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "date"}, - "leap": {"key": "leap", "type": "date"}, + 'field': {'key': 'field', 'type': 'date'}, + 'leap': {'key': 'leap', 'type': 'date'}, } - def __init__(self, *, field: Optional[datetime.date] = None, leap: Optional[datetime.date] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.date] = None, + leap: Optional[datetime.date] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.date @@ -459,10 +504,15 @@ class DictionaryWrapper(msrest.serialization.Model): """ _attribute_map = { - "default_program": {"key": "defaultProgram", "type": "{str}"}, + 'default_program': {'key': 'defaultProgram', 'type': '{str}'}, } - def __init__(self, *, default_program: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + default_program: Optional[Dict[str, str]] = None, + **kwargs + ): """ :keyword default_program: Dictionary of :code:``. :paramtype default_program: dict[str, str] @@ -483,12 +533,19 @@ class Dog(Pet): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "food": {"key": "food", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'food': {'key': 'food', 'type': 'str'}, } - def __init__(self, *, id: Optional[int] = None, name: Optional[str] = None, food: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + food: Optional[str] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -516,17 +573,24 @@ class DotFish(msrest.serialization.Model): """ _validation = { - "fish_type": {"required": True}, + 'fish_type': {'required': True}, } _attribute_map = { - "fish_type": {"key": "fish\\.type", "type": "str"}, - "species": {"key": "species", "type": "str"}, + 'fish_type': {'key': 'fish\\.type', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, } - _subtype_map = {"fish_type": {"DotSalmon": "DotSalmon"}} + _subtype_map = { + 'fish_type': {'DotSalmon': 'DotSalmon'} + } - def __init__(self, *, species: Optional[str] = None, **kwargs): + def __init__( + self, + *, + species: Optional[str] = None, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -550,10 +614,10 @@ class DotFishMarket(msrest.serialization.Model): """ _attribute_map = { - "sample_salmon": {"key": "sampleSalmon", "type": "DotSalmon"}, - "salmons": {"key": "salmons", "type": "[DotSalmon]"}, - "sample_fish": {"key": "sampleFish", "type": "DotFish"}, - "fishes": {"key": "fishes", "type": "[DotFish]"}, + 'sample_salmon': {'key': 'sampleSalmon', 'type': 'DotSalmon'}, + 'salmons': {'key': 'salmons', 'type': '[DotSalmon]'}, + 'sample_fish': {'key': 'sampleFish', 'type': 'DotFish'}, + 'fishes': {'key': 'fishes', 'type': '[DotFish]'}, } def __init__( @@ -598,18 +662,23 @@ class DotSalmon(DotFish): """ _validation = { - "fish_type": {"required": True}, + 'fish_type': {'required': True}, } _attribute_map = { - "fish_type": {"key": "fish\\.type", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, + 'fish_type': {'key': 'fish\\.type', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, } def __init__( - self, *, species: Optional[str] = None, location: Optional[str] = None, iswild: Optional[bool] = None, **kwargs + self, + *, + species: Optional[str] = None, + location: Optional[str] = None, + iswild: Optional[bool] = None, + **kwargs ): """ :keyword species: @@ -620,7 +689,7 @@ def __init__( :paramtype iswild: bool """ super(DotSalmon, self).__init__(species=species, **kwargs) - self.fish_type = "DotSalmon" # type: str + self.fish_type = 'DotSalmon' # type: str self.location = location self.iswild = iswild @@ -638,20 +707,15 @@ class DoubleWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "float"}, - "field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": { - "key": "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose", - "type": "float", - }, + 'field1': {'key': 'field1', 'type': 'float'}, + 'field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose': {'key': 'field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose', 'type': 'float'}, } def __init__( self, *, field1: Optional[float] = None, - field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose: Optional[ - float - ] = None, + field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose: Optional[float] = None, **kwargs ): """ @@ -665,9 +729,7 @@ def __init__( """ super(DoubleWrapper, self).__init__(**kwargs) self.field1 = field1 - self.field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = ( - field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose - ) + self.field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose class DurationWrapper(msrest.serialization.Model): @@ -678,10 +740,15 @@ class DurationWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "duration"}, + 'field': {'key': 'field', 'type': 'duration'}, } - def __init__(self, *, field: Optional[datetime.timedelta] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.timedelta] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.timedelta @@ -700,11 +767,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -726,11 +799,17 @@ class FloatWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "float"}, - "field2": {"key": "field2", "type": "float"}, + 'field1': {'key': 'field1', 'type': 'float'}, + 'field2': {'key': 'field2', 'type': 'float'}, } - def __init__(self, *, field1: Optional[float] = None, field2: Optional[float] = None, **kwargs): + def __init__( + self, + *, + field1: Optional[float] = None, + field2: Optional[float] = None, + **kwargs + ): """ :keyword field1: :paramtype field1: float @@ -767,20 +846,20 @@ class Goblinshark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, - "jawsize": {"key": "jawsize", "type": "int"}, - "color": {"key": "color", "type": "str"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, + 'jawsize': {'key': 'jawsize', 'type': 'int'}, + 'color': {'key': 'color', 'type': 'str'}, } def __init__( @@ -812,10 +891,8 @@ def __init__( "red". Default value: "gray". :paramtype color: str or ~bodycomplex.models.GoblinSharkColor """ - super(Goblinshark, self).__init__( - species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs - ) - self.fishtype = "goblin" # type: str + super(Goblinshark, self).__init__(species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs) + self.fishtype = 'goblin' # type: str self.jawsize = jawsize self.color = color @@ -830,11 +907,17 @@ class IntWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "int"}, - "field2": {"key": "field2", "type": "int"}, + 'field1': {'key': 'field1', 'type': 'int'}, + 'field2': {'key': 'field2', 'type': 'int'}, } - def __init__(self, *, field1: Optional[int] = None, field2: Optional[int] = None, **kwargs): + def __init__( + self, + *, + field1: Optional[int] = None, + field2: Optional[int] = None, + **kwargs + ): """ :keyword field1: :paramtype field1: int @@ -856,11 +939,17 @@ class LongWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "long"}, - "field2": {"key": "field2", "type": "long"}, + 'field1': {'key': 'field1', 'type': 'long'}, + 'field2': {'key': 'field2', 'type': 'long'}, } - def __init__(self, *, field1: Optional[int] = None, field2: Optional[int] = None, **kwargs): + def __init__( + self, + *, + field1: Optional[int] = None, + field2: Optional[int] = None, + **kwargs + ): """ :keyword field1: :paramtype field1: long @@ -889,18 +978,26 @@ class MyBaseType(msrest.serialization.Model): """ _validation = { - "kind": {"required": True}, + 'kind': {'required': True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "prop_b1": {"key": "propB1", "type": "str"}, - "prop_bh1": {"key": "helper.propBH1", "type": "str"}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'prop_b1': {'key': 'propB1', 'type': 'str'}, + 'prop_bh1': {'key': 'helper.propBH1', 'type': 'str'}, } - _subtype_map = {"kind": {"Kind1": "MyDerivedType"}} + _subtype_map = { + 'kind': {'Kind1': 'MyDerivedType'} + } - def __init__(self, *, prop_b1: Optional[str] = None, prop_bh1: Optional[str] = None, **kwargs): + def __init__( + self, + *, + prop_b1: Optional[str] = None, + prop_bh1: Optional[str] = None, + **kwargs + ): """ :keyword prop_b1: :paramtype prop_b1: str @@ -929,18 +1026,23 @@ class MyDerivedType(MyBaseType): """ _validation = { - "kind": {"required": True}, + 'kind': {'required': True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "prop_b1": {"key": "propB1", "type": "str"}, - "prop_bh1": {"key": "helper.propBH1", "type": "str"}, - "prop_d1": {"key": "propD1", "type": "str"}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'prop_b1': {'key': 'propB1', 'type': 'str'}, + 'prop_bh1': {'key': 'helper.propBH1', 'type': 'str'}, + 'prop_d1': {'key': 'propD1', 'type': 'str'}, } def __init__( - self, *, prop_b1: Optional[str] = None, prop_bh1: Optional[str] = None, prop_d1: Optional[str] = None, **kwargs + self, + *, + prop_b1: Optional[str] = None, + prop_bh1: Optional[str] = None, + prop_d1: Optional[str] = None, + **kwargs ): """ :keyword prop_b1: @@ -951,7 +1053,7 @@ def __init__( :paramtype prop_d1: str """ super(MyDerivedType, self).__init__(prop_b1=prop_b1, prop_bh1=prop_bh1, **kwargs) - self.kind = "Kind1" # type: str + self.kind = 'Kind1' # type: str self.prop_d1 = prop_d1 @@ -967,15 +1069,20 @@ class ReadonlyObj(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, + 'id': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "size": {"key": "size", "type": "int"}, + 'id': {'key': 'id', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'int'}, } - def __init__(self, *, size: Optional[int] = None, **kwargs): + def __init__( + self, + *, + size: Optional[int] = None, + **kwargs + ): """ :keyword size: :paramtype size: int @@ -1008,20 +1115,22 @@ class Salmon(Fish): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, } - _subtype_map = {"fishtype": {"smart_salmon": "SmartSalmon"}} + _subtype_map = { + 'fishtype': {'smart_salmon': 'SmartSalmon'} + } def __init__( self, @@ -1046,7 +1155,7 @@ def __init__( :paramtype iswild: bool """ super(Salmon, self).__init__(species=species, length=length, siblings=siblings, **kwargs) - self.fishtype = "salmon" # type: str + self.fishtype = 'salmon' # type: str self.location = location self.iswild = iswild @@ -1073,19 +1182,19 @@ class Sawshark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, - "picture": {"key": "picture", "type": "bytearray"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, + 'picture': {'key': 'picture', 'type': 'bytearray'}, } def __init__( @@ -1113,10 +1222,8 @@ def __init__( :keyword picture: :paramtype picture: bytearray """ - super(Sawshark, self).__init__( - species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs - ) - self.fishtype = "sawshark" # type: str + super(Sawshark, self).__init__(species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs) + self.fishtype = 'sawshark' # type: str self.picture = picture @@ -1136,11 +1243,11 @@ class Siamese(Cat): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, - "hates": {"key": "hates", "type": "[Dog]"}, - "breed": {"key": "breed", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, + 'hates': {'key': 'hates', 'type': '[Dog]'}, + 'breed': {'key': 'breed', 'type': 'str'}, } def __init__( @@ -1194,19 +1301,19 @@ class SmartSalmon(Salmon): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, - "additional_properties": {"key": "", "type": "{object}"}, - "college_degree": {"key": "college_degree", "type": "str"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'college_degree': {'key': 'college_degree', 'type': 'str'}, } def __init__( @@ -1238,10 +1345,8 @@ def __init__( :keyword college_degree: :paramtype college_degree: str """ - super(SmartSalmon, self).__init__( - species=species, length=length, siblings=siblings, location=location, iswild=iswild, **kwargs - ) - self.fishtype = "smart_salmon" # type: str + super(SmartSalmon, self).__init__(species=species, length=length, siblings=siblings, location=location, iswild=iswild, **kwargs) + self.fishtype = 'smart_salmon' # type: str self.additional_properties = additional_properties self.college_degree = college_degree @@ -1258,13 +1363,18 @@ class StringWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "str"}, - "empty": {"key": "empty", "type": "str"}, - "null": {"key": "null", "type": "str"}, + 'field': {'key': 'field', 'type': 'str'}, + 'empty': {'key': 'empty', 'type': 'str'}, + 'null': {'key': 'null', 'type': 'str'}, } def __init__( - self, *, field: Optional[str] = None, empty: Optional[str] = None, null: Optional[str] = None, **kwargs + self, + *, + field: Optional[str] = None, + empty: Optional[str] = None, + null: Optional[str] = None, + **kwargs ): """ :keyword field: diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/__init__.py index ad0a93ac37c..84f771f755a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/__init__.py @@ -17,13 +17,13 @@ from ._flattencomplex_operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py index 35f65decc6a..c06e313721d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -167,7 +159,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ArrayWrapper" """Get complex types with array property. @@ -177,17 +170,24 @@ def get_valid( :rtype: ~bodycomplex.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,14 +195,15 @@ def get_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace def put_valid( @@ -220,24 +221,30 @@ def put_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -248,11 +255,13 @@ def put_valid( if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ArrayWrapper" """Get complex types with array property which is empty. @@ -262,17 +271,24 @@ def get_empty( :rtype: ~bodycomplex.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,14 +296,15 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace def put_empty( @@ -305,24 +322,30 @@ def put_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,11 +356,13 @@ def put_empty( if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace def get_not_provided( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ArrayWrapper" """Get complex types with array property while server doesn't provide a response payload. @@ -347,17 +372,24 @@ def get_not_provided( :rtype: ~bodycomplex.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -365,11 +397,12 @@ def get_not_provided( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/array/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/array/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py index 4576ec91c8d..24919ff4d0d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -189,7 +181,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Basic" """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. @@ -199,17 +192,24 @@ def get_valid( :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -217,14 +217,15 @@ def get_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace def put_valid( @@ -242,25 +243,31 @@ def put_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Basic") + _json = self._serialize.body(complex_body, 'Basic') request = build_put_valid_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -271,11 +278,13 @@ def put_valid( if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Basic" """Get a basic complex type that is invalid for the local strong type. @@ -285,17 +294,24 @@ def get_invalid( :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -303,18 +319,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/complex/basic/invalid"} # type: ignore + get_invalid.metadata = {'url': '/complex/basic/invalid'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Basic" """Get a basic complex type that is empty. @@ -324,17 +342,24 @@ def get_empty( :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -342,18 +367,20 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/basic/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/basic/empty'} # type: ignore + @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Basic" """Get a basic complex type whose properties are null. @@ -363,17 +390,24 @@ def get_null( :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -381,18 +415,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/basic/null"} # type: ignore + get_null.metadata = {'url': '/complex/basic/null'} # type: ignore + @distributed_trace def get_not_provided( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Basic" """Get a basic complex type while the server doesn't provide a response payload. @@ -402,17 +438,24 @@ def get_not_provided( :rtype: ~bodycomplex.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -420,11 +463,12 @@ def get_not_provided( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/basic/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/basic/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py index 23db08e2c5b..95cafa26a89 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -187,7 +179,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DictionaryWrapper" """Get complex types with dictionary property. @@ -197,17 +190,24 @@ def get_valid( :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -215,14 +215,15 @@ def get_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace def put_valid( @@ -240,24 +241,30 @@ def put_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,11 +275,13 @@ def put_valid( if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DictionaryWrapper" """Get complex types with dictionary property which is empty. @@ -282,17 +291,24 @@ def get_empty( :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -300,14 +316,15 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace def put_empty( @@ -325,24 +342,30 @@ def put_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -353,11 +376,13 @@ def put_empty( if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DictionaryWrapper" """Get complex types with dictionary property which is null. @@ -367,17 +392,24 @@ def get_null( :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -385,18 +417,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/dictionary/typed/null"} # type: ignore + get_null.metadata = {'url': '/complex/dictionary/typed/null'} # type: ignore + @distributed_trace def get_not_provided( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DictionaryWrapper" """Get complex types with dictionary property while server doesn't provide a response payload. @@ -406,17 +440,24 @@ def get_not_provided( :rtype: ~bodycomplex.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -424,11 +465,12 @@ def get_not_provided( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/dictionary/typed/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/dictionary/typed/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py index eda82add5c7..9866b4ab5d4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -79,7 +71,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyBaseType" """get_valid. @@ -89,28 +82,36 @@ def get_valid( :rtype: ~bodycomplex.models.MyBaseType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyBaseType"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyBaseType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyBaseType", pipeline_response) + deserialized = self._deserialize('MyBaseType', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/flatten/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/flatten/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py index de72ec8837f..d85d209c690 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -103,7 +95,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Siamese" """Get complex types that extend others. @@ -113,17 +106,24 @@ def get_valid( :rtype: ~bodycomplex.models.Siamese :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Siamese"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Siamese"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,14 +131,15 @@ def get_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Siamese", pipeline_response) + deserialized = self._deserialize('Siamese', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + @distributed_trace def put_valid( @@ -158,23 +159,29 @@ def put_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Siamese") + _json = self._serialize.body(complex_body, 'Siamese') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,4 +192,5 @@ def put_valid( if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py index 645b08ef673..bd6ddc8444b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -103,7 +95,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Fish" """Get complex types that are polymorphic and have recursive references. @@ -113,17 +106,24 @@ def get_valid( :rtype: ~bodycomplex.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,14 +131,15 @@ def get_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + @distributed_trace def put_valid( @@ -208,23 +209,29 @@ def put_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,4 +242,5 @@ def put_valid( if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py index b2dab125e90..4f35b44dc63 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -255,7 +247,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Fish" """Get complex types that are polymorphic. @@ -265,17 +258,24 @@ def get_valid( :rtype: ~bodycomplex.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -283,14 +283,15 @@ def get_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace def put_valid( @@ -340,23 +341,29 @@ def put_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -367,11 +374,13 @@ def put_valid( if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace def get_dot_syntax( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DotFish" """Get complex types that are polymorphic, JSON key contains a dot. @@ -381,17 +390,24 @@ def get_dot_syntax( :rtype: ~bodycomplex.models.DotFish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dot_syntax_request( - template_url=self.get_dot_syntax.metadata["url"], + template_url=self.get_dot_syntax.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -399,18 +415,20 @@ def get_dot_syntax( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFish", pipeline_response) + deserialized = self._deserialize('DotFish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dot_syntax.metadata = {"url": "/complex/polymorphism/dotsyntax"} # type: ignore + get_dot_syntax.metadata = {'url': '/complex/polymorphism/dotsyntax'} # type: ignore + @distributed_trace def get_composed_with_discriminator( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DotFishMarket" """Get complex object composing a polymorphic scalar property and array property with polymorphic @@ -422,17 +440,24 @@ def get_composed_with_discriminator( :rtype: ~bodycomplex.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_with_discriminator_request( - template_url=self.get_composed_with_discriminator.metadata["url"], + template_url=self.get_composed_with_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -440,18 +465,20 @@ def get_composed_with_discriminator( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_with_discriminator.metadata = {"url": "/complex/polymorphism/composedWithDiscriminator"} # type: ignore + get_composed_with_discriminator.metadata = {'url': '/complex/polymorphism/composedWithDiscriminator'} # type: ignore + @distributed_trace def get_composed_without_discriminator( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DotFishMarket" """Get complex object composing a polymorphic scalar property and array property with polymorphic @@ -463,17 +490,24 @@ def get_composed_without_discriminator( :rtype: ~bodycomplex.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_without_discriminator_request( - template_url=self.get_composed_without_discriminator.metadata["url"], + template_url=self.get_composed_without_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -481,18 +515,20 @@ def get_composed_without_discriminator( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_without_discriminator.metadata = {"url": "/complex/polymorphism/composedWithoutDiscriminator"} # type: ignore + get_composed_without_discriminator.metadata = {'url': '/complex/polymorphism/composedWithoutDiscriminator'} # type: ignore + @distributed_trace def get_complicated( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Salmon" """Get complex types that are polymorphic, but not at the root of the hierarchy; also have @@ -503,17 +539,24 @@ def get_complicated( :rtype: ~bodycomplex.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complicated_request( - template_url=self.get_complicated.metadata["url"], + template_url=self.get_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,14 +564,15 @@ def get_complicated( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + get_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace def put_complicated( @@ -547,23 +591,29 @@ def put_complicated( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_complicated_request( content_type=content_type, json=_json, - template_url=self.put_complicated.metadata["url"], + template_url=self.put_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -574,7 +624,8 @@ def put_complicated( if cls: return cls(pipeline_response, None, {}) - put_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + put_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace def put_missing_discriminator( @@ -592,23 +643,29 @@ def put_missing_discriminator( :rtype: ~bodycomplex.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_missing_discriminator_request( content_type=content_type, json=_json, - template_url=self.put_missing_discriminator.metadata["url"], + template_url=self.put_missing_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -616,14 +673,15 @@ def put_missing_discriminator( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_missing_discriminator.metadata = {"url": "/complex/polymorphism/missingdiscriminator"} # type: ignore + put_missing_discriminator.metadata = {'url': '/complex/polymorphism/missingdiscriminator'} # type: ignore + @distributed_trace def put_valid_missing_required( @@ -668,23 +726,29 @@ def put_valid_missing_required( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_missing_required_request( content_type=content_type, json=_json, - template_url=self.put_valid_missing_required.metadata["url"], + template_url=self.put_valid_missing_required.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -695,4 +759,5 @@ def put_valid_missing_required( if cls: return cls(pipeline_response, None, {}) - put_valid_missing_required.metadata = {"url": "/complex/polymorphism/missingrequired/invalid"} # type: ignore + put_valid_missing_required.metadata = {'url': '/complex/polymorphism/missingrequired/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py index 377c77e1d01..0ea416b4287 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -520,7 +512,7 @@ def build_put_byte_request( ) # fmt: on -class PrimitiveOperations(object): +class PrimitiveOperations(object): # pylint: disable=too-many-public-methods """PrimitiveOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -544,7 +536,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_int( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.IntWrapper" """Get complex types with integer properties. @@ -554,17 +547,24 @@ def get_int( :rtype: ~bodycomplex.models.IntWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.IntWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_request( - template_url=self.get_int.metadata["url"], + template_url=self.get_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,14 +572,15 @@ def get_int( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("IntWrapper", pipeline_response) + deserialized = self._deserialize('IntWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + get_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace def put_int( @@ -597,23 +598,29 @@ def put_int( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "IntWrapper") + _json = self._serialize.body(complex_body, 'IntWrapper') request = build_put_int_request( content_type=content_type, json=_json, - template_url=self.put_int.metadata["url"], + template_url=self.put_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -624,11 +631,13 @@ def put_int( if cls: return cls(pipeline_response, None, {}) - put_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + put_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace def get_long( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.LongWrapper" """Get complex types with long properties. @@ -638,17 +647,24 @@ def get_long( :rtype: ~bodycomplex.models.LongWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.LongWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_request( - template_url=self.get_long.metadata["url"], + template_url=self.get_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -656,14 +672,15 @@ def get_long( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("LongWrapper", pipeline_response) + deserialized = self._deserialize('LongWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + get_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace def put_long( @@ -681,23 +698,29 @@ def put_long( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "LongWrapper") + _json = self._serialize.body(complex_body, 'LongWrapper') request = build_put_long_request( content_type=content_type, json=_json, - template_url=self.put_long.metadata["url"], + template_url=self.put_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -708,11 +731,13 @@ def put_long( if cls: return cls(pipeline_response, None, {}) - put_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + put_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace def get_float( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.FloatWrapper" """Get complex types with float properties. @@ -722,17 +747,24 @@ def get_float( :rtype: ~bodycomplex.models.FloatWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.FloatWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.FloatWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_request( - template_url=self.get_float.metadata["url"], + template_url=self.get_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -740,14 +772,15 @@ def get_float( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("FloatWrapper", pipeline_response) + deserialized = self._deserialize('FloatWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + get_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace def put_float( @@ -765,23 +798,29 @@ def put_float( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "FloatWrapper") + _json = self._serialize.body(complex_body, 'FloatWrapper') request = build_put_float_request( content_type=content_type, json=_json, - template_url=self.put_float.metadata["url"], + template_url=self.put_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -792,11 +831,13 @@ def put_float( if cls: return cls(pipeline_response, None, {}) - put_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + put_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace def get_double( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DoubleWrapper" """Get complex types with double properties. @@ -806,17 +847,24 @@ def get_double( :rtype: ~bodycomplex.models.DoubleWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DoubleWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DoubleWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_request( - template_url=self.get_double.metadata["url"], + template_url=self.get_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -824,14 +872,15 @@ def get_double( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DoubleWrapper", pipeline_response) + deserialized = self._deserialize('DoubleWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + get_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace def put_double( @@ -850,23 +899,29 @@ def put_double( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DoubleWrapper") + _json = self._serialize.body(complex_body, 'DoubleWrapper') request = build_put_double_request( content_type=content_type, json=_json, - template_url=self.put_double.metadata["url"], + template_url=self.put_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -877,11 +932,13 @@ def put_double( if cls: return cls(pipeline_response, None, {}) - put_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + put_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace def get_bool( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.BooleanWrapper" """Get complex types with bool properties. @@ -891,17 +948,24 @@ def get_bool( :rtype: ~bodycomplex.models.BooleanWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.BooleanWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.BooleanWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_bool_request( - template_url=self.get_bool.metadata["url"], + template_url=self.get_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -909,14 +973,15 @@ def get_bool( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("BooleanWrapper", pipeline_response) + deserialized = self._deserialize('BooleanWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + get_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace def put_bool( @@ -934,23 +999,29 @@ def put_bool( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "BooleanWrapper") + _json = self._serialize.body(complex_body, 'BooleanWrapper') request = build_put_bool_request( content_type=content_type, json=_json, - template_url=self.put_bool.metadata["url"], + template_url=self.put_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -961,11 +1032,13 @@ def put_bool( if cls: return cls(pipeline_response, None, {}) - put_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + put_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace def get_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.StringWrapper" """Get complex types with string properties. @@ -975,17 +1048,24 @@ def get_string( :rtype: ~bodycomplex.models.StringWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StringWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StringWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_request( - template_url=self.get_string.metadata["url"], + template_url=self.get_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -993,14 +1073,15 @@ def get_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("StringWrapper", pipeline_response) + deserialized = self._deserialize('StringWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + get_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace def put_string( @@ -1018,23 +1099,29 @@ def put_string( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "StringWrapper") + _json = self._serialize.body(complex_body, 'StringWrapper') request = build_put_string_request( content_type=content_type, json=_json, - template_url=self.put_string.metadata["url"], + template_url=self.put_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1045,11 +1132,13 @@ def put_string( if cls: return cls(pipeline_response, None, {}) - put_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + put_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace def get_date( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DateWrapper" """Get complex types with date properties. @@ -1059,17 +1148,24 @@ def get_date( :rtype: ~bodycomplex.models.DateWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DateWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DateWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_request( - template_url=self.get_date.metadata["url"], + template_url=self.get_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1077,14 +1173,15 @@ def get_date( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DateWrapper", pipeline_response) + deserialized = self._deserialize('DateWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + get_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace def put_date( @@ -1102,23 +1199,29 @@ def put_date( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DateWrapper") + _json = self._serialize.body(complex_body, 'DateWrapper') request = build_put_date_request( content_type=content_type, json=_json, - template_url=self.put_date.metadata["url"], + template_url=self.put_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1129,11 +1232,13 @@ def put_date( if cls: return cls(pipeline_response, None, {}) - put_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + put_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace def get_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DatetimeWrapper" """Get complex types with datetime properties. @@ -1143,17 +1248,24 @@ def get_date_time( :rtype: ~bodycomplex.models.DatetimeWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DatetimeWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatetimeWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_request( - template_url=self.get_date_time.metadata["url"], + template_url=self.get_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1161,14 +1273,15 @@ def get_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DatetimeWrapper", pipeline_response) + deserialized = self._deserialize('DatetimeWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + get_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace def put_date_time( @@ -1186,23 +1299,29 @@ def put_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DatetimeWrapper") + _json = self._serialize.body(complex_body, 'DatetimeWrapper') request = build_put_date_time_request( content_type=content_type, json=_json, - template_url=self.put_date_time.metadata["url"], + template_url=self.put_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1213,11 +1332,13 @@ def put_date_time( if cls: return cls(pipeline_response, None, {}) - put_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + put_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace def get_date_time_rfc1123( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Datetimerfc1123Wrapper" """Get complex types with datetimeRfc1123 properties. @@ -1227,17 +1348,24 @@ def get_date_time_rfc1123( :rtype: ~bodycomplex.models.Datetimerfc1123Wrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Datetimerfc1123Wrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datetimerfc1123Wrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_request( - template_url=self.get_date_time_rfc1123.metadata["url"], + template_url=self.get_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1245,14 +1373,15 @@ def get_date_time_rfc1123( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Datetimerfc1123Wrapper", pipeline_response) + deserialized = self._deserialize('Datetimerfc1123Wrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + get_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace def put_date_time_rfc1123( @@ -1271,23 +1400,29 @@ def put_date_time_rfc1123( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Datetimerfc1123Wrapper") + _json = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') request = build_put_date_time_rfc1123_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123.metadata["url"], + template_url=self.put_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1298,11 +1433,13 @@ def put_date_time_rfc1123( if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + put_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace def get_duration( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.DurationWrapper" """Get complex types with duration properties. @@ -1312,17 +1449,24 @@ def get_duration( :rtype: ~bodycomplex.models.DurationWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DurationWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DurationWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_request( - template_url=self.get_duration.metadata["url"], + template_url=self.get_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1330,14 +1474,15 @@ def get_duration( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DurationWrapper", pipeline_response) + deserialized = self._deserialize('DurationWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + get_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace def put_duration( @@ -1355,24 +1500,30 @@ def put_duration( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DurationWrapper(field=field) - _json = self._serialize.body(_complex_body, "DurationWrapper") + _json = self._serialize.body(_complex_body, 'DurationWrapper') request = build_put_duration_request( content_type=content_type, json=_json, - template_url=self.put_duration.metadata["url"], + template_url=self.put_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1383,11 +1534,13 @@ def put_duration( if cls: return cls(pipeline_response, None, {}) - put_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + put_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace def get_byte( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ByteWrapper" """Get complex types with byte properties. @@ -1397,17 +1550,24 @@ def get_byte( :rtype: ~bodycomplex.models.ByteWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ByteWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ByteWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_request( - template_url=self.get_byte.metadata["url"], + template_url=self.get_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1415,14 +1575,15 @@ def get_byte( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ByteWrapper", pipeline_response) + deserialized = self._deserialize('ByteWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + get_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + @distributed_trace def put_byte( @@ -1440,24 +1601,30 @@ def put_byte( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ByteWrapper(field=field) - _json = self._serialize.body(_complex_body, "ByteWrapper") + _json = self._serialize.body(_complex_body, 'ByteWrapper') request = build_put_byte_request( content_type=content_type, json=_json, - template_url=self.put_byte.metadata["url"], + template_url=self.put_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1468,4 +1635,5 @@ def put_byte( if cls: return cls(pipeline_response, None, {}) - put_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + put_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py index 269f0ce84ea..a3ecb831da7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -103,7 +95,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ReadonlyObj" """Get complex types that have readonly properties. @@ -113,17 +106,24 @@ def get_valid( :rtype: ~bodycomplex.models.ReadonlyObj :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ReadonlyObj"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReadonlyObj"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,14 +131,15 @@ def get_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ReadonlyObj", pipeline_response) + deserialized = self._deserialize('ReadonlyObj', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + @distributed_trace def put_valid( @@ -156,24 +157,30 @@ def put_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ReadonlyObj(size=size) - _json = self._serialize.body(_complex_body, "ReadonlyObj") + _json = self._serialize.body(_complex_body, 'ReadonlyObj') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -184,4 +191,5 @@ def put_valid( if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py index ea77baa0fb5..ab429f6939d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/__init__.py index fd3f96ec0e5..f0dfc13a72f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py index 40668c2eeda..e2614e4ad93 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional +from typing import Any from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -15,20 +15,9 @@ from . import models from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) - - -class AutoRestComplexTestService: +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations + +class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -56,7 +45,11 @@ class AutoRestComplexTestService: :paramtype api_version: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -70,14 +63,11 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_configuration.py index 42e0a7b3f53..53dbd1d6018 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_configuration.py @@ -14,34 +14,40 @@ from ._version import VERSION -class AutoRestComplexTestServiceConfiguration(Configuration): +class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestComplexTestService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "bodycomplexpython3only/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodycomplexpython3only/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/__init__.py index 4c5493d4555..a5cab1e6f99 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_complex_test_service import AutoRestComplexTestService - -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py index 1b95cfb28fc..539b24e280b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -15,20 +15,9 @@ from .. import models from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) - - -class AutoRestComplexTestService: +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations + +class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -57,7 +46,11 @@ class AutoRestComplexTestService: :paramtype api_version: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -71,15 +64,16 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_configuration.py index bee45666e52..93fb380cc81 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_configuration.py @@ -14,31 +14,39 @@ from .._version import VERSION -class AutoRestComplexTestServiceConfiguration(Configuration): +class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestComplexTestService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "bodycomplexpython3only/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodycomplexpython3only/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/__init__.py index ad0a93ac37c..84f771f755a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/__init__.py @@ -17,13 +17,13 @@ from ._flattencomplex_operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_array_operations.py index 904c76108e7..9d7583baa58 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,18 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._array_operations import ( - build_get_empty_request, - build_get_not_provided_request, - build_get_valid_request, - build_put_empty_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._array_operations import build_get_empty_request, build_get_not_provided_request, build_get_valid_request, build_put_empty_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ArrayOperations: """ArrayOperations async operations. @@ -58,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -66,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplexpython3only.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: + async def put_valid( + self, + array: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Put complex types with array property. :param array: @@ -104,24 +104,30 @@ async def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,10 +138,14 @@ async def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": + async def get_empty( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property which is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -143,17 +153,24 @@ async def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplexpython3only.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,17 +178,22 @@ async def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: + async def put_empty( + self, + array: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Put complex types with array property which is empty. :param array: @@ -181,24 +203,30 @@ async def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,10 +237,14 @@ async def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": + async def get_not_provided( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property while server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -220,17 +252,24 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplexpython3only.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -238,11 +277,12 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/array/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/array/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_basic_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_basic_operations.py index 29c2c9b9835..ef2d95e370c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_basic_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_basic_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,19 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._basic_operations import ( - build_get_empty_request, - build_get_invalid_request, - build_get_not_provided_request, - build_get_null_request, - build_get_valid_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._basic_operations import build_get_empty_request, build_get_invalid_request, build_get_not_provided_request, build_get_null_request, build_get_valid_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class BasicOperations: """BasicOperations async operations. @@ -59,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Basic": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Basic": """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -67,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Basic", + **kwargs: Any + ) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. @@ -105,25 +104,31 @@ async def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Basic") + _json = self._serialize.body(complex_body, 'Basic') request = build_put_valid_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -134,10 +139,14 @@ async def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> "_models.Basic": + async def get_invalid( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type that is invalid for the local strong type. :keyword callable cls: A custom type or function that will be passed the direct response @@ -145,17 +154,24 @@ async def get_invalid(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,17 +179,21 @@ async def get_invalid(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/complex/basic/invalid"} # type: ignore + get_invalid.metadata = {'url': '/complex/basic/invalid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> "_models.Basic": + async def get_empty( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type that is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -181,17 +201,24 @@ async def get_empty(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -199,17 +226,21 @@ async def get_empty(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/basic/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/basic/empty'} # type: ignore + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> "_models.Basic": + async def get_null( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type whose properties are null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -217,17 +248,24 @@ async def get_null(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,17 +273,21 @@ async def get_null(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/basic/null"} # type: ignore + get_null.metadata = {'url': '/complex/basic/null'} # type: ignore + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> "_models.Basic": + async def get_not_provided( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type while the server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -253,17 +295,24 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -271,11 +320,12 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/basic/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/basic/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_dictionary_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_dictionary_operations.py index 3f5c317002d..995ef4f10f6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_dictionary_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_dictionary_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,19 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._dictionary_operations import ( - build_get_empty_request, - build_get_not_provided_request, - build_get_null_request, - build_get_valid_request, - build_put_empty_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._dictionary_operations import build_get_empty_request, build_get_not_provided_request, build_get_null_request, build_get_valid_request, build_put_empty_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DictionaryOperations: """DictionaryOperations async operations. @@ -59,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -67,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + async def put_valid( + self, + default_program: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """Put complex types with dictionary property. :param default_program: Dictionary of :code:``. @@ -105,24 +104,30 @@ async def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,10 +138,14 @@ async def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kw if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_empty( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property which is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,17 +153,24 @@ async def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -162,17 +178,22 @@ async def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + async def put_empty( + self, + default_program: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """Put complex types with dictionary property which is empty. :param default_program: Dictionary of :code:``. @@ -182,24 +203,30 @@ async def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -210,10 +237,14 @@ async def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kw if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_null( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property which is null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -221,17 +252,24 @@ async def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,17 +277,21 @@ async def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/dictionary/typed/null"} # type: ignore + get_null.metadata = {'url': '/complex/dictionary/typed/null'} # type: ignore + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": + async def get_not_provided( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property while server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -257,17 +299,24 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -275,11 +324,12 @@ async def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/dictionary/typed/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/dictionary/typed/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_flattencomplex_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_flattencomplex_operations.py index 401d9d538a8..12e8dc5b85a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_flattencomplex_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_flattencomplex_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._flattencomplex_operations import build_get_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FlattencomplexOperations: """FlattencomplexOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.MyBaseType": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.MyBaseType": """get_valid. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,28 +54,36 @@ async def get_valid(self, **kwargs: Any) -> "_models.MyBaseType": :rtype: ~bodycomplexpython3only.models.MyBaseType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyBaseType"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyBaseType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyBaseType", pipeline_response) + deserialized = self._deserialize('MyBaseType', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/flatten/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/flatten/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_inheritance_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_inheritance_operations.py index c77fa713660..fde354469f3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_inheritance_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_inheritance_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._inheritance_operations import build_get_valid_request, build_put_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class InheritanceOperations: """InheritanceOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Siamese": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Siamese": """Get complex types that extend others. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Siamese": :rtype: ~bodycomplexpython3only.models.Siamese :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Siamese"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Siamese"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -78,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Siamese": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Siamese", pipeline_response) + deserialized = self._deserialize('Siamese', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Siamese", + **kwargs: Any + ) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, @@ -100,23 +106,29 @@ async def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Siamese") + _json = self._serialize.body(complex_body, 'Siamese') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,4 +139,5 @@ async def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphicrecursive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphicrecursive_operations.py index 8f03d009fc9..8b961bbbb43 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphicrecursive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphicrecursive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._polymorphicrecursive_operations import build_get_valid_request, build_put_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PolymorphicrecursiveOperations: """PolymorphicrecursiveOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Fish": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Fish": """Get complex types that are polymorphic and have recursive references. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": :rtype: ~bodycomplexpython3only.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -78,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -150,23 +156,29 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,4 +189,5 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphism_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphism_operations.py index b5296bfbe31..7732c09978f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphism_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_polymorphism_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,22 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._polymorphism_operations import ( - build_get_complicated_request, - build_get_composed_with_discriminator_request, - build_get_composed_without_discriminator_request, - build_get_dot_syntax_request, - build_get_valid_request, - build_put_complicated_request, - build_put_missing_discriminator_request, - build_put_valid_missing_required_request, - build_put_valid_request, -) - -T = TypeVar("T") +from ...operations._polymorphism_operations import build_get_complicated_request, build_get_composed_with_discriminator_request, build_get_composed_without_discriminator_request, build_get_dot_syntax_request, build_get_valid_request, build_put_complicated_request, build_put_missing_discriminator_request, build_put_valid_missing_required_request, build_put_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PolymorphismOperations: """PolymorphismOperations async operations. @@ -62,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.Fish": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.Fish": """Get complex types that are polymorphic. :keyword callable cls: A custom type or function that will be passed the direct response @@ -70,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": :rtype: ~bodycomplexpython3only.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.Fish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -140,23 +136,29 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -167,10 +169,14 @@ async def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace_async - async def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": + async def get_dot_syntax( + self, + **kwargs: Any + ) -> "_models.DotFish": """Get complex types that are polymorphic, JSON key contains a dot. :keyword callable cls: A custom type or function that will be passed the direct response @@ -178,17 +184,24 @@ async def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": :rtype: ~bodycomplexpython3only.models.DotFish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dot_syntax_request( - template_url=self.get_dot_syntax.metadata["url"], + template_url=self.get_dot_syntax.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -196,17 +209,21 @@ async def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFish", pipeline_response) + deserialized = self._deserialize('DotFish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dot_syntax.metadata = {"url": "/complex/polymorphism/dotsyntax"} # type: ignore + get_dot_syntax.metadata = {'url': '/complex/polymorphism/dotsyntax'} # type: ignore + @distributed_trace_async - async def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFishMarket": + async def get_composed_with_discriminator( + self, + **kwargs: Any + ) -> "_models.DotFishMarket": """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -216,17 +233,24 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFi :rtype: ~bodycomplexpython3only.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_with_discriminator_request( - template_url=self.get_composed_with_discriminator.metadata["url"], + template_url=self.get_composed_with_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -234,17 +258,21 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFi error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_with_discriminator.metadata = {"url": "/complex/polymorphism/composedWithDiscriminator"} # type: ignore + get_composed_with_discriminator.metadata = {'url': '/complex/polymorphism/composedWithDiscriminator'} # type: ignore + @distributed_trace_async - async def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.DotFishMarket": + async def get_composed_without_discriminator( + self, + **kwargs: Any + ) -> "_models.DotFishMarket": """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -254,17 +282,24 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.Do :rtype: ~bodycomplexpython3only.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_without_discriminator_request( - template_url=self.get_composed_without_discriminator.metadata["url"], + template_url=self.get_composed_without_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,17 +307,21 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.Do error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_without_discriminator.metadata = {"url": "/complex/polymorphism/composedWithoutDiscriminator"} # type: ignore + get_composed_without_discriminator.metadata = {'url': '/complex/polymorphism/composedWithoutDiscriminator'} # type: ignore + @distributed_trace_async - async def get_complicated(self, **kwargs: Any) -> "_models.Salmon": + async def get_complicated( + self, + **kwargs: Any + ) -> "_models.Salmon": """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -291,17 +330,24 @@ async def get_complicated(self, **kwargs: Any) -> "_models.Salmon": :rtype: ~bodycomplexpython3only.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complicated_request( - template_url=self.get_complicated.metadata["url"], + template_url=self.get_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -309,17 +355,22 @@ async def get_complicated(self, **kwargs: Any) -> "_models.Salmon": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + get_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace_async - async def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) -> None: + async def put_complicated( + self, + complex_body: "_models.Salmon", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -330,23 +381,29 @@ async def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_complicated_request( content_type=content_type, json=_json, - template_url=self.put_complicated.metadata["url"], + template_url=self.put_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -357,10 +414,15 @@ async def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + put_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace_async - async def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwargs: Any) -> "_models.Salmon": + async def put_missing_discriminator( + self, + complex_body: "_models.Salmon", + **kwargs: Any + ) -> "_models.Salmon": """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: @@ -370,23 +432,29 @@ async def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwar :rtype: ~bodycomplexpython3only.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_missing_discriminator_request( content_type=content_type, json=_json, - template_url=self.put_missing_discriminator.metadata["url"], + template_url=self.put_missing_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -394,17 +462,22 @@ async def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwar error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_missing_discriminator.metadata = {"url": "/complex/polymorphism/missingdiscriminator"} # type: ignore + put_missing_discriminator.metadata = {'url': '/complex/polymorphism/missingdiscriminator'} # type: ignore + @distributed_trace_async - async def put_valid_missing_required(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + async def put_valid_missing_required( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -441,23 +514,29 @@ async def put_valid_missing_required(self, complex_body: "_models.Fish", **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_missing_required_request( content_type=content_type, json=_json, - template_url=self.put_valid_missing_required.metadata["url"], + template_url=self.put_valid_missing_required.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -468,4 +547,5 @@ async def put_valid_missing_required(self, complex_body: "_models.Fish", **kwarg if cls: return cls(pipeline_response, None, {}) - put_valid_missing_required.metadata = {"url": "/complex/polymorphism/missingrequired/invalid"} # type: ignore + put_valid_missing_required.metadata = {'url': '/complex/polymorphism/missingrequired/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_primitive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_primitive_operations.py index 78bd4614534..d1fc90cf2fb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_primitive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_primitive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,36 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._primitive_operations import ( - build_get_bool_request, - build_get_byte_request, - build_get_date_request, - build_get_date_time_request, - build_get_date_time_rfc1123_request, - build_get_double_request, - build_get_duration_request, - build_get_float_request, - build_get_int_request, - build_get_long_request, - build_get_string_request, - build_put_bool_request, - build_put_byte_request, - build_put_date_request, - build_put_date_time_request, - build_put_date_time_rfc1123_request, - build_put_double_request, - build_put_duration_request, - build_put_float_request, - build_put_int_request, - build_put_long_request, - build_put_string_request, -) - -T = TypeVar("T") +from ...operations._primitive_operations import build_get_bool_request, build_get_byte_request, build_get_date_request, build_get_date_time_request, build_get_date_time_rfc1123_request, build_get_double_request, build_get_duration_request, build_get_float_request, build_get_int_request, build_get_long_request, build_get_string_request, build_put_bool_request, build_put_byte_request, build_put_date_request, build_put_date_time_request, build_put_date_time_rfc1123_request, build_put_double_request, build_put_duration_request, build_put_float_request, build_put_int_request, build_put_long_request, build_put_string_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class PrimitiveOperations: +class PrimitiveOperations: # pylint: disable=too-many-public-methods """PrimitiveOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -76,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_int(self, **kwargs: Any) -> "_models.IntWrapper": + async def get_int( + self, + **kwargs: Any + ) -> "_models.IntWrapper": """Get complex types with integer properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -84,17 +55,24 @@ async def get_int(self, **kwargs: Any) -> "_models.IntWrapper": :rtype: ~bodycomplexpython3only.models.IntWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.IntWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_request( - template_url=self.get_int.metadata["url"], + template_url=self.get_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,17 +80,22 @@ async def get_int(self, **kwargs: Any) -> "_models.IntWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("IntWrapper", pipeline_response) + deserialized = self._deserialize('IntWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + get_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace_async - async def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> None: + async def put_int( + self, + complex_body: "_models.IntWrapper", + **kwargs: Any + ) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. @@ -122,23 +105,29 @@ async def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "IntWrapper") + _json = self._serialize.body(complex_body, 'IntWrapper') request = build_put_int_request( content_type=content_type, json=_json, - template_url=self.put_int.metadata["url"], + template_url=self.put_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -149,10 +138,14 @@ async def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + put_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace_async - async def get_long(self, **kwargs: Any) -> "_models.LongWrapper": + async def get_long( + self, + **kwargs: Any + ) -> "_models.LongWrapper": """Get complex types with long properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -160,17 +153,24 @@ async def get_long(self, **kwargs: Any) -> "_models.LongWrapper": :rtype: ~bodycomplexpython3only.models.LongWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.LongWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_request( - template_url=self.get_long.metadata["url"], + template_url=self.get_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,17 +178,22 @@ async def get_long(self, **kwargs: Any) -> "_models.LongWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("LongWrapper", pipeline_response) + deserialized = self._deserialize('LongWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + get_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace_async - async def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> None: + async def put_long( + self, + complex_body: "_models.LongWrapper", + **kwargs: Any + ) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. @@ -198,23 +203,29 @@ async def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "LongWrapper") + _json = self._serialize.body(complex_body, 'LongWrapper') request = build_put_long_request( content_type=content_type, json=_json, - template_url=self.put_long.metadata["url"], + template_url=self.put_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -225,10 +236,14 @@ async def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + put_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace_async - async def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": + async def get_float( + self, + **kwargs: Any + ) -> "_models.FloatWrapper": """Get complex types with float properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -236,17 +251,24 @@ async def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": :rtype: ~bodycomplexpython3only.models.FloatWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.FloatWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.FloatWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_request( - template_url=self.get_float.metadata["url"], + template_url=self.get_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -254,17 +276,22 @@ async def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("FloatWrapper", pipeline_response) + deserialized = self._deserialize('FloatWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + get_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace_async - async def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) -> None: + async def put_float( + self, + complex_body: "_models.FloatWrapper", + **kwargs: Any + ) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. @@ -274,23 +301,29 @@ async def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "FloatWrapper") + _json = self._serialize.body(complex_body, 'FloatWrapper') request = build_put_float_request( content_type=content_type, json=_json, - template_url=self.put_float.metadata["url"], + template_url=self.put_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -301,10 +334,14 @@ async def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + put_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace_async - async def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": + async def get_double( + self, + **kwargs: Any + ) -> "_models.DoubleWrapper": """Get complex types with double properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -312,17 +349,24 @@ async def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": :rtype: ~bodycomplexpython3only.models.DoubleWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DoubleWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DoubleWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_request( - template_url=self.get_double.metadata["url"], + template_url=self.get_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -330,17 +374,22 @@ async def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DoubleWrapper", pipeline_response) + deserialized = self._deserialize('DoubleWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + get_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace_async - async def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) -> None: + async def put_double( + self, + complex_body: "_models.DoubleWrapper", + **kwargs: Any + ) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and @@ -351,23 +400,29 @@ async def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DoubleWrapper") + _json = self._serialize.body(complex_body, 'DoubleWrapper') request = build_put_double_request( content_type=content_type, json=_json, - template_url=self.put_double.metadata["url"], + template_url=self.put_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,10 +433,14 @@ async def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + put_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace_async - async def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": + async def get_bool( + self, + **kwargs: Any + ) -> "_models.BooleanWrapper": """Get complex types with bool properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -389,17 +448,24 @@ async def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": :rtype: ~bodycomplexpython3only.models.BooleanWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.BooleanWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.BooleanWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_bool_request( - template_url=self.get_bool.metadata["url"], + template_url=self.get_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -407,17 +473,22 @@ async def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("BooleanWrapper", pipeline_response) + deserialized = self._deserialize('BooleanWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + get_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace_async - async def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) -> None: + async def put_bool( + self, + complex_body: "_models.BooleanWrapper", + **kwargs: Any + ) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. @@ -427,23 +498,29 @@ async def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "BooleanWrapper") + _json = self._serialize.body(complex_body, 'BooleanWrapper') request = build_put_bool_request( content_type=content_type, json=_json, - template_url=self.put_bool.metadata["url"], + template_url=self.put_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -454,10 +531,14 @@ async def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + put_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace_async - async def get_string(self, **kwargs: Any) -> "_models.StringWrapper": + async def get_string( + self, + **kwargs: Any + ) -> "_models.StringWrapper": """Get complex types with string properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -465,17 +546,24 @@ async def get_string(self, **kwargs: Any) -> "_models.StringWrapper": :rtype: ~bodycomplexpython3only.models.StringWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StringWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StringWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_request( - template_url=self.get_string.metadata["url"], + template_url=self.get_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -483,17 +571,22 @@ async def get_string(self, **kwargs: Any) -> "_models.StringWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("StringWrapper", pipeline_response) + deserialized = self._deserialize('StringWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + get_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace_async - async def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) -> None: + async def put_string( + self, + complex_body: "_models.StringWrapper", + **kwargs: Any + ) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. @@ -503,23 +596,29 @@ async def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "StringWrapper") + _json = self._serialize.body(complex_body, 'StringWrapper') request = build_put_string_request( content_type=content_type, json=_json, - template_url=self.put_string.metadata["url"], + template_url=self.put_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -530,10 +629,14 @@ async def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + put_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace_async - async def get_date(self, **kwargs: Any) -> "_models.DateWrapper": + async def get_date( + self, + **kwargs: Any + ) -> "_models.DateWrapper": """Get complex types with date properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -541,17 +644,24 @@ async def get_date(self, **kwargs: Any) -> "_models.DateWrapper": :rtype: ~bodycomplexpython3only.models.DateWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DateWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DateWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_request( - template_url=self.get_date.metadata["url"], + template_url=self.get_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -559,17 +669,22 @@ async def get_date(self, **kwargs: Any) -> "_models.DateWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DateWrapper", pipeline_response) + deserialized = self._deserialize('DateWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + get_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace_async - async def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> None: + async def put_date( + self, + complex_body: "_models.DateWrapper", + **kwargs: Any + ) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. @@ -579,23 +694,29 @@ async def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DateWrapper") + _json = self._serialize.body(complex_body, 'DateWrapper') request = build_put_date_request( content_type=content_type, json=_json, - template_url=self.put_date.metadata["url"], + template_url=self.put_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,10 +727,14 @@ async def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + put_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace_async - async def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": + async def get_date_time( + self, + **kwargs: Any + ) -> "_models.DatetimeWrapper": """Get complex types with datetime properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -617,17 +742,24 @@ async def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": :rtype: ~bodycomplexpython3only.models.DatetimeWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DatetimeWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatetimeWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_request( - template_url=self.get_date_time.metadata["url"], + template_url=self.get_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -635,17 +767,22 @@ async def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DatetimeWrapper", pipeline_response) + deserialized = self._deserialize('DatetimeWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + get_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace_async - async def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: Any) -> None: + async def put_date_time( + self, + complex_body: "_models.DatetimeWrapper", + **kwargs: Any + ) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -655,23 +792,29 @@ async def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DatetimeWrapper") + _json = self._serialize.body(complex_body, 'DatetimeWrapper') request = build_put_date_time_request( content_type=content_type, json=_json, - template_url=self.put_date_time.metadata["url"], + template_url=self.put_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -682,10 +825,14 @@ async def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: if cls: return cls(pipeline_response, None, {}) - put_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + put_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace_async - async def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123Wrapper": + async def get_date_time_rfc1123( + self, + **kwargs: Any + ) -> "_models.Datetimerfc1123Wrapper": """Get complex types with datetimeRfc1123 properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -693,17 +840,24 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123 :rtype: ~bodycomplexpython3only.models.Datetimerfc1123Wrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Datetimerfc1123Wrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datetimerfc1123Wrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_request( - template_url=self.get_date_time_rfc1123.metadata["url"], + template_url=self.get_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,17 +865,22 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123 error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Datetimerfc1123Wrapper", pipeline_response) + deserialized = self._deserialize('Datetimerfc1123Wrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + get_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace_async - async def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrapper", **kwargs: Any) -> None: + async def put_date_time_rfc1123( + self, + complex_body: "_models.Datetimerfc1123Wrapper", + **kwargs: Any + ) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 @@ -732,23 +891,29 @@ async def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrap :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Datetimerfc1123Wrapper") + _json = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') request = build_put_date_time_rfc1123_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123.metadata["url"], + template_url=self.put_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -759,10 +924,14 @@ async def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrap if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + put_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace_async - async def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": + async def get_duration( + self, + **kwargs: Any + ) -> "_models.DurationWrapper": """Get complex types with duration properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -770,17 +939,24 @@ async def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": :rtype: ~bodycomplexpython3only.models.DurationWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DurationWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DurationWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_request( - template_url=self.get_duration.metadata["url"], + template_url=self.get_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -788,17 +964,22 @@ async def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DurationWrapper", pipeline_response) + deserialized = self._deserialize('DurationWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + get_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace_async - async def put_duration(self, field: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: + async def put_duration( + self, + field: Optional[datetime.timedelta] = None, + **kwargs: Any + ) -> None: """Put complex types with duration properties. :param field: @@ -808,24 +989,30 @@ async def put_duration(self, field: Optional[datetime.timedelta] = None, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DurationWrapper(field=field) - _json = self._serialize.body(_complex_body, "DurationWrapper") + _json = self._serialize.body(_complex_body, 'DurationWrapper') request = build_put_duration_request( content_type=content_type, json=_json, - template_url=self.put_duration.metadata["url"], + template_url=self.put_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -836,10 +1023,14 @@ async def put_duration(self, field: Optional[datetime.timedelta] = None, **kwarg if cls: return cls(pipeline_response, None, {}) - put_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + put_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace_async - async def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": + async def get_byte( + self, + **kwargs: Any + ) -> "_models.ByteWrapper": """Get complex types with byte properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -847,17 +1038,24 @@ async def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": :rtype: ~bodycomplexpython3only.models.ByteWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ByteWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ByteWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_request( - template_url=self.get_byte.metadata["url"], + template_url=self.get_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -865,17 +1063,22 @@ async def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ByteWrapper", pipeline_response) + deserialized = self._deserialize('ByteWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + get_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + @distributed_trace_async - async def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> None: + async def put_byte( + self, + field: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Put complex types with byte properties. :param field: @@ -885,24 +1088,30 @@ async def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ByteWrapper(field=field) - _json = self._serialize.body(_complex_body, "ByteWrapper") + _json = self._serialize.body(_complex_body, 'ByteWrapper') request = build_put_byte_request( content_type=content_type, json=_json, - template_url=self.put_byte.metadata["url"], + template_url=self.put_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -913,4 +1122,5 @@ async def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + put_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_readonlyproperty_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_readonlyproperty_operations.py index 80e50c53501..a9f259d6846 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_readonlyproperty_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/operations/_readonlyproperty_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._readonlyproperty_operations import build_get_valid_request, build_put_valid_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ReadonlypropertyOperations: """ReadonlypropertyOperations async operations. @@ -52,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": + async def get_valid( + self, + **kwargs: Any + ) -> "_models.ReadonlyObj": """Get complex types that have readonly properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -60,17 +54,24 @@ async def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": :rtype: ~bodycomplexpython3only.models.ReadonlyObj :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ReadonlyObj"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReadonlyObj"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -78,17 +79,22 @@ async def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ReadonlyObj", pipeline_response) + deserialized = self._deserialize('ReadonlyObj', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + @distributed_trace_async - async def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: + async def put_valid( + self, + size: Optional[int] = None, + **kwargs: Any + ) -> None: """Put complex types that have readonly properties. :param size: @@ -98,24 +104,30 @@ async def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ReadonlyObj(size=size) - _json = self._serialize.body(_complex_body, "ReadonlyObj") + _json = self._serialize.body(_complex_body, 'ReadonlyObj') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,4 +138,5 @@ async def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/__init__.py index b2aada57e11..ec9e445f76a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/__init__.py @@ -47,39 +47,39 @@ ) __all__ = [ - "ArrayWrapper", - "Basic", - "BooleanWrapper", - "ByteWrapper", - "Cat", - "Cookiecuttershark", - "DateWrapper", - "DatetimeWrapper", - "Datetimerfc1123Wrapper", - "DictionaryWrapper", - "Dog", - "DotFish", - "DotFishMarket", - "DotSalmon", - "DoubleWrapper", - "DurationWrapper", - "Error", - "Fish", - "FloatWrapper", - "Goblinshark", - "IntWrapper", - "LongWrapper", - "MyBaseType", - "MyDerivedType", - "Pet", - "ReadonlyObj", - "Salmon", - "Sawshark", - "Shark", - "Siamese", - "SmartSalmon", - "StringWrapper", - "CMYKColors", - "GoblinSharkColor", - "MyKind", + 'ArrayWrapper', + 'Basic', + 'BooleanWrapper', + 'ByteWrapper', + 'Cat', + 'Cookiecuttershark', + 'DateWrapper', + 'DatetimeWrapper', + 'Datetimerfc1123Wrapper', + 'DictionaryWrapper', + 'Dog', + 'DotFish', + 'DotFishMarket', + 'DotSalmon', + 'DoubleWrapper', + 'DurationWrapper', + 'Error', + 'Fish', + 'FloatWrapper', + 'Goblinshark', + 'IntWrapper', + 'LongWrapper', + 'MyBaseType', + 'MyDerivedType', + 'Pet', + 'ReadonlyObj', + 'Salmon', + 'Sawshark', + 'Shark', + 'Siamese', + 'SmartSalmon', + 'StringWrapper', + 'CMYKColors', + 'GoblinSharkColor', + 'MyKind', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_auto_rest_complex_test_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_auto_rest_complex_test_service_enums.py index dd6d79768e0..a0e2ace8230 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_auto_rest_complex_test_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_auto_rest_complex_test_service_enums.py @@ -18,9 +18,9 @@ class CMYKColors(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): YELLOW = "YELLOW" BLAC_K = "blacK" - class GoblinSharkColor(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Colors possible""" + """Colors possible + """ PINK = "pink" GRAY = "gray" @@ -30,7 +30,6 @@ class GoblinSharkColor(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Lowercase RED. LOWER_RED = "red" - class MyKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): KIND1 = "Kind1" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_models_py3.py index d30cba23c88..2cfaf07708c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/models/_models_py3.py @@ -23,10 +23,15 @@ class ArrayWrapper(msrest.serialization.Model): """ _attribute_map = { - "array": {"key": "array", "type": "[str]"}, + 'array': {'key': 'array', 'type': '[str]'}, } - def __init__(self, *, array: Optional[List[str]] = None, **kwargs): + def __init__( + self, + *, + array: Optional[List[str]] = None, + **kwargs + ): """ :keyword array: :paramtype array: list[str] @@ -48,9 +53,9 @@ class Basic(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, } def __init__( @@ -86,11 +91,17 @@ class BooleanWrapper(msrest.serialization.Model): """ _attribute_map = { - "field_true": {"key": "field_true", "type": "bool"}, - "field_false": {"key": "field_false", "type": "bool"}, + 'field_true': {'key': 'field_true', 'type': 'bool'}, + 'field_false': {'key': 'field_false', 'type': 'bool'}, } - def __init__(self, *, field_true: Optional[bool] = None, field_false: Optional[bool] = None, **kwargs): + def __init__( + self, + *, + field_true: Optional[bool] = None, + field_false: Optional[bool] = None, + **kwargs + ): """ :keyword field_true: :paramtype field_true: bool @@ -110,10 +121,15 @@ class ByteWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "bytearray"}, + 'field': {'key': 'field', 'type': 'bytearray'}, } - def __init__(self, *, field: Optional[bytearray] = None, **kwargs): + def __init__( + self, + *, + field: Optional[bytearray] = None, + **kwargs + ): """ :keyword field: :paramtype field: bytearray @@ -132,11 +148,17 @@ class Pet(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, id: Optional[int] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -162,10 +184,10 @@ class Cat(Pet): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, - "hates": {"key": "hates", "type": "[Dog]"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, + 'hates': {'key': 'hates', 'type': '[Dog]'}, } def __init__( @@ -211,21 +233,28 @@ class Fish(msrest.serialization.Model): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, } - _subtype_map = {"fishtype": {"salmon": "Salmon", "shark": "Shark"}} + _subtype_map = { + 'fishtype': {'salmon': 'Salmon', 'shark': 'Shark'} + } def __init__( - self, *, length: float, species: Optional[str] = None, siblings: Optional[List["Fish"]] = None, **kwargs + self, + *, + length: float, + species: Optional[str] = None, + siblings: Optional[List["Fish"]] = None, + **kwargs ): """ :keyword species: @@ -265,22 +294,22 @@ class Shark(Fish): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, } _subtype_map = { - "fishtype": {"cookiecuttershark": "Cookiecuttershark", "goblin": "Goblinshark", "sawshark": "Sawshark"} + 'fishtype': {'cookiecuttershark': 'Cookiecuttershark', 'goblin': 'Goblinshark', 'sawshark': 'Sawshark'} } def __init__( @@ -306,7 +335,7 @@ def __init__( :paramtype birthday: ~datetime.datetime """ super(Shark, self).__init__(species=species, length=length, siblings=siblings, **kwargs) - self.fishtype = "shark" # type: str + self.fishtype = 'shark' # type: str self.age = age self.birthday = birthday @@ -331,18 +360,18 @@ class Cookiecuttershark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, } def __init__( @@ -367,10 +396,8 @@ def __init__( :keyword birthday: Required. :paramtype birthday: ~datetime.datetime """ - super(Cookiecuttershark, self).__init__( - species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs - ) - self.fishtype = "cookiecuttershark" # type: str + super(Cookiecuttershark, self).__init__(species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs) + self.fishtype = 'cookiecuttershark' # type: str class Datetimerfc1123Wrapper(msrest.serialization.Model): @@ -383,11 +410,17 @@ class Datetimerfc1123Wrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "rfc-1123"}, - "now": {"key": "now", "type": "rfc-1123"}, + 'field': {'key': 'field', 'type': 'rfc-1123'}, + 'now': {'key': 'now', 'type': 'rfc-1123'}, } - def __init__(self, *, field: Optional[datetime.datetime] = None, now: Optional[datetime.datetime] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.datetime] = None, + now: Optional[datetime.datetime] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.datetime @@ -409,11 +442,17 @@ class DatetimeWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "iso-8601"}, - "now": {"key": "now", "type": "iso-8601"}, + 'field': {'key': 'field', 'type': 'iso-8601'}, + 'now': {'key': 'now', 'type': 'iso-8601'}, } - def __init__(self, *, field: Optional[datetime.datetime] = None, now: Optional[datetime.datetime] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.datetime] = None, + now: Optional[datetime.datetime] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.datetime @@ -435,11 +474,17 @@ class DateWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "date"}, - "leap": {"key": "leap", "type": "date"}, + 'field': {'key': 'field', 'type': 'date'}, + 'leap': {'key': 'leap', 'type': 'date'}, } - def __init__(self, *, field: Optional[datetime.date] = None, leap: Optional[datetime.date] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.date] = None, + leap: Optional[datetime.date] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.date @@ -459,10 +504,15 @@ class DictionaryWrapper(msrest.serialization.Model): """ _attribute_map = { - "default_program": {"key": "defaultProgram", "type": "{str}"}, + 'default_program': {'key': 'defaultProgram', 'type': '{str}'}, } - def __init__(self, *, default_program: Optional[Dict[str, str]] = None, **kwargs): + def __init__( + self, + *, + default_program: Optional[Dict[str, str]] = None, + **kwargs + ): """ :keyword default_program: Dictionary of :code:``. :paramtype default_program: dict[str, str] @@ -483,12 +533,19 @@ class Dog(Pet): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "food": {"key": "food", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'food': {'key': 'food', 'type': 'str'}, } - def __init__(self, *, id: Optional[int] = None, name: Optional[str] = None, food: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + food: Optional[str] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -516,17 +573,24 @@ class DotFish(msrest.serialization.Model): """ _validation = { - "fish_type": {"required": True}, + 'fish_type': {'required': True}, } _attribute_map = { - "fish_type": {"key": "fish\\.type", "type": "str"}, - "species": {"key": "species", "type": "str"}, + 'fish_type': {'key': 'fish\\.type', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, } - _subtype_map = {"fish_type": {"DotSalmon": "DotSalmon"}} + _subtype_map = { + 'fish_type': {'DotSalmon': 'DotSalmon'} + } - def __init__(self, *, species: Optional[str] = None, **kwargs): + def __init__( + self, + *, + species: Optional[str] = None, + **kwargs + ): """ :keyword species: :paramtype species: str @@ -550,10 +614,10 @@ class DotFishMarket(msrest.serialization.Model): """ _attribute_map = { - "sample_salmon": {"key": "sampleSalmon", "type": "DotSalmon"}, - "salmons": {"key": "salmons", "type": "[DotSalmon]"}, - "sample_fish": {"key": "sampleFish", "type": "DotFish"}, - "fishes": {"key": "fishes", "type": "[DotFish]"}, + 'sample_salmon': {'key': 'sampleSalmon', 'type': 'DotSalmon'}, + 'salmons': {'key': 'salmons', 'type': '[DotSalmon]'}, + 'sample_fish': {'key': 'sampleFish', 'type': 'DotFish'}, + 'fishes': {'key': 'fishes', 'type': '[DotFish]'}, } def __init__( @@ -598,18 +662,23 @@ class DotSalmon(DotFish): """ _validation = { - "fish_type": {"required": True}, + 'fish_type': {'required': True}, } _attribute_map = { - "fish_type": {"key": "fish\\.type", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, + 'fish_type': {'key': 'fish\\.type', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, } def __init__( - self, *, species: Optional[str] = None, location: Optional[str] = None, iswild: Optional[bool] = None, **kwargs + self, + *, + species: Optional[str] = None, + location: Optional[str] = None, + iswild: Optional[bool] = None, + **kwargs ): """ :keyword species: @@ -620,7 +689,7 @@ def __init__( :paramtype iswild: bool """ super(DotSalmon, self).__init__(species=species, **kwargs) - self.fish_type = "DotSalmon" # type: str + self.fish_type = 'DotSalmon' # type: str self.location = location self.iswild = iswild @@ -638,20 +707,15 @@ class DoubleWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "float"}, - "field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": { - "key": "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose", - "type": "float", - }, + 'field1': {'key': 'field1', 'type': 'float'}, + 'field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose': {'key': 'field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose', 'type': 'float'}, } def __init__( self, *, field1: Optional[float] = None, - field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose: Optional[ - float - ] = None, + field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose: Optional[float] = None, **kwargs ): """ @@ -665,9 +729,7 @@ def __init__( """ super(DoubleWrapper, self).__init__(**kwargs) self.field1 = field1 - self.field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = ( - field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose - ) + self.field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = field56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose class DurationWrapper(msrest.serialization.Model): @@ -678,10 +740,15 @@ class DurationWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "duration"}, + 'field': {'key': 'field', 'type': 'duration'}, } - def __init__(self, *, field: Optional[datetime.timedelta] = None, **kwargs): + def __init__( + self, + *, + field: Optional[datetime.timedelta] = None, + **kwargs + ): """ :keyword field: :paramtype field: ~datetime.timedelta @@ -700,11 +767,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -726,11 +799,17 @@ class FloatWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "float"}, - "field2": {"key": "field2", "type": "float"}, + 'field1': {'key': 'field1', 'type': 'float'}, + 'field2': {'key': 'field2', 'type': 'float'}, } - def __init__(self, *, field1: Optional[float] = None, field2: Optional[float] = None, **kwargs): + def __init__( + self, + *, + field1: Optional[float] = None, + field2: Optional[float] = None, + **kwargs + ): """ :keyword field1: :paramtype field1: float @@ -767,20 +846,20 @@ class Goblinshark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, - "jawsize": {"key": "jawsize", "type": "int"}, - "color": {"key": "color", "type": "str"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, + 'jawsize': {'key': 'jawsize', 'type': 'int'}, + 'color': {'key': 'color', 'type': 'str'}, } def __init__( @@ -812,10 +891,8 @@ def __init__( "red". Default value: "gray". :paramtype color: str or ~bodycomplexpython3only.models.GoblinSharkColor """ - super(Goblinshark, self).__init__( - species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs - ) - self.fishtype = "goblin" # type: str + super(Goblinshark, self).__init__(species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs) + self.fishtype = 'goblin' # type: str self.jawsize = jawsize self.color = color @@ -830,11 +907,17 @@ class IntWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "int"}, - "field2": {"key": "field2", "type": "int"}, + 'field1': {'key': 'field1', 'type': 'int'}, + 'field2': {'key': 'field2', 'type': 'int'}, } - def __init__(self, *, field1: Optional[int] = None, field2: Optional[int] = None, **kwargs): + def __init__( + self, + *, + field1: Optional[int] = None, + field2: Optional[int] = None, + **kwargs + ): """ :keyword field1: :paramtype field1: int @@ -856,11 +939,17 @@ class LongWrapper(msrest.serialization.Model): """ _attribute_map = { - "field1": {"key": "field1", "type": "long"}, - "field2": {"key": "field2", "type": "long"}, + 'field1': {'key': 'field1', 'type': 'long'}, + 'field2': {'key': 'field2', 'type': 'long'}, } - def __init__(self, *, field1: Optional[int] = None, field2: Optional[int] = None, **kwargs): + def __init__( + self, + *, + field1: Optional[int] = None, + field2: Optional[int] = None, + **kwargs + ): """ :keyword field1: :paramtype field1: long @@ -889,18 +978,26 @@ class MyBaseType(msrest.serialization.Model): """ _validation = { - "kind": {"required": True}, + 'kind': {'required': True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "prop_b1": {"key": "propB1", "type": "str"}, - "prop_bh1": {"key": "helper.propBH1", "type": "str"}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'prop_b1': {'key': 'propB1', 'type': 'str'}, + 'prop_bh1': {'key': 'helper.propBH1', 'type': 'str'}, } - _subtype_map = {"kind": {"Kind1": "MyDerivedType"}} + _subtype_map = { + 'kind': {'Kind1': 'MyDerivedType'} + } - def __init__(self, *, prop_b1: Optional[str] = None, prop_bh1: Optional[str] = None, **kwargs): + def __init__( + self, + *, + prop_b1: Optional[str] = None, + prop_bh1: Optional[str] = None, + **kwargs + ): """ :keyword prop_b1: :paramtype prop_b1: str @@ -929,18 +1026,23 @@ class MyDerivedType(MyBaseType): """ _validation = { - "kind": {"required": True}, + 'kind': {'required': True}, } _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "prop_b1": {"key": "propB1", "type": "str"}, - "prop_bh1": {"key": "helper.propBH1", "type": "str"}, - "prop_d1": {"key": "propD1", "type": "str"}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'prop_b1': {'key': 'propB1', 'type': 'str'}, + 'prop_bh1': {'key': 'helper.propBH1', 'type': 'str'}, + 'prop_d1': {'key': 'propD1', 'type': 'str'}, } def __init__( - self, *, prop_b1: Optional[str] = None, prop_bh1: Optional[str] = None, prop_d1: Optional[str] = None, **kwargs + self, + *, + prop_b1: Optional[str] = None, + prop_bh1: Optional[str] = None, + prop_d1: Optional[str] = None, + **kwargs ): """ :keyword prop_b1: @@ -951,7 +1053,7 @@ def __init__( :paramtype prop_d1: str """ super(MyDerivedType, self).__init__(prop_b1=prop_b1, prop_bh1=prop_bh1, **kwargs) - self.kind = "Kind1" # type: str + self.kind = 'Kind1' # type: str self.prop_d1 = prop_d1 @@ -967,15 +1069,20 @@ class ReadonlyObj(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, + 'id': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "size": {"key": "size", "type": "int"}, + 'id': {'key': 'id', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'int'}, } - def __init__(self, *, size: Optional[int] = None, **kwargs): + def __init__( + self, + *, + size: Optional[int] = None, + **kwargs + ): """ :keyword size: :paramtype size: int @@ -1008,20 +1115,22 @@ class Salmon(Fish): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, } - _subtype_map = {"fishtype": {"smart_salmon": "SmartSalmon"}} + _subtype_map = { + 'fishtype': {'smart_salmon': 'SmartSalmon'} + } def __init__( self, @@ -1046,7 +1155,7 @@ def __init__( :paramtype iswild: bool """ super(Salmon, self).__init__(species=species, length=length, siblings=siblings, **kwargs) - self.fishtype = "salmon" # type: str + self.fishtype = 'salmon' # type: str self.location = location self.iswild = iswild @@ -1073,19 +1182,19 @@ class Sawshark(Shark): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, - "birthday": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, + 'birthday': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "age": {"key": "age", "type": "int"}, - "birthday": {"key": "birthday", "type": "iso-8601"}, - "picture": {"key": "picture", "type": "bytearray"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'age': {'key': 'age', 'type': 'int'}, + 'birthday': {'key': 'birthday', 'type': 'iso-8601'}, + 'picture': {'key': 'picture', 'type': 'bytearray'}, } def __init__( @@ -1113,10 +1222,8 @@ def __init__( :keyword picture: :paramtype picture: bytearray """ - super(Sawshark, self).__init__( - species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs - ) - self.fishtype = "sawshark" # type: str + super(Sawshark, self).__init__(species=species, length=length, siblings=siblings, age=age, birthday=birthday, **kwargs) + self.fishtype = 'sawshark' # type: str self.picture = picture @@ -1136,11 +1243,11 @@ class Siamese(Cat): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "color": {"key": "color", "type": "str"}, - "hates": {"key": "hates", "type": "[Dog]"}, - "breed": {"key": "breed", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'str'}, + 'hates': {'key': 'hates', 'type': '[Dog]'}, + 'breed': {'key': 'breed', 'type': 'str'}, } def __init__( @@ -1194,19 +1301,19 @@ class SmartSalmon(Salmon): """ _validation = { - "fishtype": {"required": True}, - "length": {"required": True}, + 'fishtype': {'required': True}, + 'length': {'required': True}, } _attribute_map = { - "fishtype": {"key": "fishtype", "type": "str"}, - "species": {"key": "species", "type": "str"}, - "length": {"key": "length", "type": "float"}, - "siblings": {"key": "siblings", "type": "[Fish]"}, - "location": {"key": "location", "type": "str"}, - "iswild": {"key": "iswild", "type": "bool"}, - "additional_properties": {"key": "", "type": "{object}"}, - "college_degree": {"key": "college_degree", "type": "str"}, + 'fishtype': {'key': 'fishtype', 'type': 'str'}, + 'species': {'key': 'species', 'type': 'str'}, + 'length': {'key': 'length', 'type': 'float'}, + 'siblings': {'key': 'siblings', 'type': '[Fish]'}, + 'location': {'key': 'location', 'type': 'str'}, + 'iswild': {'key': 'iswild', 'type': 'bool'}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'college_degree': {'key': 'college_degree', 'type': 'str'}, } def __init__( @@ -1238,10 +1345,8 @@ def __init__( :keyword college_degree: :paramtype college_degree: str """ - super(SmartSalmon, self).__init__( - species=species, length=length, siblings=siblings, location=location, iswild=iswild, **kwargs - ) - self.fishtype = "smart_salmon" # type: str + super(SmartSalmon, self).__init__(species=species, length=length, siblings=siblings, location=location, iswild=iswild, **kwargs) + self.fishtype = 'smart_salmon' # type: str self.additional_properties = additional_properties self.college_degree = college_degree @@ -1258,13 +1363,18 @@ class StringWrapper(msrest.serialization.Model): """ _attribute_map = { - "field": {"key": "field", "type": "str"}, - "empty": {"key": "empty", "type": "str"}, - "null": {"key": "null", "type": "str"}, + 'field': {'key': 'field', 'type': 'str'}, + 'empty': {'key': 'empty', 'type': 'str'}, + 'null': {'key': 'null', 'type': 'str'}, } def __init__( - self, *, field: Optional[str] = None, empty: Optional[str] = None, null: Optional[str] = None, **kwargs + self, + *, + field: Optional[str] = None, + empty: Optional[str] = None, + null: Optional[str] = None, + **kwargs ): """ :keyword field: diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/__init__.py index ad0a93ac37c..84f771f755a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/__init__.py @@ -17,13 +17,13 @@ from ._flattencomplex_operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations.py index fc37e4c1195..71a2ace8fb0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_array_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,82 +17,124 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/array/valid") + url = kwargs.pop("template_url", '/complex/array/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/array/valid") + url = kwargs.pop("template_url", '/complex/array/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_empty_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/array/empty") + url = kwargs.pop("template_url", '/complex/array/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/array/empty") + url = kwargs.pop("template_url", '/complex/array/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/array/notprovided") + url = kwargs.pop("template_url", '/complex/array/notprovided') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class ArrayOperations(object): """ArrayOperations operations. @@ -124,7 +159,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": + def get_valid( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -132,17 +170,24 @@ def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplexpython3only.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -150,17 +195,22 @@ def get_valid(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace - def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: + def put_valid( + self, + array: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Put complex types with array property. :param array: @@ -170,24 +220,30 @@ def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -198,10 +254,14 @@ def put_valid(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/array/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/array/valid'} # type: ignore + @distributed_trace - def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": + def get_empty( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property which is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -209,17 +269,24 @@ def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplexpython3only.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,17 +294,22 @@ def get_empty(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace - def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: + def put_empty( + self, + array: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Put complex types with array property which is empty. :param array: @@ -247,24 +319,30 @@ def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ArrayWrapper(array=array) - _json = self._serialize.body(_complex_body, "ArrayWrapper") + _json = self._serialize.body(_complex_body, 'ArrayWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -275,10 +353,14 @@ def put_empty(self, array: Optional[List[str]] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/array/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/array/empty'} # type: ignore + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": + def get_not_provided( + self, + **kwargs: Any + ) -> "_models.ArrayWrapper": """Get complex types with array property while server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -286,17 +368,24 @@ def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": :rtype: ~bodycomplexpython3only.models.ArrayWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ArrayWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArrayWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -304,11 +393,12 @@ def get_not_provided(self, **kwargs: Any) -> "_models.ArrayWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ArrayWrapper", pipeline_response) + deserialized = self._deserialize('ArrayWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/array/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/array/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations.py index 4998b1ffe8e..011e7325869 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_basic_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,97 +17,140 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/basic/valid") + url = kwargs.pop("template_url", '/complex/basic/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/basic/valid") + url = kwargs.pop("template_url", '/complex/basic/valid') # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/basic/invalid") + url = kwargs.pop("template_url", '/complex/basic/invalid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/basic/empty") + url = kwargs.pop("template_url", '/complex/basic/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/basic/null") + url = kwargs.pop("template_url", '/complex/basic/null') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/basic/notprovided") + url = kwargs.pop("template_url", '/complex/basic/notprovided') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class BasicOperations(object): """BasicOperations operations. @@ -139,7 +175,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.Basic": + def get_valid( + self, + **kwargs: Any + ) -> "_models.Basic": """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -147,17 +186,24 @@ def get_valid(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -165,17 +211,22 @@ def get_valid(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace - def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: + def put_valid( + self, + complex_body: "_models.Basic", + **kwargs: Any + ) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. @@ -185,25 +236,31 @@ def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Basic") + _json = self._serialize.body(complex_body, 'Basic') request = build_put_valid_request( api_version=api_version, content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -214,10 +271,14 @@ def put_valid(self, complex_body: "_models.Basic", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/basic/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/basic/valid'} # type: ignore + @distributed_trace - def get_invalid(self, **kwargs: Any) -> "_models.Basic": + def get_invalid( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type that is invalid for the local strong type. :keyword callable cls: A custom type or function that will be passed the direct response @@ -225,17 +286,24 @@ def get_invalid(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -243,17 +311,21 @@ def get_invalid(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/complex/basic/invalid"} # type: ignore + get_invalid.metadata = {'url': '/complex/basic/invalid'} # type: ignore + @distributed_trace - def get_empty(self, **kwargs: Any) -> "_models.Basic": + def get_empty( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type that is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -261,17 +333,24 @@ def get_empty(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -279,17 +358,21 @@ def get_empty(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/basic/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/basic/empty'} # type: ignore + @distributed_trace - def get_null(self, **kwargs: Any) -> "_models.Basic": + def get_null( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type whose properties are null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -297,17 +380,24 @@ def get_null(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -315,17 +405,21 @@ def get_null(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/basic/null"} # type: ignore + get_null.metadata = {'url': '/complex/basic/null'} # type: ignore + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> "_models.Basic": + def get_not_provided( + self, + **kwargs: Any + ) -> "_models.Basic": """Get a basic complex type while the server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -333,17 +427,24 @@ def get_not_provided(self, **kwargs: Any) -> "_models.Basic": :rtype: ~bodycomplexpython3only.models.Basic :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Basic"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Basic"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -351,11 +452,12 @@ def get_not_provided(self, **kwargs: Any) -> "_models.Basic": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Basic", pipeline_response) + deserialized = self._deserialize('Basic', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/basic/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/basic/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations.py index abe9ecb0d08..f08703efb99 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_dictionary_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,94 +17,143 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/dictionary/typed/valid") + url = kwargs.pop("template_url", '/complex/dictionary/typed/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/dictionary/typed/valid") + url = kwargs.pop("template_url", '/complex/dictionary/typed/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_empty_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/dictionary/typed/empty") + url = kwargs.pop("template_url", '/complex/dictionary/typed/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/dictionary/typed/empty") + url = kwargs.pop("template_url", '/complex/dictionary/typed/empty') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_null_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/dictionary/typed/null") + url = kwargs.pop("template_url", '/complex/dictionary/typed/null') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/dictionary/typed/notprovided") + url = kwargs.pop("template_url", '/complex/dictionary/typed/notprovided') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class DictionaryOperations(object): """DictionaryOperations operations. @@ -136,7 +178,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": + def get_valid( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -144,17 +189,24 @@ def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -162,17 +214,22 @@ def get_valid(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace - def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def put_valid( + self, + default_program: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """Put complex types with dictionary property. :param default_program: Dictionary of :code:``. @@ -182,24 +239,30 @@ def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -210,10 +273,14 @@ def put_valid(self, default_program: Optional[Dict[str, str]] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/dictionary/typed/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/dictionary/typed/valid'} # type: ignore + @distributed_trace - def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": + def get_empty( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property which is empty. :keyword callable cls: A custom type or function that will be passed the direct response @@ -221,17 +288,24 @@ def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -239,17 +313,22 @@ def get_empty(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + get_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace - def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def put_empty( + self, + default_program: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """Put complex types with dictionary property which is empty. :param default_program: Dictionary of :code:``. @@ -259,24 +338,30 @@ def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DictionaryWrapper(default_program=default_program) - _json = self._serialize.body(_complex_body, "DictionaryWrapper") + _json = self._serialize.body(_complex_body, 'DictionaryWrapper') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -287,10 +372,14 @@ def put_empty(self, default_program: Optional[Dict[str, str]] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/complex/dictionary/typed/empty"} # type: ignore + put_empty.metadata = {'url': '/complex/dictionary/typed/empty'} # type: ignore + @distributed_trace - def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": + def get_null( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property which is null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -298,17 +387,24 @@ def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -316,17 +412,21 @@ def get_null(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/complex/dictionary/typed/null"} # type: ignore + get_null.metadata = {'url': '/complex/dictionary/typed/null'} # type: ignore + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": + def get_not_provided( + self, + **kwargs: Any + ) -> "_models.DictionaryWrapper": """Get complex types with dictionary property while server doesn't provide a response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -334,17 +434,24 @@ def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": :rtype: ~bodycomplexpython3only.models.DictionaryWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DictionaryWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DictionaryWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -352,11 +459,12 @@ def get_not_provided(self, **kwargs: Any) -> "_models.DictionaryWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DictionaryWrapper", pipeline_response) + deserialized = self._deserialize('DictionaryWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/complex/dictionary/typed/notprovided"} # type: ignore + get_not_provided.metadata = {'url': '/complex/dictionary/typed/notprovided'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_flattencomplex_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_flattencomplex_operations.py index c9906d2a632..e5d15d50214 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_flattencomplex_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_flattencomplex_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,25 +17,29 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/flatten/valid") + url = kwargs.pop("template_url", '/complex/flatten/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class FlattencomplexOperations(object): """FlattencomplexOperations operations. @@ -67,7 +64,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.MyBaseType": + def get_valid( + self, + **kwargs: Any + ) -> "_models.MyBaseType": """get_valid. :keyword callable cls: A custom type or function that will be passed the direct response @@ -75,28 +75,36 @@ def get_valid(self, **kwargs: Any) -> "_models.MyBaseType": :rtype: ~bodycomplexpython3only.models.MyBaseType :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyBaseType"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyBaseType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyBaseType", pipeline_response) + deserialized = self._deserialize('MyBaseType', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/flatten/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/flatten/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations.py index 35c22fbc995..9a4a0d9bf79 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_inheritance_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,42 +17,58 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/inheritance/valid") + url = kwargs.pop("template_url", '/complex/inheritance/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/inheritance/valid") + url = kwargs.pop("template_url", '/complex/inheritance/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class InheritanceOperations(object): """InheritanceOperations operations. @@ -84,7 +93,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.Siamese": + def get_valid( + self, + **kwargs: Any + ) -> "_models.Siamese": """Get complex types that extend others. :keyword callable cls: A custom type or function that will be passed the direct response @@ -92,17 +104,24 @@ def get_valid(self, **kwargs: Any) -> "_models.Siamese": :rtype: ~bodycomplexpython3only.models.Siamese :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Siamese"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Siamese"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,17 +129,22 @@ def get_valid(self, **kwargs: Any) -> "_models.Siamese": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Siamese", pipeline_response) + deserialized = self._deserialize('Siamese', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + @distributed_trace - def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> None: + def put_valid( + self, + complex_body: "_models.Siamese", + **kwargs: Any + ) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, @@ -132,23 +156,29 @@ def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Siamese") + _json = self._serialize.body(complex_body, 'Siamese') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -159,4 +189,5 @@ def put_valid(self, complex_body: "_models.Siamese", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/inheritance/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/inheritance/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations.py index 78eedd9f100..4c6393a5db3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphicrecursive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,42 +17,58 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphicrecursive/valid") + url = kwargs.pop("template_url", '/complex/polymorphicrecursive/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphicrecursive/valid") + url = kwargs.pop("template_url", '/complex/polymorphicrecursive/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class PolymorphicrecursiveOperations(object): """PolymorphicrecursiveOperations operations. @@ -84,7 +93,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.Fish": + def get_valid( + self, + **kwargs: Any + ) -> "_models.Fish": """Get complex types that are polymorphic and have recursive references. :keyword callable cls: A custom type or function that will be passed the direct response @@ -92,17 +104,24 @@ def get_valid(self, **kwargs: Any) -> "_models.Fish": :rtype: ~bodycomplexpython3only.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,17 +129,22 @@ def get_valid(self, **kwargs: Any) -> "_models.Fish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + @distributed_trace - def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + def put_valid( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -182,23 +206,29 @@ def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,4 +239,5 @@ def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphicrecursive/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphicrecursive/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations.py index 9750291af2e..81736be294d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_polymorphism_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,142 +17,218 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/valid") + url = kwargs.pop("template_url", '/complex/polymorphism/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/valid") + url = kwargs.pop("template_url", '/complex/polymorphism/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_dot_syntax_request(**kwargs: Any) -> HttpRequest: +def build_get_dot_syntax_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/dotsyntax") + url = kwargs.pop("template_url", '/complex/polymorphism/dotsyntax') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_composed_with_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_get_composed_with_discriminator_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/composedWithDiscriminator") + url = kwargs.pop("template_url", '/complex/polymorphism/composedWithDiscriminator') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_composed_without_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_get_composed_without_discriminator_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/composedWithoutDiscriminator") + url = kwargs.pop("template_url", '/complex/polymorphism/composedWithoutDiscriminator') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complicated_request(**kwargs: Any) -> HttpRequest: +def build_get_complicated_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/complicated") + url = kwargs.pop("template_url", '/complex/polymorphism/complicated') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_complicated_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_complicated_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/complicated") + url = kwargs.pop("template_url", '/complex/polymorphism/complicated') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_missing_discriminator_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/missingdiscriminator") + url = kwargs.pop("template_url", '/complex/polymorphism/missingdiscriminator') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_valid_missing_required_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/polymorphism/missingrequired/invalid") + url = kwargs.pop("template_url", '/complex/polymorphism/missingrequired/invalid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class PolymorphismOperations(object): """PolymorphismOperations operations. @@ -184,7 +253,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.Fish": + def get_valid( + self, + **kwargs: Any + ) -> "_models.Fish": """Get complex types that are polymorphic. :keyword callable cls: A custom type or function that will be passed the direct response @@ -192,17 +264,24 @@ def get_valid(self, **kwargs: Any) -> "_models.Fish": :rtype: ~bodycomplexpython3only.models.Fish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Fish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Fish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -210,17 +289,22 @@ def get_valid(self, **kwargs: Any) -> "_models.Fish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Fish", pipeline_response) + deserialized = self._deserialize('Fish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace - def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + def put_valid( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -262,23 +346,29 @@ def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -289,10 +379,14 @@ def put_valid(self, complex_body: "_models.Fish", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/polymorphism/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/polymorphism/valid'} # type: ignore + @distributed_trace - def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": + def get_dot_syntax( + self, + **kwargs: Any + ) -> "_models.DotFish": """Get complex types that are polymorphic, JSON key contains a dot. :keyword callable cls: A custom type or function that will be passed the direct response @@ -300,17 +394,24 @@ def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": :rtype: ~bodycomplexpython3only.models.DotFish :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFish"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFish"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dot_syntax_request( - template_url=self.get_dot_syntax.metadata["url"], + template_url=self.get_dot_syntax.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -318,17 +419,21 @@ def get_dot_syntax(self, **kwargs: Any) -> "_models.DotFish": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFish", pipeline_response) + deserialized = self._deserialize('DotFish', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dot_syntax.metadata = {"url": "/complex/polymorphism/dotsyntax"} # type: ignore + get_dot_syntax.metadata = {'url': '/complex/polymorphism/dotsyntax'} # type: ignore + @distributed_trace - def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFishMarket": + def get_composed_with_discriminator( + self, + **kwargs: Any + ) -> "_models.DotFishMarket": """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -338,17 +443,24 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFishMark :rtype: ~bodycomplexpython3only.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_with_discriminator_request( - template_url=self.get_composed_with_discriminator.metadata["url"], + template_url=self.get_composed_with_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -356,17 +468,21 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> "_models.DotFishMark error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_with_discriminator.metadata = {"url": "/complex/polymorphism/composedWithDiscriminator"} # type: ignore + get_composed_with_discriminator.metadata = {'url': '/complex/polymorphism/composedWithDiscriminator'} # type: ignore + @distributed_trace - def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.DotFishMarket": + def get_composed_without_discriminator( + self, + **kwargs: Any + ) -> "_models.DotFishMarket": """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -376,17 +492,24 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.DotFishM :rtype: ~bodycomplexpython3only.models.DotFishMarket :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DotFishMarket"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DotFishMarket"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_composed_without_discriminator_request( - template_url=self.get_composed_without_discriminator.metadata["url"], + template_url=self.get_composed_without_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -394,17 +517,21 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> "_models.DotFishM error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DotFishMarket", pipeline_response) + deserialized = self._deserialize('DotFishMarket', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_composed_without_discriminator.metadata = {"url": "/complex/polymorphism/composedWithoutDiscriminator"} # type: ignore + get_composed_without_discriminator.metadata = {'url': '/complex/polymorphism/composedWithoutDiscriminator'} # type: ignore + @distributed_trace - def get_complicated(self, **kwargs: Any) -> "_models.Salmon": + def get_complicated( + self, + **kwargs: Any + ) -> "_models.Salmon": """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -413,17 +540,24 @@ def get_complicated(self, **kwargs: Any) -> "_models.Salmon": :rtype: ~bodycomplexpython3only.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complicated_request( - template_url=self.get_complicated.metadata["url"], + template_url=self.get_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,17 +565,22 @@ def get_complicated(self, **kwargs: Any) -> "_models.Salmon": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + get_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace - def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) -> None: + def put_complicated( + self, + complex_body: "_models.Salmon", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -452,23 +591,29 @@ def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_complicated_request( content_type=content_type, json=_json, - template_url=self.put_complicated.metadata["url"], + template_url=self.put_complicated.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -479,10 +624,15 @@ def put_complicated(self, complex_body: "_models.Salmon", **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - put_complicated.metadata = {"url": "/complex/polymorphism/complicated"} # type: ignore + put_complicated.metadata = {'url': '/complex/polymorphism/complicated'} # type: ignore + @distributed_trace - def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwargs: Any) -> "_models.Salmon": + def put_missing_discriminator( + self, + complex_body: "_models.Salmon", + **kwargs: Any + ) -> "_models.Salmon": """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: @@ -492,23 +642,29 @@ def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwargs: An :rtype: ~bodycomplexpython3only.models.Salmon :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Salmon"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Salmon"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Salmon") + _json = self._serialize.body(complex_body, 'Salmon') request = build_put_missing_discriminator_request( content_type=content_type, json=_json, - template_url=self.put_missing_discriminator.metadata["url"], + template_url=self.put_missing_discriminator.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -516,17 +672,22 @@ def put_missing_discriminator(self, complex_body: "_models.Salmon", **kwargs: An error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Salmon", pipeline_response) + deserialized = self._deserialize('Salmon', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_missing_discriminator.metadata = {"url": "/complex/polymorphism/missingdiscriminator"} # type: ignore + put_missing_discriminator.metadata = {'url': '/complex/polymorphism/missingdiscriminator'} # type: ignore + @distributed_trace - def put_valid_missing_required(self, complex_body: "_models.Fish", **kwargs: Any) -> None: + def put_valid_missing_required( + self, + complex_body: "_models.Fish", + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -563,23 +724,29 @@ def put_valid_missing_required(self, complex_body: "_models.Fish", **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Fish") + _json = self._serialize.body(complex_body, 'Fish') request = build_put_valid_missing_required_request( content_type=content_type, json=_json, - template_url=self.put_valid_missing_required.metadata["url"], + template_url=self.put_valid_missing_required.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -590,4 +757,5 @@ def put_valid_missing_required(self, complex_body: "_models.Fish", **kwargs: Any if cls: return cls(pipeline_response, None, {}) - put_valid_missing_required.metadata = {"url": "/complex/polymorphism/missingrequired/invalid"} # type: ignore + put_valid_missing_required.metadata = {'url': '/complex/polymorphism/missingrequired/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations.py index 7fa3f4f0734..02cd19cf90c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_primitive_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -25,324 +18,530 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_int_request(**kwargs: Any) -> HttpRequest: +def build_get_int_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/integer") + url = kwargs.pop("template_url", '/complex/primitive/integer') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_int_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_int_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/integer") + url = kwargs.pop("template_url", '/complex/primitive/integer') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_long_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_long_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/long") + url = kwargs.pop("template_url", '/complex/primitive/long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_long_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_long_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/long") + url = kwargs.pop("template_url", '/complex/primitive/long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_float_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_float_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/float") + url = kwargs.pop("template_url", '/complex/primitive/float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/float") + url = kwargs.pop("template_url", '/complex/primitive/float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_double_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_double_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/double") + url = kwargs.pop("template_url", '/complex/primitive/double') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/double") + url = kwargs.pop("template_url", '/complex/primitive/double') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_bool_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_bool_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/bool") + url = kwargs.pop("template_url", '/complex/primitive/bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_bool_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_bool_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/bool") + url = kwargs.pop("template_url", '/complex/primitive/bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_string_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/string") + url = kwargs.pop("template_url", '/complex/primitive/string') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/string") + url = kwargs.pop("template_url", '/complex/primitive/string') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_date_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/date") + url = kwargs.pop("template_url", '/complex/primitive/date') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/date") + url = kwargs.pop("template_url", '/complex/primitive/date') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_date_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/datetime") + url = kwargs.pop("template_url", '/complex/primitive/datetime') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/datetime") + url = kwargs.pop("template_url", '/complex/primitive/datetime') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_date_time_rfc1123_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/datetimerfc1123") + url = kwargs.pop("template_url", '/complex/primitive/datetimerfc1123') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_time_rfc1123_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_date_time_rfc1123_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/datetimerfc1123") + url = kwargs.pop("template_url", '/complex/primitive/datetimerfc1123') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_duration_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_duration_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/duration") + url = kwargs.pop("template_url", '/complex/primitive/duration') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_duration_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/duration") + url = kwargs.pop("template_url", '/complex/primitive/duration') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_byte_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_byte_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/byte") + url = kwargs.pop("template_url", '/complex/primitive/byte') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_byte_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_byte_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/primitive/byte") + url = kwargs.pop("template_url", '/complex/primitive/byte') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -class PrimitiveOperations(object): + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + +class PrimitiveOperations(object): # pylint: disable=too-many-public-methods """PrimitiveOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -365,7 +564,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_int(self, **kwargs: Any) -> "_models.IntWrapper": + def get_int( + self, + **kwargs: Any + ) -> "_models.IntWrapper": """Get complex types with integer properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -373,17 +575,24 @@ def get_int(self, **kwargs: Any) -> "_models.IntWrapper": :rtype: ~bodycomplexpython3only.models.IntWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.IntWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_request( - template_url=self.get_int.metadata["url"], + template_url=self.get_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -391,17 +600,22 @@ def get_int(self, **kwargs: Any) -> "_models.IntWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("IntWrapper", pipeline_response) + deserialized = self._deserialize('IntWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + get_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace - def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> None: + def put_int( + self, + complex_body: "_models.IntWrapper", + **kwargs: Any + ) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. @@ -411,23 +625,29 @@ def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "IntWrapper") + _json = self._serialize.body(complex_body, 'IntWrapper') request = build_put_int_request( content_type=content_type, json=_json, - template_url=self.put_int.metadata["url"], + template_url=self.put_int.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,10 +658,14 @@ def put_int(self, complex_body: "_models.IntWrapper", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_int.metadata = {"url": "/complex/primitive/integer"} # type: ignore + put_int.metadata = {'url': '/complex/primitive/integer'} # type: ignore + @distributed_trace - def get_long(self, **kwargs: Any) -> "_models.LongWrapper": + def get_long( + self, + **kwargs: Any + ) -> "_models.LongWrapper": """Get complex types with long properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -449,17 +673,24 @@ def get_long(self, **kwargs: Any) -> "_models.LongWrapper": :rtype: ~bodycomplexpython3only.models.LongWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.LongWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_request( - template_url=self.get_long.metadata["url"], + template_url=self.get_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -467,17 +698,22 @@ def get_long(self, **kwargs: Any) -> "_models.LongWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("LongWrapper", pipeline_response) + deserialized = self._deserialize('LongWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + get_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace - def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> None: + def put_long( + self, + complex_body: "_models.LongWrapper", + **kwargs: Any + ) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. @@ -487,23 +723,29 @@ def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "LongWrapper") + _json = self._serialize.body(complex_body, 'LongWrapper') request = build_put_long_request( content_type=content_type, json=_json, - template_url=self.put_long.metadata["url"], + template_url=self.put_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -514,10 +756,14 @@ def put_long(self, complex_body: "_models.LongWrapper", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_long.metadata = {"url": "/complex/primitive/long"} # type: ignore + put_long.metadata = {'url': '/complex/primitive/long'} # type: ignore + @distributed_trace - def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": + def get_float( + self, + **kwargs: Any + ) -> "_models.FloatWrapper": """Get complex types with float properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -525,17 +771,24 @@ def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": :rtype: ~bodycomplexpython3only.models.FloatWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.FloatWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.FloatWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_request( - template_url=self.get_float.metadata["url"], + template_url=self.get_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -543,17 +796,22 @@ def get_float(self, **kwargs: Any) -> "_models.FloatWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("FloatWrapper", pipeline_response) + deserialized = self._deserialize('FloatWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + get_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace - def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) -> None: + def put_float( + self, + complex_body: "_models.FloatWrapper", + **kwargs: Any + ) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. @@ -563,23 +821,29 @@ def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "FloatWrapper") + _json = self._serialize.body(complex_body, 'FloatWrapper') request = build_put_float_request( content_type=content_type, json=_json, - template_url=self.put_float.metadata["url"], + template_url=self.put_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -590,10 +854,14 @@ def put_float(self, complex_body: "_models.FloatWrapper", **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - put_float.metadata = {"url": "/complex/primitive/float"} # type: ignore + put_float.metadata = {'url': '/complex/primitive/float'} # type: ignore + @distributed_trace - def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": + def get_double( + self, + **kwargs: Any + ) -> "_models.DoubleWrapper": """Get complex types with double properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -601,17 +869,24 @@ def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": :rtype: ~bodycomplexpython3only.models.DoubleWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DoubleWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DoubleWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_request( - template_url=self.get_double.metadata["url"], + template_url=self.get_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -619,17 +894,22 @@ def get_double(self, **kwargs: Any) -> "_models.DoubleWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DoubleWrapper", pipeline_response) + deserialized = self._deserialize('DoubleWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + get_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace - def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) -> None: + def put_double( + self, + complex_body: "_models.DoubleWrapper", + **kwargs: Any + ) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and @@ -640,23 +920,29 @@ def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DoubleWrapper") + _json = self._serialize.body(complex_body, 'DoubleWrapper') request = build_put_double_request( content_type=content_type, json=_json, - template_url=self.put_double.metadata["url"], + template_url=self.put_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -667,10 +953,14 @@ def put_double(self, complex_body: "_models.DoubleWrapper", **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_double.metadata = {"url": "/complex/primitive/double"} # type: ignore + put_double.metadata = {'url': '/complex/primitive/double'} # type: ignore + @distributed_trace - def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": + def get_bool( + self, + **kwargs: Any + ) -> "_models.BooleanWrapper": """Get complex types with bool properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -678,17 +968,24 @@ def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": :rtype: ~bodycomplexpython3only.models.BooleanWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.BooleanWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.BooleanWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_bool_request( - template_url=self.get_bool.metadata["url"], + template_url=self.get_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -696,17 +993,22 @@ def get_bool(self, **kwargs: Any) -> "_models.BooleanWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("BooleanWrapper", pipeline_response) + deserialized = self._deserialize('BooleanWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + get_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace - def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) -> None: + def put_bool( + self, + complex_body: "_models.BooleanWrapper", + **kwargs: Any + ) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. @@ -716,23 +1018,29 @@ def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "BooleanWrapper") + _json = self._serialize.body(complex_body, 'BooleanWrapper') request = build_put_bool_request( content_type=content_type, json=_json, - template_url=self.put_bool.metadata["url"], + template_url=self.put_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -743,10 +1051,14 @@ def put_bool(self, complex_body: "_models.BooleanWrapper", **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - put_bool.metadata = {"url": "/complex/primitive/bool"} # type: ignore + put_bool.metadata = {'url': '/complex/primitive/bool'} # type: ignore + @distributed_trace - def get_string(self, **kwargs: Any) -> "_models.StringWrapper": + def get_string( + self, + **kwargs: Any + ) -> "_models.StringWrapper": """Get complex types with string properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -754,17 +1066,24 @@ def get_string(self, **kwargs: Any) -> "_models.StringWrapper": :rtype: ~bodycomplexpython3only.models.StringWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StringWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StringWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_request( - template_url=self.get_string.metadata["url"], + template_url=self.get_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -772,17 +1091,22 @@ def get_string(self, **kwargs: Any) -> "_models.StringWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("StringWrapper", pipeline_response) + deserialized = self._deserialize('StringWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + get_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace - def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) -> None: + def put_string( + self, + complex_body: "_models.StringWrapper", + **kwargs: Any + ) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. @@ -792,23 +1116,29 @@ def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "StringWrapper") + _json = self._serialize.body(complex_body, 'StringWrapper') request = build_put_string_request( content_type=content_type, json=_json, - template_url=self.put_string.metadata["url"], + template_url=self.put_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -819,10 +1149,14 @@ def put_string(self, complex_body: "_models.StringWrapper", **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_string.metadata = {"url": "/complex/primitive/string"} # type: ignore + put_string.metadata = {'url': '/complex/primitive/string'} # type: ignore + @distributed_trace - def get_date(self, **kwargs: Any) -> "_models.DateWrapper": + def get_date( + self, + **kwargs: Any + ) -> "_models.DateWrapper": """Get complex types with date properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -830,17 +1164,24 @@ def get_date(self, **kwargs: Any) -> "_models.DateWrapper": :rtype: ~bodycomplexpython3only.models.DateWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DateWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DateWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_request( - template_url=self.get_date.metadata["url"], + template_url=self.get_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -848,17 +1189,22 @@ def get_date(self, **kwargs: Any) -> "_models.DateWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DateWrapper", pipeline_response) + deserialized = self._deserialize('DateWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + get_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace - def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> None: + def put_date( + self, + complex_body: "_models.DateWrapper", + **kwargs: Any + ) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. @@ -868,23 +1214,29 @@ def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DateWrapper") + _json = self._serialize.body(complex_body, 'DateWrapper') request = build_put_date_request( content_type=content_type, json=_json, - template_url=self.put_date.metadata["url"], + template_url=self.put_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -895,10 +1247,14 @@ def put_date(self, complex_body: "_models.DateWrapper", **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_date.metadata = {"url": "/complex/primitive/date"} # type: ignore + put_date.metadata = {'url': '/complex/primitive/date'} # type: ignore + @distributed_trace - def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": + def get_date_time( + self, + **kwargs: Any + ) -> "_models.DatetimeWrapper": """Get complex types with datetime properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -906,17 +1262,24 @@ def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": :rtype: ~bodycomplexpython3only.models.DatetimeWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DatetimeWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatetimeWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_request( - template_url=self.get_date_time.metadata["url"], + template_url=self.get_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -924,17 +1287,22 @@ def get_date_time(self, **kwargs: Any) -> "_models.DatetimeWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DatetimeWrapper", pipeline_response) + deserialized = self._deserialize('DatetimeWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + get_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace - def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: Any) -> None: + def put_date_time( + self, + complex_body: "_models.DatetimeWrapper", + **kwargs: Any + ) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -944,23 +1312,29 @@ def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "DatetimeWrapper") + _json = self._serialize.body(complex_body, 'DatetimeWrapper') request = build_put_date_time_request( content_type=content_type, json=_json, - template_url=self.put_date_time.metadata["url"], + template_url=self.put_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -971,10 +1345,14 @@ def put_date_time(self, complex_body: "_models.DatetimeWrapper", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_date_time.metadata = {"url": "/complex/primitive/datetime"} # type: ignore + put_date_time.metadata = {'url': '/complex/primitive/datetime'} # type: ignore + @distributed_trace - def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123Wrapper": + def get_date_time_rfc1123( + self, + **kwargs: Any + ) -> "_models.Datetimerfc1123Wrapper": """Get complex types with datetimeRfc1123 properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -982,17 +1360,24 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123Wrappe :rtype: ~bodycomplexpython3only.models.Datetimerfc1123Wrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Datetimerfc1123Wrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Datetimerfc1123Wrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_request( - template_url=self.get_date_time_rfc1123.metadata["url"], + template_url=self.get_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1000,17 +1385,22 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> "_models.Datetimerfc1123Wrappe error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Datetimerfc1123Wrapper", pipeline_response) + deserialized = self._deserialize('Datetimerfc1123Wrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + get_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace - def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrapper", **kwargs: Any) -> None: + def put_date_time_rfc1123( + self, + complex_body: "_models.Datetimerfc1123Wrapper", + **kwargs: Any + ) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 @@ -1021,23 +1411,29 @@ def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrapper", :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(complex_body, "Datetimerfc1123Wrapper") + _json = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') request = build_put_date_time_rfc1123_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123.metadata["url"], + template_url=self.put_date_time_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1048,10 +1444,14 @@ def put_date_time_rfc1123(self, complex_body: "_models.Datetimerfc1123Wrapper", if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123.metadata = {"url": "/complex/primitive/datetimerfc1123"} # type: ignore + put_date_time_rfc1123.metadata = {'url': '/complex/primitive/datetimerfc1123'} # type: ignore + @distributed_trace - def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": + def get_duration( + self, + **kwargs: Any + ) -> "_models.DurationWrapper": """Get complex types with duration properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1059,17 +1459,24 @@ def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": :rtype: ~bodycomplexpython3only.models.DurationWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.DurationWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.DurationWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_request( - template_url=self.get_duration.metadata["url"], + template_url=self.get_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1077,17 +1484,22 @@ def get_duration(self, **kwargs: Any) -> "_models.DurationWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("DurationWrapper", pipeline_response) + deserialized = self._deserialize('DurationWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + get_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace - def put_duration(self, field: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: + def put_duration( + self, + field: Optional[datetime.timedelta] = None, + **kwargs: Any + ) -> None: """Put complex types with duration properties. :param field: @@ -1097,24 +1509,30 @@ def put_duration(self, field: Optional[datetime.timedelta] = None, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.DurationWrapper(field=field) - _json = self._serialize.body(_complex_body, "DurationWrapper") + _json = self._serialize.body(_complex_body, 'DurationWrapper') request = build_put_duration_request( content_type=content_type, json=_json, - template_url=self.put_duration.metadata["url"], + template_url=self.put_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1125,10 +1543,14 @@ def put_duration(self, field: Optional[datetime.timedelta] = None, **kwargs: Any if cls: return cls(pipeline_response, None, {}) - put_duration.metadata = {"url": "/complex/primitive/duration"} # type: ignore + put_duration.metadata = {'url': '/complex/primitive/duration'} # type: ignore + @distributed_trace - def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": + def get_byte( + self, + **kwargs: Any + ) -> "_models.ByteWrapper": """Get complex types with byte properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1136,17 +1558,24 @@ def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": :rtype: ~bodycomplexpython3only.models.ByteWrapper :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ByteWrapper"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ByteWrapper"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_request( - template_url=self.get_byte.metadata["url"], + template_url=self.get_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1154,17 +1583,22 @@ def get_byte(self, **kwargs: Any) -> "_models.ByteWrapper": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ByteWrapper", pipeline_response) + deserialized = self._deserialize('ByteWrapper', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + get_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + @distributed_trace - def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> None: + def put_byte( + self, + field: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Put complex types with byte properties. :param field: @@ -1174,24 +1608,30 @@ def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ByteWrapper(field=field) - _json = self._serialize.body(_complex_body, "ByteWrapper") + _json = self._serialize.body(_complex_body, 'ByteWrapper') request = build_put_byte_request( content_type=content_type, json=_json, - template_url=self.put_byte.metadata["url"], + template_url=self.put_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1202,4 +1642,5 @@ def put_byte(self, field: Optional[bytearray] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_byte.metadata = {"url": "/complex/primitive/byte"} # type: ignore + put_byte.metadata = {'url': '/complex/primitive/byte'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations.py index 0f2be4918de..f6c2bf8eae1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/operations/_readonlyproperty_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -24,42 +17,58 @@ from .. import models as _models from .._vendor import _convert_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/readonlyproperty/valid") + url = kwargs.pop("template_url", '/complex/readonlyproperty/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = kwargs.pop("template_url", "/complex/readonlyproperty/valid") + url = kwargs.pop("template_url", '/complex/readonlyproperty/valid') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ReadonlypropertyOperations(object): """ReadonlypropertyOperations operations. @@ -84,7 +93,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": + def get_valid( + self, + **kwargs: Any + ) -> "_models.ReadonlyObj": """Get complex types that have readonly properties. :keyword callable cls: A custom type or function that will be passed the direct response @@ -92,17 +104,24 @@ def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": :rtype: ~bodycomplexpython3only.models.ReadonlyObj :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ReadonlyObj"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReadonlyObj"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_valid_request( - template_url=self.get_valid.metadata["url"], + template_url=self.get_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,17 +129,22 @@ def get_valid(self, **kwargs: Any) -> "_models.ReadonlyObj": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ReadonlyObj", pipeline_response) + deserialized = self._deserialize('ReadonlyObj', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + get_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + @distributed_trace - def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: + def put_valid( + self, + size: Optional[int] = None, + **kwargs: Any + ) -> None: """Put complex types that have readonly properties. :param size: @@ -130,24 +154,30 @@ def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _complex_body = _models.ReadonlyObj(size=size) - _json = self._serialize.body(_complex_body, "ReadonlyObj") + _json = self._serialize.body(_complex_body, 'ReadonlyObj') request = build_put_valid_request( content_type=content_type, json=_json, - template_url=self.put_valid.metadata["url"], + template_url=self.put_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -158,4 +188,5 @@ def put_valid(self, size: Optional[int] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_valid.metadata = {"url": "/complex/readonlyproperty/valid"} # type: ignore + put_valid.metadata = {'url': '/complex/readonlyproperty/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/setup.py index a7ccffb7a49..1d93a53c7c4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/__init__.py index c72e12f3ed2..2e45fd5955d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDateTestService"] +__all__ = ['AutoRestDateTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py index 444afd81232..3d317f7bc9b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestDateTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.date = DateOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_configuration.py index 53d2becacbf..2489f7d7884 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestDateTestServiceConfiguration(Configuration): +class AutoRestDateTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestDateTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestDateTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/__init__.py index a4536c944f2..9a13a3906db 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_date_test_service import AutoRestDateTestService - -__all__ = ["AutoRestDateTestService"] +__all__ = ['AutoRestDateTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py index b6592ee1ad8..531d5c2a8d6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestDateTestServiceConfiguration from .operations import DateOperations - class AutoRestDateTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestDateTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDateTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.date = DateOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_configuration.py index 4f71dfb033d..8de96a567e4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDateTestServiceConfiguration(Configuration): +class AutoRestDateTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/__init__.py index 37869223432..46f6d2d94f5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._date_operations import DateOperations __all__ = [ - "DateOperations", + 'DateOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py index 0b58aa826eb..17085b57612 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,21 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._date_operations import ( - build_get_invalid_date_request, - build_get_max_date_request, - build_get_min_date_request, - build_get_null_request, - build_get_overflow_date_request, - build_get_underflow_date_request, - build_put_max_date_request, - build_put_min_date_request, -) - -T = TypeVar("T") +from ...operations._date_operations import build_get_invalid_date_request, build_get_max_date_request, build_get_min_date_request, build_get_null_request, build_get_overflow_date_request, build_get_underflow_date_request, build_put_max_date_request, build_put_min_date_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DateOperations: """DateOperations async operations. @@ -62,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.date]: """Get null date value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -70,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: :rtype: ~datetime.date or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/date/null"} # type: ignore + get_null.metadata = {'url': '/date/null'} # type: ignore + @distributed_trace_async - async def get_invalid_date(self, **kwargs: Any) -> datetime.date: + async def get_invalid_date( + self, + **kwargs: Any + ) -> datetime.date: """Get invalid date value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -106,17 +102,24 @@ async def get_invalid_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_date_request( - template_url=self.get_invalid_date.metadata["url"], + template_url=self.get_invalid_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,17 +127,21 @@ async def get_invalid_date(self, **kwargs: Any) -> datetime.date: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_date.metadata = {"url": "/date/invaliddate"} # type: ignore + get_invalid_date.metadata = {'url': '/date/invaliddate'} # type: ignore + @distributed_trace_async - async def get_overflow_date(self, **kwargs: Any) -> datetime.date: + async def get_overflow_date( + self, + **kwargs: Any + ) -> datetime.date: """Get overflow date value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -142,17 +149,24 @@ async def get_overflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_date_request( - template_url=self.get_overflow_date.metadata["url"], + template_url=self.get_overflow_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,17 +174,21 @@ async def get_overflow_date(self, **kwargs: Any) -> datetime.date: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow_date.metadata = {"url": "/date/overflowdate"} # type: ignore + get_overflow_date.metadata = {'url': '/date/overflowdate'} # type: ignore + @distributed_trace_async - async def get_underflow_date(self, **kwargs: Any) -> datetime.date: + async def get_underflow_date( + self, + **kwargs: Any + ) -> datetime.date: """Get underflow date value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -178,17 +196,24 @@ async def get_underflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_date_request( - template_url=self.get_underflow_date.metadata["url"], + template_url=self.get_underflow_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -196,17 +221,22 @@ async def get_underflow_date(self, **kwargs: Any) -> datetime.date: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow_date.metadata = {"url": "/date/underflowdate"} # type: ignore + get_underflow_date.metadata = {'url': '/date/underflowdate'} # type: ignore + @distributed_trace_async - async def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: + async def put_max_date( + self, + date_body: datetime.date, + **kwargs: Any + ) -> None: """Put max date value 9999-12-31. :param date_body: date body. @@ -216,23 +246,29 @@ async def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(date_body, "date") + _json = self._serialize.body(date_body, 'date') request = build_put_max_date_request( content_type=content_type, json=_json, - template_url=self.put_max_date.metadata["url"], + template_url=self.put_max_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -243,10 +279,14 @@ async def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_max_date.metadata = {"url": "/date/max"} # type: ignore + put_max_date.metadata = {'url': '/date/max'} # type: ignore + @distributed_trace_async - async def get_max_date(self, **kwargs: Any) -> datetime.date: + async def get_max_date( + self, + **kwargs: Any + ) -> datetime.date: """Get max date value 9999-12-31. :keyword callable cls: A custom type or function that will be passed the direct response @@ -254,17 +294,24 @@ async def get_max_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_max_date_request( - template_url=self.get_max_date.metadata["url"], + template_url=self.get_max_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,17 +319,22 @@ async def get_max_date(self, **kwargs: Any) -> datetime.date: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_max_date.metadata = {"url": "/date/max"} # type: ignore + get_max_date.metadata = {'url': '/date/max'} # type: ignore + @distributed_trace_async - async def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: + async def put_min_date( + self, + date_body: datetime.date, + **kwargs: Any + ) -> None: """Put min date value 0000-01-01. :param date_body: date body. @@ -292,23 +344,29 @@ async def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(date_body, "date") + _json = self._serialize.body(date_body, 'date') request = build_put_min_date_request( content_type=content_type, json=_json, - template_url=self.put_min_date.metadata["url"], + template_url=self.put_min_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -319,10 +377,14 @@ async def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_min_date.metadata = {"url": "/date/min"} # type: ignore + put_min_date.metadata = {'url': '/date/min'} # type: ignore + @distributed_trace_async - async def get_min_date(self, **kwargs: Any) -> datetime.date: + async def get_min_date( + self, + **kwargs: Any + ) -> datetime.date: """Get min date value 0000-01-01. :keyword callable cls: A custom type or function that will be passed the direct response @@ -330,17 +392,24 @@ async def get_min_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_min_date_request( - template_url=self.get_min_date.metadata["url"], + template_url=self.get_min_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -348,11 +417,12 @@ async def get_min_date(self, **kwargs: Any) -> datetime.date: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_min_date.metadata = {"url": "/date/min"} # type: ignore + get_min_date.metadata = {'url': '/date/min'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/__init__.py index 37869223432..46f6d2d94f5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/__init__.py @@ -9,5 +9,5 @@ from ._date_operations import DateOperations __all__ = [ - "DateOperations", + 'DateOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py index 762c45e1698..0c1ab5908c7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -229,7 +221,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[datetime.date] """Get null date value. @@ -239,17 +232,24 @@ def get_null( :rtype: ~datetime.date or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -257,18 +257,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/date/null"} # type: ignore + get_null.metadata = {'url': '/date/null'} # type: ignore + @distributed_trace def get_invalid_date( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.date """Get invalid date value. @@ -278,17 +280,24 @@ def get_invalid_date( :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_date_request( - template_url=self.get_invalid_date.metadata["url"], + template_url=self.get_invalid_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -296,18 +305,20 @@ def get_invalid_date( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_date.metadata = {"url": "/date/invaliddate"} # type: ignore + get_invalid_date.metadata = {'url': '/date/invaliddate'} # type: ignore + @distributed_trace def get_overflow_date( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.date """Get overflow date value. @@ -317,17 +328,24 @@ def get_overflow_date( :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_date_request( - template_url=self.get_overflow_date.metadata["url"], + template_url=self.get_overflow_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -335,18 +353,20 @@ def get_overflow_date( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow_date.metadata = {"url": "/date/overflowdate"} # type: ignore + get_overflow_date.metadata = {'url': '/date/overflowdate'} # type: ignore + @distributed_trace def get_underflow_date( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.date """Get underflow date value. @@ -356,17 +376,24 @@ def get_underflow_date( :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_date_request( - template_url=self.get_underflow_date.metadata["url"], + template_url=self.get_underflow_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -374,14 +401,15 @@ def get_underflow_date( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow_date.metadata = {"url": "/date/underflowdate"} # type: ignore + get_underflow_date.metadata = {'url': '/date/underflowdate'} # type: ignore + @distributed_trace def put_max_date( @@ -399,23 +427,29 @@ def put_max_date( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(date_body, "date") + _json = self._serialize.body(date_body, 'date') request = build_put_max_date_request( content_type=content_type, json=_json, - template_url=self.put_max_date.metadata["url"], + template_url=self.put_max_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -426,11 +460,13 @@ def put_max_date( if cls: return cls(pipeline_response, None, {}) - put_max_date.metadata = {"url": "/date/max"} # type: ignore + put_max_date.metadata = {'url': '/date/max'} # type: ignore + @distributed_trace def get_max_date( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.date """Get max date value 9999-12-31. @@ -440,17 +476,24 @@ def get_max_date( :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_max_date_request( - template_url=self.get_max_date.metadata["url"], + template_url=self.get_max_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,14 +501,15 @@ def get_max_date( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_max_date.metadata = {"url": "/date/max"} # type: ignore + get_max_date.metadata = {'url': '/date/max'} # type: ignore + @distributed_trace def put_min_date( @@ -483,23 +527,29 @@ def put_min_date( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(date_body, "date") + _json = self._serialize.body(date_body, 'date') request = build_put_min_date_request( content_type=content_type, json=_json, - template_url=self.put_min_date.metadata["url"], + template_url=self.put_min_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -510,11 +560,13 @@ def put_min_date( if cls: return cls(pipeline_response, None, {}) - put_min_date.metadata = {"url": "/date/min"} # type: ignore + put_min_date.metadata = {'url': '/date/min'} # type: ignore + @distributed_trace def get_min_date( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.date """Get min date value 0000-01-01. @@ -524,17 +576,24 @@ def get_min_date( :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_min_date_request( - template_url=self.get_min_date.metadata["url"], + template_url=self.get_min_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -542,11 +601,12 @@ def get_min_date( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("date", pipeline_response) + deserialized = self._deserialize('date', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_min_date.metadata = {"url": "/date/min"} # type: ignore + get_min_date.metadata = {'url': '/date/min'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py index 1b7756a102f..5ac60578073 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/__init__.py index df3337616a6..0fd77564071 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDateTimeTestService"] +__all__ = ['AutoRestDateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py index f696f2c0819..2f078df7f25 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestDateTimeTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.datetime = DatetimeOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_configuration.py index 41ec3af9b67..9e3b2c6d312 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestDateTimeTestServiceConfiguration(Configuration): +class AutoRestDateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTimeTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestDateTimeTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestDateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/__init__.py index 11cb96198a2..216b041a4cb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_date_time_test_service import AutoRestDateTimeTestService - -__all__ = ["AutoRestDateTimeTestService"] +__all__ = ['AutoRestDateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py index ade5b4ecf2e..d6ab55979a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestDateTimeTestServiceConfiguration from .operations import DatetimeOperations - class AutoRestDateTimeTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestDateTimeTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDateTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.datetime = DatetimeOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_configuration.py index fece892264c..fb1109a0d47 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDateTimeTestServiceConfiguration(Configuration): +class AutoRestDateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/__init__.py index f44913e89cb..55e140b040f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._datetime_operations import DatetimeOperations __all__ = [ - "DatetimeOperations", + 'DatetimeOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py index 36af5ce4b4f..5b66ecc2f97 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,36 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._datetime_operations import ( - build_get_invalid_request, - build_get_local_negative_offset_lowercase_max_date_time_request, - build_get_local_negative_offset_min_date_time_request, - build_get_local_negative_offset_uppercase_max_date_time_request, - build_get_local_no_offset_min_date_time_request, - build_get_local_positive_offset_lowercase_max_date_time_request, - build_get_local_positive_offset_min_date_time_request, - build_get_local_positive_offset_uppercase_max_date_time_request, - build_get_null_request, - build_get_overflow_request, - build_get_underflow_request, - build_get_utc_lowercase_max_date_time_request, - build_get_utc_min_date_time_request, - build_get_utc_uppercase_max_date_time7_digits_request, - build_get_utc_uppercase_max_date_time_request, - build_put_local_negative_offset_max_date_time_request, - build_put_local_negative_offset_min_date_time_request, - build_put_local_positive_offset_max_date_time_request, - build_put_local_positive_offset_min_date_time_request, - build_put_utc_max_date_time7_digits_request, - build_put_utc_max_date_time_request, - build_put_utc_min_date_time_request, -) - -T = TypeVar("T") +from ...operations._datetime_operations import build_get_invalid_request, build_get_local_negative_offset_lowercase_max_date_time_request, build_get_local_negative_offset_min_date_time_request, build_get_local_negative_offset_uppercase_max_date_time_request, build_get_local_no_offset_min_date_time_request, build_get_local_positive_offset_lowercase_max_date_time_request, build_get_local_positive_offset_min_date_time_request, build_get_local_positive_offset_uppercase_max_date_time_request, build_get_null_request, build_get_overflow_request, build_get_underflow_request, build_get_utc_lowercase_max_date_time_request, build_get_utc_min_date_time_request, build_get_utc_uppercase_max_date_time7_digits_request, build_get_utc_uppercase_max_date_time_request, build_put_local_negative_offset_max_date_time_request, build_put_local_negative_offset_min_date_time_request, build_put_local_positive_offset_max_date_time_request, build_put_local_positive_offset_min_date_time_request, build_put_utc_max_date_time7_digits_request, build_put_utc_max_date_time_request, build_put_utc_min_date_time_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DatetimeOperations: +class DatetimeOperations: # pylint: disable=too-many-public-methods """DatetimeOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -76,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -84,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/datetime/null"} # type: ignore + get_null.metadata = {'url': '/datetime/null'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.datetime: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -120,17 +102,24 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -138,17 +127,21 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/datetime/invalid"} # type: ignore + get_invalid.metadata = {'url': '/datetime/invalid'} # type: ignore + @distributed_trace_async - async def get_overflow(self, **kwargs: Any) -> datetime.datetime: + async def get_overflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get overflow datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -156,17 +149,24 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_request( - template_url=self.get_overflow.metadata["url"], + template_url=self.get_overflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,17 +174,21 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow.metadata = {"url": "/datetime/overflow"} # type: ignore + get_overflow.metadata = {'url': '/datetime/overflow'} # type: ignore + @distributed_trace_async - async def get_underflow(self, **kwargs: Any) -> datetime.datetime: + async def get_underflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get underflow datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -192,17 +196,24 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_request( - template_url=self.get_underflow.metadata["url"], + template_url=self.get_underflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -210,17 +221,22 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow.metadata = {"url": "/datetime/underflow"} # type: ignore + get_underflow.metadata = {'url': '/datetime/underflow'} # type: ignore + @distributed_trace_async - async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value 9999-12-31T23:59:59.999Z. :param datetime_body: datetime body. @@ -230,23 +246,29 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_utc_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_max_date_time.metadata["url"], + template_url=self.put_utc_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -257,10 +279,15 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) - put_utc_max_date_time.metadata = {"url": "/datetime/max/utc"} # type: ignore + put_utc_max_date_time.metadata = {'url': '/datetime/max/utc'} # type: ignore + @distributed_trace_async - async def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_max_date_time7_digits( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -273,23 +300,29 @@ async def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_utc_max_date_time7_digits_request( content_type=content_type, json=_json, - template_url=self.put_utc_max_date_time7_digits.metadata["url"], + template_url=self.put_utc_max_date_time7_digits.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -300,10 +333,14 @@ async def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, if cls: return cls(pipeline_response, None, {}) - put_utc_max_date_time7_digits.metadata = {"url": "/datetime/max/utc7ms"} # type: ignore + put_utc_max_date_time7_digits.metadata = {'url': '/datetime/max/utc7ms'} # type: ignore + @distributed_trace_async - async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31t23:59:59.999z. :keyword callable cls: A custom type or function that will be passed the direct response @@ -311,17 +348,24 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_lowercase_max_date_time_request( - template_url=self.get_utc_lowercase_max_date_time.metadata["url"], + template_url=self.get_utc_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -329,17 +373,21 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_lowercase_max_date_time.metadata = {"url": "/datetime/max/utc/lowercase"} # type: ignore + get_utc_lowercase_max_date_time.metadata = {'url': '/datetime/max/utc/lowercase'} # type: ignore + @distributed_trace_async - async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31T23:59:59.999Z. :keyword callable cls: A custom type or function that will be passed the direct response @@ -347,17 +395,24 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_uppercase_max_date_time_request( - template_url=self.get_utc_uppercase_max_date_time.metadata["url"], + template_url=self.get_utc_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -365,17 +420,21 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_uppercase_max_date_time.metadata = {"url": "/datetime/max/utc/uppercase"} # type: ignore + get_utc_uppercase_max_date_time.metadata = {'url': '/datetime/max/utc/uppercase'} # type: ignore + @distributed_trace_async - async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_uppercase_max_date_time7_digits( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -386,17 +445,24 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_uppercase_max_date_time7_digits_request( - template_url=self.get_utc_uppercase_max_date_time7_digits.metadata["url"], + template_url=self.get_utc_uppercase_max_date_time7_digits.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -404,17 +470,22 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_uppercase_max_date_time7_digits.metadata = {"url": "/datetime/max/utc7ms/uppercase"} # type: ignore + get_utc_uppercase_max_date_time7_digits.metadata = {'url': '/datetime/max/utc7ms/uppercase'} # type: ignore + @distributed_trace_async - async def put_local_positive_offset_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_positive_offset_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. :param datetime_body: datetime body. @@ -424,23 +495,29 @@ async def put_local_positive_offset_max_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_positive_offset_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_positive_offset_max_date_time.metadata["url"], + template_url=self.put_local_positive_offset_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -451,10 +528,14 @@ async def put_local_positive_offset_max_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) - put_local_positive_offset_max_date_time.metadata = {"url": "/datetime/max/localpositiveoffset"} # type: ignore + put_local_positive_offset_max_date_time.metadata = {'url': '/datetime/max/localpositiveoffset'} # type: ignore + @distributed_trace_async - async def get_local_positive_offset_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_positive_offset_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999+14:00. :keyword callable cls: A custom type or function that will be passed the direct response @@ -462,17 +543,24 @@ async def get_local_positive_offset_lowercase_max_date_time(self, **kwargs: Any) :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_positive_offset_lowercase_max_date_time_request( - template_url=self.get_local_positive_offset_lowercase_max_date_time.metadata["url"], + template_url=self.get_local_positive_offset_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -480,17 +568,21 @@ async def get_local_positive_offset_lowercase_max_date_time(self, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_positive_offset_lowercase_max_date_time.metadata = {"url": "/datetime/max/localpositiveoffset/lowercase"} # type: ignore + get_local_positive_offset_lowercase_max_date_time.metadata = {'url': '/datetime/max/localpositiveoffset/lowercase'} # type: ignore + @distributed_trace_async - async def get_local_positive_offset_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_positive_offset_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999+14:00. :keyword callable cls: A custom type or function that will be passed the direct response @@ -498,17 +590,24 @@ async def get_local_positive_offset_uppercase_max_date_time(self, **kwargs: Any) :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_positive_offset_uppercase_max_date_time_request( - template_url=self.get_local_positive_offset_uppercase_max_date_time.metadata["url"], + template_url=self.get_local_positive_offset_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -516,17 +615,22 @@ async def get_local_positive_offset_uppercase_max_date_time(self, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_positive_offset_uppercase_max_date_time.metadata = {"url": "/datetime/max/localpositiveoffset/uppercase"} # type: ignore + get_local_positive_offset_uppercase_max_date_time.metadata = {'url': '/datetime/max/localpositiveoffset/uppercase'} # type: ignore + @distributed_trace_async - async def put_local_negative_offset_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_negative_offset_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. :param datetime_body: datetime body. @@ -536,23 +640,29 @@ async def put_local_negative_offset_max_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_negative_offset_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_negative_offset_max_date_time.metadata["url"], + template_url=self.put_local_negative_offset_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -563,10 +673,14 @@ async def put_local_negative_offset_max_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) - put_local_negative_offset_max_date_time.metadata = {"url": "/datetime/max/localnegativeoffset"} # type: ignore + put_local_negative_offset_max_date_time.metadata = {'url': '/datetime/max/localnegativeoffset'} # type: ignore + @distributed_trace_async - async def get_local_negative_offset_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_negative_offset_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999-14:00. :keyword callable cls: A custom type or function that will be passed the direct response @@ -574,17 +688,24 @@ async def get_local_negative_offset_uppercase_max_date_time(self, **kwargs: Any) :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_negative_offset_uppercase_max_date_time_request( - template_url=self.get_local_negative_offset_uppercase_max_date_time.metadata["url"], + template_url=self.get_local_negative_offset_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -592,17 +713,21 @@ async def get_local_negative_offset_uppercase_max_date_time(self, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_negative_offset_uppercase_max_date_time.metadata = {"url": "/datetime/max/localnegativeoffset/uppercase"} # type: ignore + get_local_negative_offset_uppercase_max_date_time.metadata = {'url': '/datetime/max/localnegativeoffset/uppercase'} # type: ignore + @distributed_trace_async - async def get_local_negative_offset_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_negative_offset_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999-14:00. :keyword callable cls: A custom type or function that will be passed the direct response @@ -610,17 +735,24 @@ async def get_local_negative_offset_lowercase_max_date_time(self, **kwargs: Any) :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_negative_offset_lowercase_max_date_time_request( - template_url=self.get_local_negative_offset_lowercase_max_date_time.metadata["url"], + template_url=self.get_local_negative_offset_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -628,17 +760,22 @@ async def get_local_negative_offset_lowercase_max_date_time(self, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_negative_offset_lowercase_max_date_time.metadata = {"url": "/datetime/max/localnegativeoffset/lowercase"} # type: ignore + get_local_negative_offset_lowercase_max_date_time.metadata = {'url': '/datetime/max/localnegativeoffset/lowercase'} # type: ignore + @distributed_trace_async - async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00Z. :param datetime_body: datetime body. @@ -648,23 +785,29 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_utc_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_min_date_time.metadata["url"], + template_url=self.put_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -675,10 +818,14 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) - put_utc_min_date_time.metadata = {"url": "/datetime/min/utc"} # type: ignore + put_utc_min_date_time.metadata = {'url': '/datetime/min/utc'} # type: ignore + @distributed_trace_async - async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00Z. :keyword callable cls: A custom type or function that will be passed the direct response @@ -686,17 +833,24 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_min_date_time_request( - template_url=self.get_utc_min_date_time.metadata["url"], + template_url=self.get_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -704,17 +858,22 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_min_date_time.metadata = {"url": "/datetime/min/utc"} # type: ignore + get_utc_min_date_time.metadata = {'url': '/datetime/min/utc'} # type: ignore + @distributed_trace_async - async def put_local_positive_offset_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_positive_offset_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00+14:00. :param datetime_body: datetime body. @@ -724,23 +883,29 @@ async def put_local_positive_offset_min_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_positive_offset_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_positive_offset_min_date_time.metadata["url"], + template_url=self.put_local_positive_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -751,10 +916,14 @@ async def put_local_positive_offset_min_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) - put_local_positive_offset_min_date_time.metadata = {"url": "/datetime/min/localpositiveoffset"} # type: ignore + put_local_positive_offset_min_date_time.metadata = {'url': '/datetime/min/localpositiveoffset'} # type: ignore + @distributed_trace_async - async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_positive_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00+14:00. :keyword callable cls: A custom type or function that will be passed the direct response @@ -762,17 +931,24 @@ async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_positive_offset_min_date_time_request( - template_url=self.get_local_positive_offset_min_date_time.metadata["url"], + template_url=self.get_local_positive_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,17 +956,22 @@ async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> dateti error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_positive_offset_min_date_time.metadata = {"url": "/datetime/min/localpositiveoffset"} # type: ignore + get_local_positive_offset_min_date_time.metadata = {'url': '/datetime/min/localpositiveoffset'} # type: ignore + @distributed_trace_async - async def put_local_negative_offset_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_negative_offset_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00-14:00. :param datetime_body: datetime body. @@ -800,23 +981,29 @@ async def put_local_negative_offset_min_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_negative_offset_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_negative_offset_min_date_time.metadata["url"], + template_url=self.put_local_negative_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -827,10 +1014,14 @@ async def put_local_negative_offset_min_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) - put_local_negative_offset_min_date_time.metadata = {"url": "/datetime/min/localnegativeoffset"} # type: ignore + put_local_negative_offset_min_date_time.metadata = {'url': '/datetime/min/localnegativeoffset'} # type: ignore + @distributed_trace_async - async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_negative_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00-14:00. :keyword callable cls: A custom type or function that will be passed the direct response @@ -838,17 +1029,24 @@ async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_negative_offset_min_date_time_request( - template_url=self.get_local_negative_offset_min_date_time.metadata["url"], + template_url=self.get_local_negative_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -856,17 +1054,21 @@ async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> dateti error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_negative_offset_min_date_time.metadata = {"url": "/datetime/min/localnegativeoffset"} # type: ignore + get_local_negative_offset_min_date_time.metadata = {'url': '/datetime/min/localnegativeoffset'} # type: ignore + @distributed_trace_async - async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_no_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00. :keyword callable cls: A custom type or function that will be passed the direct response @@ -874,17 +1076,24 @@ async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_no_offset_min_date_time_request( - template_url=self.get_local_no_offset_min_date_time.metadata["url"], + template_url=self.get_local_no_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -892,11 +1101,12 @@ async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.dat error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_no_offset_min_date_time.metadata = {"url": "/datetime/min/localnooffset"} # type: ignore + get_local_no_offset_min_date_time.metadata = {'url': '/datetime/min/localnooffset'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/__init__.py index f44913e89cb..55e140b040f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/__init__.py @@ -9,5 +9,5 @@ from ._datetime_operations import DatetimeOperations __all__ = [ - "DatetimeOperations", + 'DatetimeOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py index 751774b6976..7c2380cef85 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -505,7 +497,7 @@ def build_get_local_no_offset_min_date_time_request( ) # fmt: on -class DatetimeOperations(object): +class DatetimeOperations(object): # pylint: disable=too-many-public-methods """DatetimeOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -529,7 +521,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[datetime.datetime] """Get null datetime value. @@ -539,17 +532,24 @@ def get_null( :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,18 +557,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/datetime/null"} # type: ignore + get_null.metadata = {'url': '/datetime/null'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get invalid datetime value. @@ -578,17 +580,24 @@ def get_invalid( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,18 +605,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/datetime/invalid"} # type: ignore + get_invalid.metadata = {'url': '/datetime/invalid'} # type: ignore + @distributed_trace def get_overflow( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get overflow datetime value. @@ -617,17 +628,24 @@ def get_overflow( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_request( - template_url=self.get_overflow.metadata["url"], + template_url=self.get_overflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -635,18 +653,20 @@ def get_overflow( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow.metadata = {"url": "/datetime/overflow"} # type: ignore + get_overflow.metadata = {'url': '/datetime/overflow'} # type: ignore + @distributed_trace def get_underflow( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get underflow datetime value. @@ -656,17 +676,24 @@ def get_underflow( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_request( - template_url=self.get_underflow.metadata["url"], + template_url=self.get_underflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -674,14 +701,15 @@ def get_underflow( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow.metadata = {"url": "/datetime/underflow"} # type: ignore + get_underflow.metadata = {'url': '/datetime/underflow'} # type: ignore + @distributed_trace def put_utc_max_date_time( @@ -699,23 +727,29 @@ def put_utc_max_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_utc_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_max_date_time.metadata["url"], + template_url=self.put_utc_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,7 +760,8 @@ def put_utc_max_date_time( if cls: return cls(pipeline_response, None, {}) - put_utc_max_date_time.metadata = {"url": "/datetime/max/utc"} # type: ignore + put_utc_max_date_time.metadata = {'url': '/datetime/max/utc'} # type: ignore + @distributed_trace def put_utc_max_date_time7_digits( @@ -747,23 +782,29 @@ def put_utc_max_date_time7_digits( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_utc_max_date_time7_digits_request( content_type=content_type, json=_json, - template_url=self.put_utc_max_date_time7_digits.metadata["url"], + template_url=self.put_utc_max_date_time7_digits.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -774,11 +815,13 @@ def put_utc_max_date_time7_digits( if cls: return cls(pipeline_response, None, {}) - put_utc_max_date_time7_digits.metadata = {"url": "/datetime/max/utc7ms"} # type: ignore + put_utc_max_date_time7_digits.metadata = {'url': '/datetime/max/utc7ms'} # type: ignore + @distributed_trace def get_utc_lowercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value 9999-12-31t23:59:59.999z. @@ -788,17 +831,24 @@ def get_utc_lowercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_lowercase_max_date_time_request( - template_url=self.get_utc_lowercase_max_date_time.metadata["url"], + template_url=self.get_utc_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -806,18 +856,20 @@ def get_utc_lowercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_lowercase_max_date_time.metadata = {"url": "/datetime/max/utc/lowercase"} # type: ignore + get_utc_lowercase_max_date_time.metadata = {'url': '/datetime/max/utc/lowercase'} # type: ignore + @distributed_trace def get_utc_uppercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value 9999-12-31T23:59:59.999Z. @@ -827,17 +879,24 @@ def get_utc_uppercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_uppercase_max_date_time_request( - template_url=self.get_utc_uppercase_max_date_time.metadata["url"], + template_url=self.get_utc_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -845,18 +904,20 @@ def get_utc_uppercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_uppercase_max_date_time.metadata = {"url": "/datetime/max/utc/uppercase"} # type: ignore + get_utc_uppercase_max_date_time.metadata = {'url': '/datetime/max/utc/uppercase'} # type: ignore + @distributed_trace def get_utc_uppercase_max_date_time7_digits( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value 9999-12-31T23:59:59.9999999Z. @@ -869,17 +930,24 @@ def get_utc_uppercase_max_date_time7_digits( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_uppercase_max_date_time7_digits_request( - template_url=self.get_utc_uppercase_max_date_time7_digits.metadata["url"], + template_url=self.get_utc_uppercase_max_date_time7_digits.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -887,14 +955,15 @@ def get_utc_uppercase_max_date_time7_digits( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_uppercase_max_date_time7_digits.metadata = {"url": "/datetime/max/utc7ms/uppercase"} # type: ignore + get_utc_uppercase_max_date_time7_digits.metadata = {'url': '/datetime/max/utc7ms/uppercase'} # type: ignore + @distributed_trace def put_local_positive_offset_max_date_time( @@ -912,23 +981,29 @@ def put_local_positive_offset_max_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_positive_offset_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_positive_offset_max_date_time.metadata["url"], + template_url=self.put_local_positive_offset_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -939,11 +1014,13 @@ def put_local_positive_offset_max_date_time( if cls: return cls(pipeline_response, None, {}) - put_local_positive_offset_max_date_time.metadata = {"url": "/datetime/max/localpositiveoffset"} # type: ignore + put_local_positive_offset_max_date_time.metadata = {'url': '/datetime/max/localpositiveoffset'} # type: ignore + @distributed_trace def get_local_positive_offset_lowercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value with positive num offset 9999-12-31t23:59:59.999+14:00. @@ -953,17 +1030,24 @@ def get_local_positive_offset_lowercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_positive_offset_lowercase_max_date_time_request( - template_url=self.get_local_positive_offset_lowercase_max_date_time.metadata["url"], + template_url=self.get_local_positive_offset_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -971,18 +1055,20 @@ def get_local_positive_offset_lowercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_positive_offset_lowercase_max_date_time.metadata = {"url": "/datetime/max/localpositiveoffset/lowercase"} # type: ignore + get_local_positive_offset_lowercase_max_date_time.metadata = {'url': '/datetime/max/localpositiveoffset/lowercase'} # type: ignore + @distributed_trace def get_local_positive_offset_uppercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value with positive num offset 9999-12-31T23:59:59.999+14:00. @@ -992,17 +1078,24 @@ def get_local_positive_offset_uppercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_positive_offset_uppercase_max_date_time_request( - template_url=self.get_local_positive_offset_uppercase_max_date_time.metadata["url"], + template_url=self.get_local_positive_offset_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1010,14 +1103,15 @@ def get_local_positive_offset_uppercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_positive_offset_uppercase_max_date_time.metadata = {"url": "/datetime/max/localpositiveoffset/uppercase"} # type: ignore + get_local_positive_offset_uppercase_max_date_time.metadata = {'url': '/datetime/max/localpositiveoffset/uppercase'} # type: ignore + @distributed_trace def put_local_negative_offset_max_date_time( @@ -1035,23 +1129,29 @@ def put_local_negative_offset_max_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_negative_offset_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_negative_offset_max_date_time.metadata["url"], + template_url=self.put_local_negative_offset_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1062,11 +1162,13 @@ def put_local_negative_offset_max_date_time( if cls: return cls(pipeline_response, None, {}) - put_local_negative_offset_max_date_time.metadata = {"url": "/datetime/max/localnegativeoffset"} # type: ignore + put_local_negative_offset_max_date_time.metadata = {'url': '/datetime/max/localnegativeoffset'} # type: ignore + @distributed_trace def get_local_negative_offset_uppercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value with positive num offset 9999-12-31T23:59:59.999-14:00. @@ -1076,17 +1178,24 @@ def get_local_negative_offset_uppercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_negative_offset_uppercase_max_date_time_request( - template_url=self.get_local_negative_offset_uppercase_max_date_time.metadata["url"], + template_url=self.get_local_negative_offset_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1094,18 +1203,20 @@ def get_local_negative_offset_uppercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_negative_offset_uppercase_max_date_time.metadata = {"url": "/datetime/max/localnegativeoffset/uppercase"} # type: ignore + get_local_negative_offset_uppercase_max_date_time.metadata = {'url': '/datetime/max/localnegativeoffset/uppercase'} # type: ignore + @distributed_trace def get_local_negative_offset_lowercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value with positive num offset 9999-12-31t23:59:59.999-14:00. @@ -1115,17 +1226,24 @@ def get_local_negative_offset_lowercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_negative_offset_lowercase_max_date_time_request( - template_url=self.get_local_negative_offset_lowercase_max_date_time.metadata["url"], + template_url=self.get_local_negative_offset_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1133,14 +1251,15 @@ def get_local_negative_offset_lowercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_negative_offset_lowercase_max_date_time.metadata = {"url": "/datetime/max/localnegativeoffset/lowercase"} # type: ignore + get_local_negative_offset_lowercase_max_date_time.metadata = {'url': '/datetime/max/localnegativeoffset/lowercase'} # type: ignore + @distributed_trace def put_utc_min_date_time( @@ -1158,23 +1277,29 @@ def put_utc_min_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_utc_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_min_date_time.metadata["url"], + template_url=self.put_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1185,11 +1310,13 @@ def put_utc_min_date_time( if cls: return cls(pipeline_response, None, {}) - put_utc_min_date_time.metadata = {"url": "/datetime/min/utc"} # type: ignore + put_utc_min_date_time.metadata = {'url': '/datetime/min/utc'} # type: ignore + @distributed_trace def get_utc_min_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get min datetime value 0001-01-01T00:00:00Z. @@ -1199,17 +1326,24 @@ def get_utc_min_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_min_date_time_request( - template_url=self.get_utc_min_date_time.metadata["url"], + template_url=self.get_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1217,14 +1351,15 @@ def get_utc_min_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_min_date_time.metadata = {"url": "/datetime/min/utc"} # type: ignore + get_utc_min_date_time.metadata = {'url': '/datetime/min/utc'} # type: ignore + @distributed_trace def put_local_positive_offset_min_date_time( @@ -1242,23 +1377,29 @@ def put_local_positive_offset_min_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_positive_offset_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_positive_offset_min_date_time.metadata["url"], + template_url=self.put_local_positive_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1269,11 +1410,13 @@ def put_local_positive_offset_min_date_time( if cls: return cls(pipeline_response, None, {}) - put_local_positive_offset_min_date_time.metadata = {"url": "/datetime/min/localpositiveoffset"} # type: ignore + put_local_positive_offset_min_date_time.metadata = {'url': '/datetime/min/localpositiveoffset'} # type: ignore + @distributed_trace def get_local_positive_offset_min_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get min datetime value 0001-01-01T00:00:00+14:00. @@ -1283,17 +1426,24 @@ def get_local_positive_offset_min_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_positive_offset_min_date_time_request( - template_url=self.get_local_positive_offset_min_date_time.metadata["url"], + template_url=self.get_local_positive_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1301,14 +1451,15 @@ def get_local_positive_offset_min_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_positive_offset_min_date_time.metadata = {"url": "/datetime/min/localpositiveoffset"} # type: ignore + get_local_positive_offset_min_date_time.metadata = {'url': '/datetime/min/localpositiveoffset'} # type: ignore + @distributed_trace def put_local_negative_offset_min_date_time( @@ -1326,23 +1477,29 @@ def put_local_negative_offset_min_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "iso-8601") + _json = self._serialize.body(datetime_body, 'iso-8601') request = build_put_local_negative_offset_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_local_negative_offset_min_date_time.metadata["url"], + template_url=self.put_local_negative_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1353,11 +1510,13 @@ def put_local_negative_offset_min_date_time( if cls: return cls(pipeline_response, None, {}) - put_local_negative_offset_min_date_time.metadata = {"url": "/datetime/min/localnegativeoffset"} # type: ignore + put_local_negative_offset_min_date_time.metadata = {'url': '/datetime/min/localnegativeoffset'} # type: ignore + @distributed_trace def get_local_negative_offset_min_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get min datetime value 0001-01-01T00:00:00-14:00. @@ -1367,17 +1526,24 @@ def get_local_negative_offset_min_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_negative_offset_min_date_time_request( - template_url=self.get_local_negative_offset_min_date_time.metadata["url"], + template_url=self.get_local_negative_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1385,18 +1551,20 @@ def get_local_negative_offset_min_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_negative_offset_min_date_time.metadata = {"url": "/datetime/min/localnegativeoffset"} # type: ignore + get_local_negative_offset_min_date_time.metadata = {'url': '/datetime/min/localnegativeoffset'} # type: ignore + @distributed_trace def get_local_no_offset_min_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get min datetime value 0001-01-01T00:00:00. @@ -1406,17 +1574,24 @@ def get_local_no_offset_min_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_no_offset_min_date_time_request( - template_url=self.get_local_no_offset_min_date_time.metadata["url"], + template_url=self.get_local_no_offset_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1424,11 +1599,12 @@ def get_local_no_offset_min_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("iso-8601", pipeline_response) + deserialized = self._deserialize('iso-8601', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_local_no_offset_min_date_time.metadata = {"url": "/datetime/min/localnooffset"} # type: ignore + get_local_no_offset_min_date_time.metadata = {'url': '/datetime/min/localnooffset'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py index e3def2be286..5b3c0852cfa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/__init__.py index baf26fe7155..b1b218fa611 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestRFC1123DateTimeTestService"] +__all__ = ['AutoRestRFC1123DateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py index cd55bcbd43a..dca20eca1d4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestRFC1123DateTimeTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.datetimerfc1123 = Datetimerfc1123Operations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_configuration.py index 4048a5a7f59..ecceffc28e1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): +class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRFC1123DateTimeTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestRFC1123DateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestrfc1123datetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrfc1123datetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/__init__.py index 7cdf4bb0601..4a49b2bc883 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_rfc1123_date_time_test_service import AutoRestRFC1123DateTimeTestService - -__all__ = ["AutoRestRFC1123DateTimeTestService"] +__all__ = ['AutoRestRFC1123DateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py index 68637f1ebb2..3b06f1f5db6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestRFC1123DateTimeTestServiceConfiguration from .operations import Datetimerfc1123Operations - class AutoRestRFC1123DateTimeTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestRFC1123DateTimeTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestRFC1123DateTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.datetimerfc1123 = Datetimerfc1123Operations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_configuration.py index a5f8aa98c35..40ad35ac665 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): +class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRFC1123DateTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestRFC1123DateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestrfc1123datetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrfc1123datetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/__init__.py index a4a84480524..7dc6c064240 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._datetimerfc1123_operations import Datetimerfc1123Operations __all__ = [ - "Datetimerfc1123Operations", + 'Datetimerfc1123Operations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py index 40a8e62b073..8b35a3afb81 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,22 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._datetimerfc1123_operations import ( - build_get_invalid_request, - build_get_null_request, - build_get_overflow_request, - build_get_underflow_request, - build_get_utc_lowercase_max_date_time_request, - build_get_utc_min_date_time_request, - build_get_utc_uppercase_max_date_time_request, - build_put_utc_max_date_time_request, - build_put_utc_min_date_time_request, -) - -T = TypeVar("T") +from ...operations._datetimerfc1123_operations import build_get_invalid_request, build_get_null_request, build_get_overflow_request, build_get_underflow_request, build_get_utc_lowercase_max_date_time_request, build_get_utc_min_date_time_request, build_get_utc_uppercase_max_date_time_request, build_put_utc_max_date_time_request, build_put_utc_min_date_time_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class Datetimerfc1123Operations: """Datetimerfc1123Operations async operations. @@ -63,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -71,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/datetimerfc1123/null"} # type: ignore + get_null.metadata = {'url': '/datetimerfc1123/null'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.datetime: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -107,17 +102,24 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -125,17 +127,21 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/datetimerfc1123/invalid"} # type: ignore + get_invalid.metadata = {'url': '/datetimerfc1123/invalid'} # type: ignore + @distributed_trace_async - async def get_overflow(self, **kwargs: Any) -> datetime.datetime: + async def get_overflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get overflow datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -143,17 +149,24 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_request( - template_url=self.get_overflow.metadata["url"], + template_url=self.get_overflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,17 +174,21 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow.metadata = {"url": "/datetimerfc1123/overflow"} # type: ignore + get_overflow.metadata = {'url': '/datetimerfc1123/overflow'} # type: ignore + @distributed_trace_async - async def get_underflow(self, **kwargs: Any) -> datetime.datetime: + async def get_underflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get underflow datetime value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -179,17 +196,24 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_request( - template_url=self.get_underflow.metadata["url"], + template_url=self.get_underflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -197,17 +221,22 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow.metadata = {"url": "/datetimerfc1123/underflow"} # type: ignore + get_underflow.metadata = {'url': '/datetimerfc1123/underflow'} # type: ignore + @distributed_trace_async - async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. :param datetime_body: datetime body. @@ -217,23 +246,29 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "rfc-1123") + _json = self._serialize.body(datetime_body, 'rfc-1123') request = build_put_utc_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_max_date_time.metadata["url"], + template_url=self.put_utc_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -244,10 +279,14 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) - put_utc_max_date_time.metadata = {"url": "/datetimerfc1123/max"} # type: ignore + put_utc_max_date_time.metadata = {'url': '/datetimerfc1123/max'} # type: ignore + @distributed_trace_async - async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value fri, 31 dec 9999 23:59:59 gmt. :keyword callable cls: A custom type or function that will be passed the direct response @@ -255,17 +294,24 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_lowercase_max_date_time_request( - template_url=self.get_utc_lowercase_max_date_time.metadata["url"], + template_url=self.get_utc_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,17 +319,21 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_lowercase_max_date_time.metadata = {"url": "/datetimerfc1123/max/lowercase"} # type: ignore + get_utc_lowercase_max_date_time.metadata = {'url': '/datetimerfc1123/max/lowercase'} # type: ignore + @distributed_trace_async - async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT. :keyword callable cls: A custom type or function that will be passed the direct response @@ -291,17 +341,24 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_uppercase_max_date_time_request( - template_url=self.get_utc_uppercase_max_date_time.metadata["url"], + template_url=self.get_utc_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -309,17 +366,22 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_uppercase_max_date_time.metadata = {"url": "/datetimerfc1123/max/uppercase"} # type: ignore + get_utc_uppercase_max_date_time.metadata = {'url': '/datetimerfc1123/max/uppercase'} # type: ignore + @distributed_trace_async - async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. :param datetime_body: datetime body. @@ -329,23 +391,29 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "rfc-1123") + _json = self._serialize.body(datetime_body, 'rfc-1123') request = build_put_utc_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_min_date_time.metadata["url"], + template_url=self.put_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -356,10 +424,14 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) - put_utc_min_date_time.metadata = {"url": "/datetimerfc1123/min"} # type: ignore + put_utc_min_date_time.metadata = {'url': '/datetimerfc1123/min'} # type: ignore + @distributed_trace_async - async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT. :keyword callable cls: A custom type or function that will be passed the direct response @@ -367,17 +439,24 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_min_date_time_request( - template_url=self.get_utc_min_date_time.metadata["url"], + template_url=self.get_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -385,11 +464,12 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_min_date_time.metadata = {"url": "/datetimerfc1123/min"} # type: ignore + get_utc_min_date_time.metadata = {'url': '/datetimerfc1123/min'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/__init__.py index a4a84480524..7dc6c064240 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/__init__.py @@ -9,5 +9,5 @@ from ._datetimerfc1123_operations import Datetimerfc1123Operations __all__ = [ - "Datetimerfc1123Operations", + 'Datetimerfc1123Operations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py index 58c083c4c32..5b33286fc5b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -249,7 +241,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[datetime.datetime] """Get null datetime value. @@ -259,17 +252,24 @@ def get_null( :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -277,18 +277,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/datetimerfc1123/null"} # type: ignore + get_null.metadata = {'url': '/datetimerfc1123/null'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get invalid datetime value. @@ -298,17 +300,24 @@ def get_invalid( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -316,18 +325,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/datetimerfc1123/invalid"} # type: ignore + get_invalid.metadata = {'url': '/datetimerfc1123/invalid'} # type: ignore + @distributed_trace def get_overflow( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get overflow datetime value. @@ -337,17 +348,24 @@ def get_overflow( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_request( - template_url=self.get_overflow.metadata["url"], + template_url=self.get_overflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -355,18 +373,20 @@ def get_overflow( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow.metadata = {"url": "/datetimerfc1123/overflow"} # type: ignore + get_overflow.metadata = {'url': '/datetimerfc1123/overflow'} # type: ignore + @distributed_trace def get_underflow( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get underflow datetime value. @@ -376,17 +396,24 @@ def get_underflow( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_request( - template_url=self.get_underflow.metadata["url"], + template_url=self.get_underflow.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -394,14 +421,15 @@ def get_underflow( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow.metadata = {"url": "/datetimerfc1123/underflow"} # type: ignore + get_underflow.metadata = {'url': '/datetimerfc1123/underflow'} # type: ignore + @distributed_trace def put_utc_max_date_time( @@ -419,23 +447,29 @@ def put_utc_max_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "rfc-1123") + _json = self._serialize.body(datetime_body, 'rfc-1123') request = build_put_utc_max_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_max_date_time.metadata["url"], + template_url=self.put_utc_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -446,11 +480,13 @@ def put_utc_max_date_time( if cls: return cls(pipeline_response, None, {}) - put_utc_max_date_time.metadata = {"url": "/datetimerfc1123/max"} # type: ignore + put_utc_max_date_time.metadata = {'url': '/datetimerfc1123/max'} # type: ignore + @distributed_trace def get_utc_lowercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value fri, 31 dec 9999 23:59:59 gmt. @@ -460,17 +496,24 @@ def get_utc_lowercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_lowercase_max_date_time_request( - template_url=self.get_utc_lowercase_max_date_time.metadata["url"], + template_url=self.get_utc_lowercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -478,18 +521,20 @@ def get_utc_lowercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_lowercase_max_date_time.metadata = {"url": "/datetimerfc1123/max/lowercase"} # type: ignore + get_utc_lowercase_max_date_time.metadata = {'url': '/datetimerfc1123/max/lowercase'} # type: ignore + @distributed_trace def get_utc_uppercase_max_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT. @@ -499,17 +544,24 @@ def get_utc_uppercase_max_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_uppercase_max_date_time_request( - template_url=self.get_utc_uppercase_max_date_time.metadata["url"], + template_url=self.get_utc_uppercase_max_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -517,14 +569,15 @@ def get_utc_uppercase_max_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_uppercase_max_date_time.metadata = {"url": "/datetimerfc1123/max/uppercase"} # type: ignore + get_utc_uppercase_max_date_time.metadata = {'url': '/datetimerfc1123/max/uppercase'} # type: ignore + @distributed_trace def put_utc_min_date_time( @@ -542,23 +595,29 @@ def put_utc_min_date_time( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(datetime_body, "rfc-1123") + _json = self._serialize.body(datetime_body, 'rfc-1123') request = build_put_utc_min_date_time_request( content_type=content_type, json=_json, - template_url=self.put_utc_min_date_time.metadata["url"], + template_url=self.put_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -569,11 +628,13 @@ def put_utc_min_date_time( if cls: return cls(pipeline_response, None, {}) - put_utc_min_date_time.metadata = {"url": "/datetimerfc1123/min"} # type: ignore + put_utc_min_date_time.metadata = {'url': '/datetimerfc1123/min'} # type: ignore + @distributed_trace def get_utc_min_date_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT. @@ -583,17 +644,24 @@ def get_utc_min_date_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_utc_min_date_time_request( - template_url=self.get_utc_min_date_time.metadata["url"], + template_url=self.get_utc_min_date_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,11 +669,12 @@ def get_utc_min_date_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("rfc-1123", pipeline_response) + deserialized = self._deserialize('rfc-1123', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_utc_min_date_time.metadata = {"url": "/datetimerfc1123/min"} # type: ignore + get_utc_min_date_time.metadata = {'url': '/datetimerfc1123/min'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py index 8c0de0f8c73..d9e2ec06e9c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/__init__.py index b6681846f67..7cfdf1acafa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATDictionaryService"] +__all__ = ['AutoRestSwaggerBATDictionaryService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_ba_tdictionary_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_ba_tdictionary_service.py index b68702975af..543f592dcb7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_ba_tdictionary_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_ba_tdictionary_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATDictionaryService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_configuration.py index c8d4d966970..6fad7ca9735 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): +class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATDictionaryService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATDictionaryServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatdictionaryservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatdictionaryservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/__init__.py index ed2c0ce5f1a..b6ad0df5d3f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_ba_tdictionary_service import AutoRestSwaggerBATDictionaryService - -__all__ = ["AutoRestSwaggerBATDictionaryService"] +__all__ = ['AutoRestSwaggerBATDictionaryService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_ba_tdictionary_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_ba_tdictionary_service.py index 36955be40f0..e5f3d5d470a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_ba_tdictionary_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_ba_tdictionary_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATDictionaryServiceConfiguration from .operations import DictionaryOperations - class AutoRestSwaggerBATDictionaryService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATDictionaryService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATDictionaryServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_configuration.py index 01218333453..4fc9e0fc602 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): +class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATDictionaryService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATDictionaryServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatdictionaryservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatdictionaryservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/__init__.py index 0a1b8818aa6..591a41bdd0e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._dictionary_operations import DictionaryOperations __all__ = [ - "DictionaryOperations", + 'DictionaryOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py index 7c4cb9173d0..68943986062 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,79 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._dictionary_operations import ( - build_get_array_empty_request, - build_get_array_item_empty_request, - build_get_array_item_null_request, - build_get_array_null_request, - build_get_array_valid_request, - build_get_base64_url_request, - build_get_boolean_invalid_null_request, - build_get_boolean_invalid_string_request, - build_get_boolean_tfft_request, - build_get_byte_invalid_null_request, - build_get_byte_valid_request, - build_get_complex_empty_request, - build_get_complex_item_empty_request, - build_get_complex_item_null_request, - build_get_complex_null_request, - build_get_complex_valid_request, - build_get_date_invalid_chars_request, - build_get_date_invalid_null_request, - build_get_date_time_invalid_chars_request, - build_get_date_time_invalid_null_request, - build_get_date_time_rfc1123_valid_request, - build_get_date_time_valid_request, - build_get_date_valid_request, - build_get_dictionary_empty_request, - build_get_dictionary_item_empty_request, - build_get_dictionary_item_null_request, - build_get_dictionary_null_request, - build_get_dictionary_valid_request, - build_get_double_invalid_null_request, - build_get_double_invalid_string_request, - build_get_double_valid_request, - build_get_duration_valid_request, - build_get_empty_request, - build_get_empty_string_key_request, - build_get_float_invalid_null_request, - build_get_float_invalid_string_request, - build_get_float_valid_request, - build_get_int_invalid_null_request, - build_get_int_invalid_string_request, - build_get_integer_valid_request, - build_get_invalid_request, - build_get_long_invalid_null_request, - build_get_long_invalid_string_request, - build_get_long_valid_request, - build_get_null_key_request, - build_get_null_request, - build_get_null_value_request, - build_get_string_valid_request, - build_get_string_with_invalid_request, - build_get_string_with_null_request, - build_put_array_valid_request, - build_put_boolean_tfft_request, - build_put_byte_valid_request, - build_put_complex_valid_request, - build_put_date_time_rfc1123_valid_request, - build_put_date_time_valid_request, - build_put_date_valid_request, - build_put_dictionary_valid_request, - build_put_double_valid_request, - build_put_duration_valid_request, - build_put_empty_request, - build_put_float_valid_request, - build_put_integer_valid_request, - build_put_long_valid_request, - build_put_string_valid_request, -) - -T = TypeVar("T") +from ...operations._dictionary_operations import build_get_array_empty_request, build_get_array_item_empty_request, build_get_array_item_null_request, build_get_array_null_request, build_get_array_valid_request, build_get_base64_url_request, build_get_boolean_invalid_null_request, build_get_boolean_invalid_string_request, build_get_boolean_tfft_request, build_get_byte_invalid_null_request, build_get_byte_valid_request, build_get_complex_empty_request, build_get_complex_item_empty_request, build_get_complex_item_null_request, build_get_complex_null_request, build_get_complex_valid_request, build_get_date_invalid_chars_request, build_get_date_invalid_null_request, build_get_date_time_invalid_chars_request, build_get_date_time_invalid_null_request, build_get_date_time_rfc1123_valid_request, build_get_date_time_valid_request, build_get_date_valid_request, build_get_dictionary_empty_request, build_get_dictionary_item_empty_request, build_get_dictionary_item_null_request, build_get_dictionary_null_request, build_get_dictionary_valid_request, build_get_double_invalid_null_request, build_get_double_invalid_string_request, build_get_double_valid_request, build_get_duration_valid_request, build_get_empty_request, build_get_empty_string_key_request, build_get_float_invalid_null_request, build_get_float_invalid_string_request, build_get_float_valid_request, build_get_int_invalid_null_request, build_get_int_invalid_string_request, build_get_integer_valid_request, build_get_invalid_request, build_get_long_invalid_null_request, build_get_long_invalid_string_request, build_get_long_valid_request, build_get_null_key_request, build_get_null_request, build_get_null_value_request, build_get_string_valid_request, build_get_string_with_invalid_request, build_get_string_with_null_request, build_put_array_valid_request, build_put_boolean_tfft_request, build_put_byte_valid_request, build_put_complex_valid_request, build_put_date_time_rfc1123_valid_request, build_put_date_time_valid_request, build_put_date_valid_request, build_put_dictionary_valid_request, build_put_double_valid_request, build_put_duration_valid_request, build_put_empty_request, build_put_float_valid_request, build_put_integer_valid_request, build_put_long_valid_request, build_put_string_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DictionaryOperations: +class DictionaryOperations: # pylint: disable=too-many-public-methods """DictionaryOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -119,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Dict[str, int]: + async def get_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get null dictionary value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -127,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/dictionary/null"} # type: ignore + get_null.metadata = {'url': '/dictionary/null'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Dict[str, int]: + async def get_empty( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get empty dictionary value {}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -163,17 +102,24 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -181,17 +127,22 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/dictionary/empty"} # type: ignore + get_empty.metadata = {'url': '/dictionary/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: + async def put_empty( + self, + array_body: Dict[str, str], + **kwargs: Any + ) -> None: """Set dictionary value empty {}. :param array_body: @@ -201,23 +152,29 @@ async def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{str}") + _json = self._serialize.body(array_body, '{str}') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,10 +185,14 @@ async def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/dictionary/empty"} # type: ignore + put_empty.metadata = {'url': '/dictionary/empty'} # type: ignore + @distributed_trace_async - async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: + async def get_null_value( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with null value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -239,17 +200,24 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_value_request( - template_url=self.get_null_value.metadata["url"], + template_url=self.get_null_value.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -257,17 +225,21 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_value.metadata = {"url": "/dictionary/nullvalue"} # type: ignore + get_null_value.metadata = {'url': '/dictionary/nullvalue'} # type: ignore + @distributed_trace_async - async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: + async def get_null_key( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with null key. :keyword callable cls: A custom type or function that will be passed the direct response @@ -275,17 +247,24 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_key_request( - template_url=self.get_null_key.metadata["url"], + template_url=self.get_null_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -293,17 +272,21 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_key.metadata = {"url": "/dictionary/nullkey"} # type: ignore + get_null_key.metadata = {'url': '/dictionary/nullkey'} # type: ignore + @distributed_trace_async - async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: + async def get_empty_string_key( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with key as empty string. :keyword callable cls: A custom type or function that will be passed the direct response @@ -311,17 +294,24 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_string_key_request( - template_url=self.get_empty_string_key.metadata["url"], + template_url=self.get_empty_string_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -329,17 +319,21 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_string_key.metadata = {"url": "/dictionary/keyemptystring"} # type: ignore + get_empty_string_key.metadata = {'url': '/dictionary/keyemptystring'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: + async def get_invalid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get invalid Dictionary value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -347,17 +341,24 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -365,17 +366,21 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/dictionary/invalid"} # type: ignore + get_invalid.metadata = {'url': '/dictionary/invalid'} # type: ignore + @distributed_trace_async - async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: + async def get_boolean_tfft( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true }. :keyword callable cls: A custom type or function that will be passed the direct response @@ -383,17 +388,24 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,17 +413,22 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bool}", pipeline_response) + deserialized = self._deserialize('{bool}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/dictionary/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/dictionary/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> None: + async def put_boolean_tfft( + self, + array_body: Dict[str, bool], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. :param array_body: @@ -421,23 +438,29 @@ async def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{bool}") + _json = self._serialize.body(array_body, '{bool}') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -448,10 +471,14 @@ async def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/dictionary/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/dictionary/prim/boolean/tfft'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: + async def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value {"0": true, "1": null, "2": false }. :keyword callable cls: A custom type or function that will be passed the direct response @@ -459,17 +486,24 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,17 +511,21 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bool}", pipeline_response) + deserialized = self._deserialize('{bool}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/dictionary/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/dictionary/prim/boolean/true.null.false'} # type: ignore + @distributed_trace_async - async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: + async def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -495,17 +533,24 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,17 +558,21 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bool}", pipeline_response) + deserialized = self._deserialize('{bool}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/dictionary/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/dictionary/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace_async - async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: + async def get_integer_valid( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -531,17 +580,24 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -549,17 +605,22 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/dictionary/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/dictionary/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: + async def put_integer_valid( + self, + array_body: Dict[str, int], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. :param array_body: @@ -569,23 +630,29 @@ async def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{int}") + _json = self._serialize.body(array_body, '{int}') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,10 +663,14 @@ async def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/dictionary/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/dictionary/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: + async def get_int_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": null, "2": 0}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -607,17 +678,24 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -625,17 +703,21 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/dictionary/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/dictionary/prim/integer/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: + async def get_int_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": "integer", "2": 0}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -643,17 +725,24 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -661,17 +750,21 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/dictionary/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/dictionary/prim/integer/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: + async def get_long_valid( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -679,17 +772,24 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -697,17 +797,22 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{long}", pipeline_response) + deserialized = self._deserialize('{long}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/dictionary/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/dictionary/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: + async def put_long_valid( + self, + array_body: Dict[str, int], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. :param array_body: @@ -717,23 +822,29 @@ async def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{long}") + _json = self._serialize.body(array_body, '{long}') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -744,10 +855,14 @@ async def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/dictionary/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/dictionary/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace_async - async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: + async def get_long_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get long dictionary value {"0": 1, "1": null, "2": 0}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -755,17 +870,24 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -773,17 +895,21 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{long}", pipeline_response) + deserialized = self._deserialize('{long}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/dictionary/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/dictionary/prim/long/1.null.zero'} # type: ignore + @distributed_trace_async - async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: + async def get_long_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get long dictionary value {"0": 1, "1": "integer", "2": 0}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -791,17 +917,24 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -809,17 +942,21 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{long}", pipeline_response) + deserialized = self._deserialize('{long}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/dictionary/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/dictionary/prim/long/1.integer.0'} # type: ignore + @distributed_trace_async - async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: + async def get_float_valid( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -827,17 +964,24 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -845,17 +989,22 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/dictionary/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/dictionary/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: + async def put_float_valid( + self, + array_body: Dict[str, float], + **kwargs: Any + ) -> None: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :param array_body: @@ -865,23 +1014,29 @@ async def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{float}") + _json = self._serialize.body(array_body, '{float}') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -892,10 +1047,14 @@ async def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/dictionary/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/dictionary/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: + async def get_float_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -903,17 +1062,24 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -921,17 +1087,21 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/dictionary/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/dictionary/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: + async def get_float_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -939,17 +1109,24 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -957,17 +1134,21 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/dictionary/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/dictionary/prim/float/1.number.0'} # type: ignore + @distributed_trace_async - async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: + async def get_double_valid( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -975,17 +1156,24 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -993,17 +1181,22 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/dictionary/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/dictionary/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: + async def put_double_valid( + self, + array_body: Dict[str, float], + **kwargs: Any + ) -> None: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :param array_body: @@ -1013,23 +1206,29 @@ async def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{float}") + _json = self._serialize.body(array_body, '{float}') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1040,10 +1239,14 @@ async def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/dictionary/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/dictionary/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: + async def get_double_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1051,17 +1254,24 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1069,17 +1279,21 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/dictionary/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/dictionary/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace_async - async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: + async def get_double_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1087,17 +1301,24 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1105,17 +1326,21 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/dictionary/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/dictionary/prim/double/1.number.0'} # type: ignore + @distributed_trace_async - async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: + async def get_string_valid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1123,17 +1348,24 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1141,17 +1373,22 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/dictionary/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/dictionary/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> None: + async def put_string_valid( + self, + array_body: Dict[str, str], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. :param array_body: @@ -1161,23 +1398,29 @@ async def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{str}") + _json = self._serialize.body(array_body, '{str}') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1188,10 +1431,14 @@ async def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/dictionary/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/dictionary/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace_async - async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: + async def get_string_with_null( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo", "1": null, "2": "foo2"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1199,17 +1446,24 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1217,17 +1471,21 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/dictionary/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/dictionary/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace_async - async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: + async def get_string_with_invalid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1235,17 +1493,24 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1253,17 +1518,21 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/dictionary/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/dictionary/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace_async - async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: + async def get_date_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1271,17 +1540,24 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: :rtype: dict[str, ~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1289,17 +1565,22 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{date}", pipeline_response) + deserialized = self._deserialize('{date}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/dictionary/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/dictionary/prim/date/valid'} # type: ignore + @distributed_trace_async - async def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: Any) -> None: + async def put_date_valid( + self, + array_body: Dict[str, datetime.date], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. :param array_body: @@ -1309,23 +1590,29 @@ async def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{date}") + _json = self._serialize.body(array_body, '{date}') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1336,10 +1623,14 @@ async def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: A if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/dictionary/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/dictionary/prim/date/valid'} # type: ignore + @distributed_trace_async - async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: + async def get_date_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1347,17 +1638,24 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] :rtype: dict[str, ~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1365,17 +1663,21 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{date}", pipeline_response) + deserialized = self._deserialize('{date}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/dictionary/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/dictionary/prim/date/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: + async def get_date_invalid_chars( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get date dictionary value {"0": "2011-03-22", "1": "date"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1383,17 +1685,24 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date :rtype: dict[str, ~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1401,17 +1710,21 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{date}", pipeline_response) + deserialized = self._deserialize('{date}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/dictionary/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/dictionary/prim/date/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1420,17 +1733,24 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1438,17 +1758,22 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{iso-8601}", pipeline_response) + deserialized = self._deserialize('{iso-8601}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/dictionary/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/dictionary/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_valid( + self, + array_body: Dict[str, datetime.datetime], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1459,23 +1784,29 @@ async def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{iso-8601}") + _json = self._serialize.body(array_body, '{iso-8601}') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1486,10 +1817,14 @@ async def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], ** if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/dictionary/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/dictionary/prim/date-time/valid'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1497,17 +1832,24 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1515,17 +1857,21 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{iso-8601}", pipeline_response) + deserialized = self._deserialize('{iso-8601}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/dictionary/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/dictionary/prim/date-time/invalidnull'} # type: ignore + @distributed_trace_async - async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1533,17 +1879,24 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1551,17 +1904,21 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{iso-8601}", pipeline_response) + deserialized = self._deserialize('{iso-8601}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/dictionary/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/dictionary/prim/date-time/invalidchars'} # type: ignore + @distributed_trace_async - async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1570,17 +1927,24 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1588,17 +1952,22 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{rfc-1123}", pipeline_response) + deserialized = self._deserialize('{rfc-1123}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/dictionary/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/dictionary/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_rfc1123_valid( + self, + array_body: Dict[str, datetime.datetime], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1609,23 +1978,29 @@ async def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datet :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{rfc-1123}") + _json = self._serialize.body(array_body, '{rfc-1123}') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1636,10 +2011,14 @@ async def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datet if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/dictionary/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/dictionary/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace_async - async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: + async def get_duration_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.timedelta]: """Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1647,17 +2026,24 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt :rtype: dict[str, ~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1665,17 +2051,22 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{duration}", pipeline_response) + deserialized = self._deserialize('{duration}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/dictionary/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/dictionary/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], **kwargs: Any) -> None: + async def put_duration_valid( + self, + array_body: Dict[str, datetime.timedelta], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. :param array_body: @@ -1685,23 +2076,29 @@ async def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{duration}") + _json = self._serialize.body(array_body, '{duration}') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1712,10 +2109,14 @@ async def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], ** if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/dictionary/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/dictionary/prim/duration/valid'} # type: ignore + @distributed_trace_async - async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: + async def get_byte_valid( + self, + **kwargs: Any + ) -> Dict[str, bytearray]: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each item encoded in base64. @@ -1724,17 +2125,24 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: :rtype: dict[str, bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1742,17 +2150,22 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bytearray}", pipeline_response) + deserialized = self._deserialize('{bytearray}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/dictionary/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/dictionary/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) -> None: + async def put_byte_valid( + self, + array_body: Dict[str, bytearray], + **kwargs: Any + ) -> None: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -1763,23 +2176,29 @@ async def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{bytearray}") + _json = self._serialize.body(array_body, '{bytearray}') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1790,10 +2209,14 @@ async def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/dictionary/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/dictionary/prim/byte/valid'} # type: ignore + @distributed_trace_async - async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: + async def get_byte_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, bytearray]: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 encoded. @@ -1802,17 +2225,24 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: :rtype: dict[str, bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1820,17 +2250,21 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bytearray}", pipeline_response) + deserialized = self._deserialize('{bytearray}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/dictionary/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/dictionary/prim/byte/invalidnull'} # type: ignore + @distributed_trace_async - async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: + async def get_base64_url( + self, + **kwargs: Any + ) -> Dict[str, bytes]: """Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test string", "2": "Lorem ipsum"}. @@ -1839,17 +2273,24 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: :rtype: dict[str, bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1857,17 +2298,21 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{base64}", pipeline_response) + deserialized = self._deserialize('{base64}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/dictionary/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/dictionary/prim/base64url/valid'} # type: ignore + @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, "_models.Widget"]]: + async def get_complex_null( + self, + **kwargs: Any + ) -> Optional[Dict[str, "_models.Widget"]]: """Get dictionary of complex type null value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1875,17 +2320,24 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, "_models.W :rtype: dict[str, ~bodydictionary.models.Widget] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, "_models.Widget"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, "_models.Widget"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1893,17 +2345,21 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, "_models.W error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/dictionary/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/dictionary/complex/null'} # type: ignore + @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: + async def get_complex_empty( + self, + **kwargs: Any + ) -> Dict[str, "_models.Widget"]: """Get empty dictionary of complex type {}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1911,17 +2367,24 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1929,17 +2392,21 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/dictionary/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/dictionary/complex/empty'} # type: ignore + @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: + async def get_complex_item_null( + self, + **kwargs: Any + ) -> Dict[str, "_models.Widget"]: """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}}. @@ -1948,17 +2415,24 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, "_models.Widge :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1966,17 +2440,21 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, "_models.Widge error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/dictionary/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/dictionary/complex/itemnull'} # type: ignore + @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: + async def get_complex_item_empty( + self, + **kwargs: Any + ) -> Dict[str, "_models.Widget"]: """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}}. @@ -1985,17 +2463,24 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, "_models.Widg :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2003,17 +2488,21 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, "_models.Widg error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/dictionary/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/dictionary/complex/itemempty'} # type: ignore + @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: + async def get_complex_valid( + self, + **kwargs: Any + ) -> Dict[str, "_models.Widget"]: """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2022,17 +2511,24 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2040,17 +2536,22 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, "_models.Widget"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/dictionary/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/dictionary/complex/valid'} # type: ignore + @distributed_trace_async - async def put_complex_valid(self, array_body: Dict[str, "_models.Widget"], **kwargs: Any) -> None: + async def put_complex_valid( + self, + array_body: Dict[str, "_models.Widget"], + **kwargs: Any + ) -> None: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2061,23 +2562,29 @@ async def put_complex_valid(self, array_body: Dict[str, "_models.Widget"], **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{Widget}") + _json = self._serialize.body(array_body, '{Widget}') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2088,10 +2595,14 @@ async def put_complex_valid(self, array_body: Dict[str, "_models.Widget"], **kwa if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/dictionary/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/dictionary/complex/valid'} # type: ignore + @distributed_trace_async - async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: + async def get_array_null( + self, + **kwargs: Any + ) -> Optional[Dict[str, List[str]]]: """Get a null array. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2099,17 +2610,24 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: :rtype: dict[str, list[str]] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, List[str]]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, List[str]]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2117,17 +2635,21 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/dictionary/array/null"} # type: ignore + get_array_null.metadata = {'url': '/dictionary/array/null'} # type: ignore + @distributed_trace_async - async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_empty( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an empty dictionary {}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2135,17 +2657,24 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2153,17 +2682,21 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/dictionary/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/dictionary/array/empty'} # type: ignore + @distributed_trace_async - async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_item_null( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2171,17 +2704,24 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2189,17 +2729,21 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/dictionary/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/dictionary/array/itemnull'} # type: ignore + @distributed_trace_async - async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_item_empty( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2207,17 +2751,24 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2225,17 +2776,21 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/dictionary/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/dictionary/array/itemempty'} # type: ignore + @distributed_trace_async - async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_valid( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2244,17 +2799,24 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2262,17 +2824,22 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/dictionary/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/dictionary/array/valid'} # type: ignore + @distributed_trace_async - async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) -> None: + async def put_array_valid( + self, + array_body: Dict[str, List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2283,23 +2850,29 @@ async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{[str]}") + _json = self._serialize.body(array_body, '{[str]}') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2310,10 +2883,14 @@ async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/dictionary/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/dictionary/array/valid'} # type: ignore + @distributed_trace_async - async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_null( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries with value null. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2321,17 +2898,24 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2339,17 +2923,21 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/dictionary/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/dictionary/dictionary/null'} # type: ignore + @distributed_trace_async - async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_empty( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2357,17 +2945,24 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2375,17 +2970,21 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/dictionary/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/dictionary/dictionary/empty'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_item_null( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2394,17 +2993,24 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2412,17 +3018,21 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/dictionary/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/dictionary/dictionary/itemnull'} # type: ignore + @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2431,17 +3041,24 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2449,17 +3066,21 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/dictionary/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/dictionary/dictionary/itemempty'} # type: ignore + @distributed_trace_async - async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_valid( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2469,17 +3090,24 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2487,17 +3115,22 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/dictionary/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/dictionary/dictionary/valid'} # type: ignore + @distributed_trace_async - async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kwargs: Any) -> None: + async def put_dictionary_valid( + self, + array_body: Dict[str, Dict[str, str]], + **kwargs: Any + ) -> None: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2509,23 +3142,29 @@ async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{{str}}") + _json = self._serialize.body(array_body, '{{str}}') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2536,4 +3175,5 @@ async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kw if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/dictionary/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/dictionary/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py index b943362ba2c..bfa5c95210e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py @@ -14,6 +14,6 @@ from ._models import Widget # type: ignore __all__ = [ - "Error", - "Widget", + 'Error', + 'Widget', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models.py index c187d09f02e..9d4bab8bd80 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class Widget(msrest.serialization.Model): @@ -46,11 +49,14 @@ class Widget(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword integer: :paramtype integer: int @@ -58,5 +64,5 @@ def __init__(self, **kwargs): :paramtype string: str """ super(Widget, self).__init__(**kwargs) - self.integer = kwargs.get("integer", None) - self.string = kwargs.get("string", None) + self.integer = kwargs.get('integer', None) + self.string = kwargs.get('string', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models_py3.py index 0517f130ee7..cec293e1400 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -48,11 +54,17 @@ class Widget(msrest.serialization.Model): """ _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, + 'integer': {'key': 'integer', 'type': 'int'}, + 'string': {'key': 'string', 'type': 'str'}, } - def __init__(self, *, integer: Optional[int] = None, string: Optional[str] = None, **kwargs): + def __init__( + self, + *, + integer: Optional[int] = None, + string: Optional[str] = None, + **kwargs + ): """ :keyword integer: :paramtype integer: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/__init__.py index 0a1b8818aa6..591a41bdd0e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/__init__.py @@ -9,5 +9,5 @@ from ._dictionary_operations import DictionaryOperations __all__ = [ - "DictionaryOperations", + 'DictionaryOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py index 772300276b5..11355966628 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1397,7 +1389,7 @@ def build_put_dictionary_valid_request( ) # fmt: on -class DictionaryOperations(object): +class DictionaryOperations(object): # pylint: disable=too-many-public-methods """DictionaryOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -1421,7 +1413,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get null dictionary value. @@ -1431,17 +1424,24 @@ def get_null( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1449,18 +1449,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/dictionary/null"} # type: ignore + get_null.metadata = {'url': '/dictionary/null'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get empty dictionary value {}. @@ -1470,17 +1472,24 @@ def get_empty( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1488,14 +1497,15 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/dictionary/empty"} # type: ignore + get_empty.metadata = {'url': '/dictionary/empty'} # type: ignore + @distributed_trace def put_empty( @@ -1513,23 +1523,29 @@ def put_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{str}") + _json = self._serialize.body(array_body, '{str}') request = build_put_empty_request( content_type=content_type, json=_json, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1540,11 +1556,13 @@ def put_empty( if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/dictionary/empty"} # type: ignore + put_empty.metadata = {'url': '/dictionary/empty'} # type: ignore + @distributed_trace def get_null_value( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, str] """Get Dictionary with null value. @@ -1554,17 +1572,24 @@ def get_null_value( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_value_request( - template_url=self.get_null_value.metadata["url"], + template_url=self.get_null_value.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1572,18 +1597,20 @@ def get_null_value( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_value.metadata = {"url": "/dictionary/nullvalue"} # type: ignore + get_null_value.metadata = {'url': '/dictionary/nullvalue'} # type: ignore + @distributed_trace def get_null_key( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, str] """Get Dictionary with null key. @@ -1593,17 +1620,24 @@ def get_null_key( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_key_request( - template_url=self.get_null_key.metadata["url"], + template_url=self.get_null_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1611,18 +1645,20 @@ def get_null_key( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_key.metadata = {"url": "/dictionary/nullkey"} # type: ignore + get_null_key.metadata = {'url': '/dictionary/nullkey'} # type: ignore + @distributed_trace def get_empty_string_key( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, str] """Get Dictionary with key as empty string. @@ -1632,17 +1668,24 @@ def get_empty_string_key( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_string_key_request( - template_url=self.get_empty_string_key.metadata["url"], + template_url=self.get_empty_string_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1650,18 +1693,20 @@ def get_empty_string_key( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_string_key.metadata = {"url": "/dictionary/keyemptystring"} # type: ignore + get_empty_string_key.metadata = {'url': '/dictionary/keyemptystring'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, str] """Get invalid Dictionary value. @@ -1671,17 +1716,24 @@ def get_invalid( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1689,18 +1741,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/dictionary/invalid"} # type: ignore + get_invalid.metadata = {'url': '/dictionary/invalid'} # type: ignore + @distributed_trace def get_boolean_tfft( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, bool] """Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true }. @@ -1710,17 +1764,24 @@ def get_boolean_tfft( :rtype: dict[str, bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], + template_url=self.get_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1728,14 +1789,15 @@ def get_boolean_tfft( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bool}", pipeline_response) + deserialized = self._deserialize('{bool}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_tfft.metadata = {"url": "/dictionary/prim/boolean/tfft"} # type: ignore + get_boolean_tfft.metadata = {'url': '/dictionary/prim/boolean/tfft'} # type: ignore + @distributed_trace def put_boolean_tfft( @@ -1753,23 +1815,29 @@ def put_boolean_tfft( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{bool}") + _json = self._serialize.body(array_body, '{bool}') request = build_put_boolean_tfft_request( content_type=content_type, json=_json, - template_url=self.put_boolean_tfft.metadata["url"], + template_url=self.put_boolean_tfft.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1780,11 +1848,13 @@ def put_boolean_tfft( if cls: return cls(pipeline_response, None, {}) - put_boolean_tfft.metadata = {"url": "/dictionary/prim/boolean/tfft"} # type: ignore + put_boolean_tfft.metadata = {'url': '/dictionary/prim/boolean/tfft'} # type: ignore + @distributed_trace def get_boolean_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, bool] """Get boolean dictionary value {"0": true, "1": null, "2": false }. @@ -1794,17 +1864,24 @@ def get_boolean_invalid_null( :rtype: dict[str, bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], + template_url=self.get_boolean_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1812,18 +1889,20 @@ def get_boolean_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bool}", pipeline_response) + deserialized = self._deserialize('{bool}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_null.metadata = {"url": "/dictionary/prim/boolean/true.null.false"} # type: ignore + get_boolean_invalid_null.metadata = {'url': '/dictionary/prim/boolean/true.null.false'} # type: ignore + @distributed_trace def get_boolean_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, bool] """Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}'. @@ -1833,17 +1912,24 @@ def get_boolean_invalid_string( :rtype: dict[str, bool] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], + template_url=self.get_boolean_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1851,18 +1937,20 @@ def get_boolean_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bool}", pipeline_response) + deserialized = self._deserialize('{bool}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_boolean_invalid_string.metadata = {"url": "/dictionary/prim/boolean/true.boolean.false"} # type: ignore + get_boolean_invalid_string.metadata = {'url': '/dictionary/prim/boolean/true.boolean.false'} # type: ignore + @distributed_trace def get_integer_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. @@ -1872,17 +1960,24 @@ def get_integer_valid( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], + template_url=self.get_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1890,14 +1985,15 @@ def get_integer_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_integer_valid.metadata = {"url": "/dictionary/prim/integer/1.-1.3.300"} # type: ignore + get_integer_valid.metadata = {'url': '/dictionary/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def put_integer_valid( @@ -1915,23 +2011,29 @@ def put_integer_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{int}") + _json = self._serialize.body(array_body, '{int}') request = build_put_integer_valid_request( content_type=content_type, json=_json, - template_url=self.put_integer_valid.metadata["url"], + template_url=self.put_integer_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1942,11 +2044,13 @@ def put_integer_valid( if cls: return cls(pipeline_response, None, {}) - put_integer_valid.metadata = {"url": "/dictionary/prim/integer/1.-1.3.300"} # type: ignore + put_integer_valid.metadata = {'url': '/dictionary/prim/integer/1.-1.3.300'} # type: ignore + @distributed_trace def get_int_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get integer dictionary value {"0": 1, "1": null, "2": 0}. @@ -1956,17 +2060,24 @@ def get_int_invalid_null( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], + template_url=self.get_int_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1974,18 +2085,20 @@ def get_int_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_null.metadata = {"url": "/dictionary/prim/integer/1.null.zero"} # type: ignore + get_int_invalid_null.metadata = {'url': '/dictionary/prim/integer/1.null.zero'} # type: ignore + @distributed_trace def get_int_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get integer dictionary value {"0": 1, "1": "integer", "2": 0}. @@ -1995,17 +2108,24 @@ def get_int_invalid_string( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], + template_url=self.get_int_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2013,18 +2133,20 @@ def get_int_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_int_invalid_string.metadata = {"url": "/dictionary/prim/integer/1.integer.0"} # type: ignore + get_int_invalid_string.metadata = {'url': '/dictionary/prim/integer/1.integer.0'} # type: ignore + @distributed_trace def get_long_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. @@ -2034,17 +2156,24 @@ def get_long_valid( :rtype: dict[str, long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], + template_url=self.get_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2052,14 +2181,15 @@ def get_long_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{long}", pipeline_response) + deserialized = self._deserialize('{long}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_valid.metadata = {"url": "/dictionary/prim/long/1.-1.3.300"} # type: ignore + get_long_valid.metadata = {'url': '/dictionary/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def put_long_valid( @@ -2077,23 +2207,29 @@ def put_long_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{long}") + _json = self._serialize.body(array_body, '{long}') request = build_put_long_valid_request( content_type=content_type, json=_json, - template_url=self.put_long_valid.metadata["url"], + template_url=self.put_long_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2104,11 +2240,13 @@ def put_long_valid( if cls: return cls(pipeline_response, None, {}) - put_long_valid.metadata = {"url": "/dictionary/prim/long/1.-1.3.300"} # type: ignore + put_long_valid.metadata = {'url': '/dictionary/prim/long/1.-1.3.300'} # type: ignore + @distributed_trace def get_long_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get long dictionary value {"0": 1, "1": null, "2": 0}. @@ -2118,17 +2256,24 @@ def get_long_invalid_null( :rtype: dict[str, long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], + template_url=self.get_long_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2136,18 +2281,20 @@ def get_long_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{long}", pipeline_response) + deserialized = self._deserialize('{long}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_null.metadata = {"url": "/dictionary/prim/long/1.null.zero"} # type: ignore + get_long_invalid_null.metadata = {'url': '/dictionary/prim/long/1.null.zero'} # type: ignore + @distributed_trace def get_long_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, int] """Get long dictionary value {"0": 1, "1": "integer", "2": 0}. @@ -2157,17 +2304,24 @@ def get_long_invalid_string( :rtype: dict[str, long] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], + template_url=self.get_long_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2175,18 +2329,20 @@ def get_long_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{long}", pipeline_response) + deserialized = self._deserialize('{long}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_long_invalid_string.metadata = {"url": "/dictionary/prim/long/1.integer.0"} # type: ignore + get_long_invalid_string.metadata = {'url': '/dictionary/prim/long/1.integer.0'} # type: ignore + @distributed_trace def get_float_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, float] """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. @@ -2196,17 +2352,24 @@ def get_float_valid( :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], + template_url=self.get_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2214,14 +2377,15 @@ def get_float_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_valid.metadata = {"url": "/dictionary/prim/float/0--0.01-1.2e20"} # type: ignore + get_float_valid.metadata = {'url': '/dictionary/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_float_valid( @@ -2239,23 +2403,29 @@ def put_float_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{float}") + _json = self._serialize.body(array_body, '{float}') request = build_put_float_valid_request( content_type=content_type, json=_json, - template_url=self.put_float_valid.metadata["url"], + template_url=self.put_float_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2266,11 +2436,13 @@ def put_float_valid( if cls: return cls(pipeline_response, None, {}) - put_float_valid.metadata = {"url": "/dictionary/prim/float/0--0.01-1.2e20"} # type: ignore + put_float_valid.metadata = {'url': '/dictionary/prim/float/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, float] """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. @@ -2280,17 +2452,24 @@ def get_float_invalid_null( :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], + template_url=self.get_float_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2298,18 +2477,20 @@ def get_float_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_null.metadata = {"url": "/dictionary/prim/float/0.0-null-1.2e20"} # type: ignore + get_float_invalid_null.metadata = {'url': '/dictionary/prim/float/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_float_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, float] """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. @@ -2319,17 +2500,24 @@ def get_float_invalid_string( :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], + template_url=self.get_float_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2337,18 +2525,20 @@ def get_float_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_float_invalid_string.metadata = {"url": "/dictionary/prim/float/1.number.0"} # type: ignore + get_float_invalid_string.metadata = {'url': '/dictionary/prim/float/1.number.0'} # type: ignore + @distributed_trace def get_double_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, float] """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. @@ -2358,17 +2548,24 @@ def get_double_valid( :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], + template_url=self.get_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2376,14 +2573,15 @@ def get_double_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_valid.metadata = {"url": "/dictionary/prim/double/0--0.01-1.2e20"} # type: ignore + get_double_valid.metadata = {'url': '/dictionary/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def put_double_valid( @@ -2401,23 +2599,29 @@ def put_double_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{float}") + _json = self._serialize.body(array_body, '{float}') request = build_put_double_valid_request( content_type=content_type, json=_json, - template_url=self.put_double_valid.metadata["url"], + template_url=self.put_double_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2428,11 +2632,13 @@ def put_double_valid( if cls: return cls(pipeline_response, None, {}) - put_double_valid.metadata = {"url": "/dictionary/prim/double/0--0.01-1.2e20"} # type: ignore + put_double_valid.metadata = {'url': '/dictionary/prim/double/0--0.01-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, float] """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. @@ -2442,17 +2648,24 @@ def get_double_invalid_null( :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], + template_url=self.get_double_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2460,18 +2673,20 @@ def get_double_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_null.metadata = {"url": "/dictionary/prim/double/0.0-null-1.2e20"} # type: ignore + get_double_invalid_null.metadata = {'url': '/dictionary/prim/double/0.0-null-1.2e20'} # type: ignore + @distributed_trace def get_double_invalid_string( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, float] """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. @@ -2481,17 +2696,24 @@ def get_double_invalid_string( :rtype: dict[str, float] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], + template_url=self.get_double_invalid_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2499,18 +2721,20 @@ def get_double_invalid_string( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{float}", pipeline_response) + deserialized = self._deserialize('{float}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_double_invalid_string.metadata = {"url": "/dictionary/prim/double/1.number.0"} # type: ignore + get_double_invalid_string.metadata = {'url': '/dictionary/prim/double/1.number.0'} # type: ignore + @distributed_trace def get_string_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, str] """Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. @@ -2520,17 +2744,24 @@ def get_string_valid( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], + template_url=self.get_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2538,14 +2769,15 @@ def get_string_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_valid.metadata = {"url": "/dictionary/prim/string/foo1.foo2.foo3"} # type: ignore + get_string_valid.metadata = {'url': '/dictionary/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def put_string_valid( @@ -2563,23 +2795,29 @@ def put_string_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{str}") + _json = self._serialize.body(array_body, '{str}') request = build_put_string_valid_request( content_type=content_type, json=_json, - template_url=self.put_string_valid.metadata["url"], + template_url=self.put_string_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2590,11 +2828,13 @@ def put_string_valid( if cls: return cls(pipeline_response, None, {}) - put_string_valid.metadata = {"url": "/dictionary/prim/string/foo1.foo2.foo3"} # type: ignore + put_string_valid.metadata = {'url': '/dictionary/prim/string/foo1.foo2.foo3'} # type: ignore + @distributed_trace def get_string_with_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, str] """Get string dictionary value {"0": "foo", "1": null, "2": "foo2"}. @@ -2604,17 +2844,24 @@ def get_string_with_null( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], + template_url=self.get_string_with_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2622,18 +2869,20 @@ def get_string_with_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_null.metadata = {"url": "/dictionary/prim/string/foo.null.foo2"} # type: ignore + get_string_with_null.metadata = {'url': '/dictionary/prim/string/foo.null.foo2'} # type: ignore + @distributed_trace def get_string_with_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, str] """Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"}. @@ -2643,17 +2892,24 @@ def get_string_with_invalid( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], + template_url=self.get_string_with_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2661,18 +2917,20 @@ def get_string_with_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{str}", pipeline_response) + deserialized = self._deserialize('{str}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_string_with_invalid.metadata = {"url": "/dictionary/prim/string/foo.123.foo2"} # type: ignore + get_string_with_invalid.metadata = {'url': '/dictionary/prim/string/foo.123.foo2'} # type: ignore + @distributed_trace def get_date_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.date] """Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. @@ -2682,17 +2940,24 @@ def get_date_valid( :rtype: dict[str, ~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], + template_url=self.get_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2700,14 +2965,15 @@ def get_date_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{date}", pipeline_response) + deserialized = self._deserialize('{date}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_valid.metadata = {"url": "/dictionary/prim/date/valid"} # type: ignore + get_date_valid.metadata = {'url': '/dictionary/prim/date/valid'} # type: ignore + @distributed_trace def put_date_valid( @@ -2725,23 +2991,29 @@ def put_date_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{date}") + _json = self._serialize.body(array_body, '{date}') request = build_put_date_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_valid.metadata["url"], + template_url=self.put_date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2752,11 +3024,13 @@ def put_date_valid( if cls: return cls(pipeline_response, None, {}) - put_date_valid.metadata = {"url": "/dictionary/prim/date/valid"} # type: ignore + put_date_valid.metadata = {'url': '/dictionary/prim/date/valid'} # type: ignore + @distributed_trace def get_date_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.date] """Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"}. @@ -2766,17 +3040,24 @@ def get_date_invalid_null( :rtype: dict[str, ~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], + template_url=self.get_date_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2784,18 +3065,20 @@ def get_date_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{date}", pipeline_response) + deserialized = self._deserialize('{date}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_null.metadata = {"url": "/dictionary/prim/date/invalidnull"} # type: ignore + get_date_invalid_null.metadata = {'url': '/dictionary/prim/date/invalidnull'} # type: ignore + @distributed_trace def get_date_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.date] """Get date dictionary value {"0": "2011-03-22", "1": "date"}. @@ -2805,17 +3088,24 @@ def get_date_invalid_chars( :rtype: dict[str, ~datetime.date] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], + template_url=self.get_date_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2823,18 +3113,20 @@ def get_date_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{date}", pipeline_response) + deserialized = self._deserialize('{date}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_invalid_chars.metadata = {"url": "/dictionary/prim/date/invalidchars"} # type: ignore + get_date_invalid_chars.metadata = {'url': '/dictionary/prim/date/invalidchars'} # type: ignore + @distributed_trace def get_date_time_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.datetime] """Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", @@ -2845,17 +3137,24 @@ def get_date_time_valid( :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], + template_url=self.get_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2863,14 +3162,15 @@ def get_date_time_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{iso-8601}", pipeline_response) + deserialized = self._deserialize('{iso-8601}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_valid.metadata = {"url": "/dictionary/prim/date-time/valid"} # type: ignore + get_date_time_valid.metadata = {'url': '/dictionary/prim/date-time/valid'} # type: ignore + @distributed_trace def put_date_time_valid( @@ -2889,23 +3189,29 @@ def put_date_time_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{iso-8601}") + _json = self._serialize.body(array_body, '{iso-8601}') request = build_put_date_time_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_valid.metadata["url"], + template_url=self.put_date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2916,11 +3222,13 @@ def put_date_time_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_valid.metadata = {"url": "/dictionary/prim/date-time/valid"} # type: ignore + put_date_time_valid.metadata = {'url': '/dictionary/prim/date-time/valid'} # type: ignore + @distributed_trace def get_date_time_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.datetime] """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null}. @@ -2930,17 +3238,24 @@ def get_date_time_invalid_null( :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], + template_url=self.get_date_time_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2948,18 +3263,20 @@ def get_date_time_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{iso-8601}", pipeline_response) + deserialized = self._deserialize('{iso-8601}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_null.metadata = {"url": "/dictionary/prim/date-time/invalidnull"} # type: ignore + get_date_time_invalid_null.metadata = {'url': '/dictionary/prim/date-time/invalidnull'} # type: ignore + @distributed_trace def get_date_time_invalid_chars( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.datetime] """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}. @@ -2969,17 +3286,24 @@ def get_date_time_invalid_chars( :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], + template_url=self.get_date_time_invalid_chars.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2987,18 +3311,20 @@ def get_date_time_invalid_chars( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{iso-8601}", pipeline_response) + deserialized = self._deserialize('{iso-8601}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_invalid_chars.metadata = {"url": "/dictionary/prim/date-time/invalidchars"} # type: ignore + get_date_time_invalid_chars.metadata = {'url': '/dictionary/prim/date-time/invalidchars'} # type: ignore + @distributed_trace def get_date_time_rfc1123_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.datetime] """Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan @@ -3009,17 +3335,24 @@ def get_date_time_rfc1123_valid( :rtype: dict[str, ~datetime.datetime] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], + template_url=self.get_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3027,14 +3360,15 @@ def get_date_time_rfc1123_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{rfc-1123}", pipeline_response) + deserialized = self._deserialize('{rfc-1123}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_date_time_rfc1123_valid.metadata = {"url": "/dictionary/prim/date-time-rfc1123/valid"} # type: ignore + get_date_time_rfc1123_valid.metadata = {'url': '/dictionary/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def put_date_time_rfc1123_valid( @@ -3053,23 +3387,29 @@ def put_date_time_rfc1123_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{rfc-1123}") + _json = self._serialize.body(array_body, '{rfc-1123}') request = build_put_date_time_rfc1123_valid_request( content_type=content_type, json=_json, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], + template_url=self.put_date_time_rfc1123_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3080,11 +3420,13 @@ def put_date_time_rfc1123_valid( if cls: return cls(pipeline_response, None, {}) - put_date_time_rfc1123_valid.metadata = {"url": "/dictionary/prim/date-time-rfc1123/valid"} # type: ignore + put_date_time_rfc1123_valid.metadata = {'url': '/dictionary/prim/date-time-rfc1123/valid'} # type: ignore + @distributed_trace def get_duration_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, datetime.timedelta] """Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. @@ -3094,17 +3436,24 @@ def get_duration_valid( :rtype: dict[str, ~datetime.timedelta] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], + template_url=self.get_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3112,14 +3461,15 @@ def get_duration_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{duration}", pipeline_response) + deserialized = self._deserialize('{duration}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_duration_valid.metadata = {"url": "/dictionary/prim/duration/valid"} # type: ignore + get_duration_valid.metadata = {'url': '/dictionary/prim/duration/valid'} # type: ignore + @distributed_trace def put_duration_valid( @@ -3137,23 +3487,29 @@ def put_duration_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{duration}") + _json = self._serialize.body(array_body, '{duration}') request = build_put_duration_valid_request( content_type=content_type, json=_json, - template_url=self.put_duration_valid.metadata["url"], + template_url=self.put_duration_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3164,11 +3520,13 @@ def put_duration_valid( if cls: return cls(pipeline_response, None, {}) - put_duration_valid.metadata = {"url": "/dictionary/prim/duration/valid"} # type: ignore + put_duration_valid.metadata = {'url': '/dictionary/prim/duration/valid'} # type: ignore + @distributed_trace def get_byte_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, bytearray] """Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} @@ -3179,17 +3537,24 @@ def get_byte_valid( :rtype: dict[str, bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], + template_url=self.get_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3197,14 +3562,15 @@ def get_byte_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bytearray}", pipeline_response) + deserialized = self._deserialize('{bytearray}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_valid.metadata = {"url": "/dictionary/prim/byte/valid"} # type: ignore + get_byte_valid.metadata = {'url': '/dictionary/prim/byte/valid'} # type: ignore + @distributed_trace def put_byte_valid( @@ -3223,23 +3589,29 @@ def put_byte_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{bytearray}") + _json = self._serialize.body(array_body, '{bytearray}') request = build_put_byte_valid_request( content_type=content_type, json=_json, - template_url=self.put_byte_valid.metadata["url"], + template_url=self.put_byte_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3250,11 +3622,13 @@ def put_byte_valid( if cls: return cls(pipeline_response, None, {}) - put_byte_valid.metadata = {"url": "/dictionary/prim/byte/valid"} # type: ignore + put_byte_valid.metadata = {'url': '/dictionary/prim/byte/valid'} # type: ignore + @distributed_trace def get_byte_invalid_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, bytearray] """Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 @@ -3265,17 +3639,24 @@ def get_byte_invalid_null( :rtype: dict[str, bytearray] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], + template_url=self.get_byte_invalid_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3283,18 +3664,20 @@ def get_byte_invalid_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{bytearray}", pipeline_response) + deserialized = self._deserialize('{bytearray}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_byte_invalid_null.metadata = {"url": "/dictionary/prim/byte/invalidnull"} # type: ignore + get_byte_invalid_null.metadata = {'url': '/dictionary/prim/byte/invalidnull'} # type: ignore + @distributed_trace def get_base64_url( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, bytes] """Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test @@ -3305,17 +3688,24 @@ def get_base64_url( :rtype: dict[str, bytes] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], + template_url=self.get_base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3323,18 +3713,20 @@ def get_base64_url( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{base64}", pipeline_response) + deserialized = self._deserialize('{base64}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url.metadata = {"url": "/dictionary/prim/base64url/valid"} # type: ignore + get_base64_url.metadata = {'url': '/dictionary/prim/base64url/valid'} # type: ignore + @distributed_trace def get_complex_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[Dict[str, "_models.Widget"]] """Get dictionary of complex type null value. @@ -3344,17 +3736,24 @@ def get_complex_null( :rtype: dict[str, ~bodydictionary.models.Widget] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, "_models.Widget"]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, "_models.Widget"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], + template_url=self.get_complex_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3362,18 +3761,20 @@ def get_complex_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_null.metadata = {"url": "/dictionary/complex/null"} # type: ignore + get_complex_null.metadata = {'url': '/dictionary/complex/null'} # type: ignore + @distributed_trace def get_complex_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, "_models.Widget"] """Get empty dictionary of complex type {}. @@ -3383,17 +3784,24 @@ def get_complex_empty( :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], + template_url=self.get_complex_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3401,18 +3809,20 @@ def get_complex_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_empty.metadata = {"url": "/dictionary/complex/empty"} # type: ignore + get_complex_empty.metadata = {'url': '/dictionary/complex/empty'} # type: ignore + @distributed_trace def get_complex_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, "_models.Widget"] """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, @@ -3423,17 +3833,24 @@ def get_complex_item_null( :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], + template_url=self.get_complex_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3441,18 +3858,20 @@ def get_complex_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_null.metadata = {"url": "/dictionary/complex/itemnull"} # type: ignore + get_complex_item_null.metadata = {'url': '/dictionary/complex/itemnull'} # type: ignore + @distributed_trace def get_complex_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, "_models.Widget"] """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, @@ -3463,17 +3882,24 @@ def get_complex_item_empty( :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], + template_url=self.get_complex_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3481,18 +3907,20 @@ def get_complex_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_item_empty.metadata = {"url": "/dictionary/complex/itemempty"} # type: ignore + get_complex_item_empty.metadata = {'url': '/dictionary/complex/itemempty'} # type: ignore + @distributed_trace def get_complex_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, "_models.Widget"] """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, @@ -3503,17 +3931,24 @@ def get_complex_valid( :rtype: dict[str, ~bodydictionary.models.Widget] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.Widget"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.Widget"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], + template_url=self.get_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3521,14 +3956,15 @@ def get_complex_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{Widget}", pipeline_response) + deserialized = self._deserialize('{Widget}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_valid.metadata = {"url": "/dictionary/complex/valid"} # type: ignore + get_complex_valid.metadata = {'url': '/dictionary/complex/valid'} # type: ignore + @distributed_trace def put_complex_valid( @@ -3547,23 +3983,29 @@ def put_complex_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{Widget}") + _json = self._serialize.body(array_body, '{Widget}') request = build_put_complex_valid_request( content_type=content_type, json=_json, - template_url=self.put_complex_valid.metadata["url"], + template_url=self.put_complex_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3574,11 +4016,13 @@ def put_complex_valid( if cls: return cls(pipeline_response, None, {}) - put_complex_valid.metadata = {"url": "/dictionary/complex/valid"} # type: ignore + put_complex_valid.metadata = {'url': '/dictionary/complex/valid'} # type: ignore + @distributed_trace def get_array_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[Dict[str, List[str]]] """Get a null array. @@ -3588,17 +4032,24 @@ def get_array_null( :rtype: dict[str, list[str]] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, List[str]]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, List[str]]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], + template_url=self.get_array_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3606,18 +4057,20 @@ def get_array_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_null.metadata = {"url": "/dictionary/array/null"} # type: ignore + get_array_null.metadata = {'url': '/dictionary/array/null'} # type: ignore + @distributed_trace def get_array_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, List[str]] """Get an empty dictionary {}. @@ -3627,17 +4080,24 @@ def get_array_empty( :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], + template_url=self.get_array_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3645,18 +4105,20 @@ def get_array_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_empty.metadata = {"url": "/dictionary/array/empty"} # type: ignore + get_array_empty.metadata = {'url': '/dictionary/array/empty'} # type: ignore + @distributed_trace def get_array_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, List[str]] """Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]}. @@ -3666,17 +4128,24 @@ def get_array_item_null( :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], + template_url=self.get_array_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3684,18 +4153,20 @@ def get_array_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_null.metadata = {"url": "/dictionary/array/itemnull"} # type: ignore + get_array_item_null.metadata = {'url': '/dictionary/array/itemnull'} # type: ignore + @distributed_trace def get_array_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, List[str]] """Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}. @@ -3705,17 +4176,24 @@ def get_array_item_empty( :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], + template_url=self.get_array_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3723,18 +4201,20 @@ def get_array_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_item_empty.metadata = {"url": "/dictionary/array/itemempty"} # type: ignore + get_array_item_empty.metadata = {'url': '/dictionary/array/itemempty'} # type: ignore + @distributed_trace def get_array_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, List[str]] """Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", @@ -3745,17 +4225,24 @@ def get_array_valid( :rtype: dict[str, list[str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], + template_url=self.get_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3763,14 +4250,15 @@ def get_array_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{[str]}", pipeline_response) + deserialized = self._deserialize('{[str]}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array_valid.metadata = {"url": "/dictionary/array/valid"} # type: ignore + get_array_valid.metadata = {'url': '/dictionary/array/valid'} # type: ignore + @distributed_trace def put_array_valid( @@ -3789,23 +4277,29 @@ def put_array_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{[str]}") + _json = self._serialize.body(array_body, '{[str]}') request = build_put_array_valid_request( content_type=content_type, json=_json, - template_url=self.put_array_valid.metadata["url"], + template_url=self.put_array_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3816,11 +4310,13 @@ def put_array_valid( if cls: return cls(pipeline_response, None, {}) - put_array_valid.metadata = {"url": "/dictionary/array/valid"} # type: ignore + put_array_valid.metadata = {'url': '/dictionary/array/valid'} # type: ignore + @distributed_trace def get_dictionary_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries with value null. @@ -3830,17 +4326,24 @@ def get_dictionary_null( :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], + template_url=self.get_dictionary_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3848,18 +4351,20 @@ def get_dictionary_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_null.metadata = {"url": "/dictionary/dictionary/null"} # type: ignore + get_dictionary_null.metadata = {'url': '/dictionary/dictionary/null'} # type: ignore + @distributed_trace def get_dictionary_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {}. @@ -3869,17 +4374,24 @@ def get_dictionary_empty( :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], + template_url=self.get_dictionary_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3887,18 +4399,20 @@ def get_dictionary_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_empty.metadata = {"url": "/dictionary/dictionary/empty"} # type: ignore + get_dictionary_empty.metadata = {'url': '/dictionary/dictionary/empty'} # type: ignore + @distributed_trace def get_dictionary_item_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": @@ -3909,17 +4423,24 @@ def get_dictionary_item_null( :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], + template_url=self.get_dictionary_item_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3927,18 +4448,20 @@ def get_dictionary_item_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_null.metadata = {"url": "/dictionary/dictionary/itemnull"} # type: ignore + get_dictionary_item_null.metadata = {'url': '/dictionary/dictionary/itemnull'} # type: ignore + @distributed_trace def get_dictionary_item_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": @@ -3949,17 +4472,24 @@ def get_dictionary_item_empty( :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], + template_url=self.get_dictionary_item_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -3967,18 +4497,20 @@ def get_dictionary_item_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_item_empty.metadata = {"url": "/dictionary/dictionary/itemempty"} # type: ignore + get_dictionary_item_empty.metadata = {'url': '/dictionary/dictionary/itemempty'} # type: ignore + @distributed_trace def get_dictionary_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": @@ -3990,17 +4522,24 @@ def get_dictionary_valid( :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], + template_url=self.get_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4008,14 +4547,15 @@ def get_dictionary_valid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{{str}}", pipeline_response) + deserialized = self._deserialize('{{str}}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary_valid.metadata = {"url": "/dictionary/dictionary/valid"} # type: ignore + get_dictionary_valid.metadata = {'url': '/dictionary/dictionary/valid'} # type: ignore + @distributed_trace def put_dictionary_valid( @@ -4035,23 +4575,29 @@ def put_dictionary_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(array_body, "{{str}}") + _json = self._serialize.body(array_body, '{{str}}') request = build_put_dictionary_valid_request( content_type=content_type, json=_json, - template_url=self.put_dictionary_valid.metadata["url"], + template_url=self.put_dictionary_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -4062,4 +4608,5 @@ def put_dictionary_valid( if cls: return cls(pipeline_response, None, {}) - put_dictionary_valid.metadata = {"url": "/dictionary/dictionary/valid"} # type: ignore + put_dictionary_valid.metadata = {'url': '/dictionary/dictionary/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py index 17faa081a7f..75ab9f722ed 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/__init__.py index 623e438eb9c..48ac23f1972 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py index 58cce5ae7e9..aec78df4db0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestDurationTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_configuration.py index 8b18f16d3f2..73291612c7c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestDurationTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/__init__.py index ecd1d021c33..2db0a55fdb1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_duration_test_service import AutoRestDurationTestService - -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py index d870240475e..0e6c1e470e3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestDurationTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_configuration.py index f7cece514e6..5994e663a71 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/__init__.py index 807183c47fe..6bb953af616 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._duration_operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py index c5e046e5f25..8e509c3d630 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,17 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._duration_operations import ( - build_get_invalid_request, - build_get_null_request, - build_get_positive_duration_request, - build_put_positive_duration_request, -) - -T = TypeVar("T") +from ...operations._duration_operations import build_get_invalid_request, build_get_null_request, build_get_positive_duration_request, build_put_positive_duration_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DurationOperations: """DurationOperations async operations. @@ -58,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.timedelta]: """Get null duration value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -66,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,17 +80,22 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/duration/null"} # type: ignore + get_null.metadata = {'url': '/duration/null'} # type: ignore + @distributed_trace_async - async def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any) -> None: + async def put_positive_duration( + self, + duration_body: datetime.timedelta, + **kwargs: Any + ) -> None: """Put a positive duration value. :param duration_body: duration body. @@ -104,23 +105,29 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(duration_body, "duration") + _json = self._serialize.body(duration_body, 'duration') request = build_put_positive_duration_request( content_type=content_type, json=_json, - template_url=self.put_positive_duration.metadata["url"], + template_url=self.put_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,10 +138,14 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg if cls: return cls(pipeline_response, None, {}) - put_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + put_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace_async - async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: + async def get_positive_duration( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get a positive duration value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -142,17 +153,24 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_positive_duration_request( - template_url=self.get_positive_duration.metadata["url"], + template_url=self.get_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,17 +178,21 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + get_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get an invalid duration value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -178,17 +200,24 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -196,11 +225,12 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/duration/invalid"} # type: ignore + get_invalid.metadata = {'url': '/duration/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/__init__.py index 807183c47fe..6bb953af616 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/__init__.py @@ -9,5 +9,5 @@ from ._duration_operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py index e1dce8db854..187274c3a82 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -145,7 +137,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[datetime.timedelta] """Get null duration value. @@ -155,17 +148,24 @@ def get_null( :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,14 +173,15 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/duration/null"} # type: ignore + get_null.metadata = {'url': '/duration/null'} # type: ignore + @distributed_trace def put_positive_duration( @@ -198,23 +199,29 @@ def put_positive_duration( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(duration_body, "duration") + _json = self._serialize.body(duration_body, 'duration') request = build_put_positive_duration_request( content_type=content_type, json=_json, - template_url=self.put_positive_duration.metadata["url"], + template_url=self.put_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -225,11 +232,13 @@ def put_positive_duration( if cls: return cls(pipeline_response, None, {}) - put_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + put_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace def get_positive_duration( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.timedelta """Get a positive duration value. @@ -239,17 +248,24 @@ def get_positive_duration( :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_positive_duration_request( - template_url=self.get_positive_duration.metadata["url"], + template_url=self.get_positive_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -257,18 +273,20 @@ def get_positive_duration( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_positive_duration.metadata = {"url": "/duration/positiveduration"} # type: ignore + get_positive_duration.metadata = {'url': '/duration/positiveduration'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.timedelta """Get an invalid duration value. @@ -278,17 +296,24 @@ def get_invalid( :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -296,11 +321,12 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("duration", pipeline_response) + deserialized = self._deserialize('duration', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/duration/invalid"} # type: ignore + get_invalid.metadata = {'url': '/duration/invalid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py index 385afe6573c..05c0d98d9d2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/__init__.py index fedd7c51bff..b7164036958 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATFileService"] +__all__ = ['AutoRestSwaggerBATFileService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py index ae2b0a3219a..1277eb0dbbc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATFileService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_configuration.py index 06ec4ffc805..1094f0041f3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATFileServiceConfiguration(Configuration): +class AutoRestSwaggerBATFileServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFileService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATFileServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATFileServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatfileservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatfileservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/__init__.py index be4bf5f38d9..23e0f2a3206 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_file_service import AutoRestSwaggerBATFileService - -__all__ = ["AutoRestSwaggerBATFileService"] +__all__ = ['AutoRestSwaggerBATFileService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py index 379fbe91727..e2241820fbb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATFileServiceConfiguration from .operations import FilesOperations - class AutoRestSwaggerBATFileService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATFileService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATFileServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_configuration.py index 668abb62f8e..f8818da4138 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATFileServiceConfiguration(Configuration): +class AutoRestSwaggerBATFileServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFileService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFileServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatfileservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatfileservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/__init__.py index c8731816af1..43d9f44d66a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._files_operations import FilesOperations __all__ = [ - "FilesOperations", + 'FilesOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py index caa76d0a848..1dd792f6f17 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, IO, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,16 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._files_operations import ( - build_get_empty_file_request, - build_get_file_large_request, - build_get_file_request, -) - -T = TypeVar("T") +from ...operations._files_operations import build_get_empty_file_request, build_get_file_large_request, build_get_file_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FilesOperations: """FilesOperations async operations. @@ -56,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_file(self, **kwargs: Any) -> IO: + async def get_file( + self, + **kwargs: Any + ) -> IO: """Get file. :keyword callable cls: A custom type or function that will be passed the direct response @@ -64,17 +54,24 @@ async def get_file(self, **kwargs: Any) -> IO: :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_file_request( - template_url=self.get_file.metadata["url"], + template_url=self.get_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,10 +86,14 @@ async def get_file(self, **kwargs: Any) -> IO: return deserialized - get_file.metadata = {"url": "/files/stream/nonempty"} # type: ignore + get_file.metadata = {'url': '/files/stream/nonempty'} # type: ignore + @distributed_trace_async - async def get_file_large(self, **kwargs: Any) -> IO: + async def get_file_large( + self, + **kwargs: Any + ) -> IO: """Get a large file. :keyword callable cls: A custom type or function that will be passed the direct response @@ -100,17 +101,24 @@ async def get_file_large(self, **kwargs: Any) -> IO: :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_file_large_request( - template_url=self.get_file_large.metadata["url"], + template_url=self.get_file_large.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -125,10 +133,14 @@ async def get_file_large(self, **kwargs: Any) -> IO: return deserialized - get_file_large.metadata = {"url": "/files/stream/verylarge"} # type: ignore + get_file_large.metadata = {'url': '/files/stream/verylarge'} # type: ignore + @distributed_trace_async - async def get_empty_file(self, **kwargs: Any) -> IO: + async def get_empty_file( + self, + **kwargs: Any + ) -> IO: """Get empty file. :keyword callable cls: A custom type or function that will be passed the direct response @@ -136,17 +148,24 @@ async def get_empty_file(self, **kwargs: Any) -> IO: :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_file_request( - template_url=self.get_empty_file.metadata["url"], + template_url=self.get_empty_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,4 +180,5 @@ async def get_empty_file(self, **kwargs: Any) -> IO: return deserialized - get_empty_file.metadata = {"url": "/files/stream/empty"} # type: ignore + get_empty_file.metadata = {'url': '/files/stream/empty'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/__init__.py index c8731816af1..43d9f44d66a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/__init__.py @@ -9,5 +9,5 @@ from ._files_operations import FilesOperations __all__ = [ - "FilesOperations", + 'FilesOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py index b7cc2ed23bd..ffa861fd8e5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, IO, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -120,7 +112,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_file( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> IO """Get file. @@ -130,17 +123,24 @@ def get_file( :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_file_request( - template_url=self.get_file.metadata["url"], + template_url=self.get_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -155,11 +155,13 @@ def get_file( return deserialized - get_file.metadata = {"url": "/files/stream/nonempty"} # type: ignore + get_file.metadata = {'url': '/files/stream/nonempty'} # type: ignore + @distributed_trace def get_file_large( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> IO """Get a large file. @@ -169,17 +171,24 @@ def get_file_large( :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_file_large_request( - template_url=self.get_file_large.metadata["url"], + template_url=self.get_file_large.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,11 +203,13 @@ def get_file_large( return deserialized - get_file_large.metadata = {"url": "/files/stream/verylarge"} # type: ignore + get_file_large.metadata = {'url': '/files/stream/verylarge'} # type: ignore + @distributed_trace def get_empty_file( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> IO """Get empty file. @@ -208,17 +219,24 @@ def get_empty_file( :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_file_request( - template_url=self.get_empty_file.metadata["url"], + template_url=self.get_empty_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,4 +251,5 @@ def get_empty_file( return deserialized - get_empty_file.metadata = {"url": "/files/stream/empty"} # type: ignore + get_empty_file.metadata = {'url': '/files/stream/empty'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py index da0628aad71..fbaa7e44694 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/__init__.py index 3778d845e32..2c1d02ebfdb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATFormDataService"] +__all__ = ['AutoRestSwaggerBATFormDataService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py index 23a0239ad95..556e92d14ba 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATFormDataService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.formdata = FormdataOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_configuration.py index 7e429aea40b..fb6e2f8ae6b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): +class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFormDataService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATFormDataServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatformdataservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatformdataservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/__init__.py index e27460706e4..255b1419e0b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_form_data_service import AutoRestSwaggerBATFormDataService - -__all__ = ["AutoRestSwaggerBATFormDataService"] +__all__ = ['AutoRestSwaggerBATFormDataService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py index cbbcf09b357..274a0fd7d00 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATFormDataServiceConfiguration from .operations import FormdataOperations - class AutoRestSwaggerBATFormDataService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATFormDataService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATFormDataServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.formdata = FormdataOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_configuration.py index 6728a757294..c1c299343e5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): +class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFormDataService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFormDataServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatformdataservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatformdataservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/__init__.py index 2f2f5503a3a..5d0ff2b3dda 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._formdata_operations import FormdataOperations __all__ = [ - "FormdataOperations", + 'FormdataOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py index 1a10afe6d48..7b187fdcb46 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,16 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._formdata_operations import ( - build_upload_file_request, - build_upload_file_via_body_request, - build_upload_files_request, -) - -T = TypeVar("T") +from ...operations._formdata_operations import build_upload_file_request, build_upload_file_via_body_request, build_upload_files_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FormdataOperations: """FormdataOperations async operations. @@ -56,7 +43,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def upload_file(self, file_content: IO, file_name: str, **kwargs: Any) -> IO: + async def upload_file( + self, + file_content: IO, + file_name: str, + **kwargs: Any + ) -> IO: """Upload file. :param file_content: File to upload. @@ -68,11 +60,13 @@ async def upload_file(self, file_content: IO, file_name: str, **kwargs: Any) -> :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct form data _files = { @@ -83,12 +77,16 @@ async def upload_file(self, file_content: IO, file_name: str, **kwargs: Any) -> request = build_upload_file_request( content_type=content_type, files=_files, - template_url=self.upload_file.metadata["url"], + template_url=self.upload_file.metadata['url'], ) request = _convert_request(request, _files) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,10 +101,15 @@ async def upload_file(self, file_content: IO, file_name: str, **kwargs: Any) -> return deserialized - upload_file.metadata = {"url": "/formdata/stream/uploadfile"} # type: ignore + upload_file.metadata = {'url': '/formdata/stream/uploadfile'} # type: ignore + @distributed_trace_async - async def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: + async def upload_file_via_body( + self, + file_content: IO, + **kwargs: Any + ) -> IO: """Upload file. :param file_content: File to upload. @@ -116,23 +119,29 @@ async def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_content request = build_upload_file_via_body_request( content_type=content_type, content=_content, - template_url=self.upload_file_via_body.metadata["url"], + template_url=self.upload_file_via_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -147,10 +156,15 @@ async def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: return deserialized - upload_file_via_body.metadata = {"url": "/formdata/stream/uploadfile"} # type: ignore + upload_file_via_body.metadata = {'url': '/formdata/stream/uploadfile'} # type: ignore + @distributed_trace_async - async def upload_files(self, file_content: List[IO], **kwargs: Any) -> IO: + async def upload_files( + self, + file_content: List[IO], + **kwargs: Any + ) -> IO: """Upload multiple files. :param file_content: Files to upload. @@ -160,11 +174,13 @@ async def upload_files(self, file_content: List[IO], **kwargs: Any) -> IO: :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct form data _files = { @@ -174,12 +190,16 @@ async def upload_files(self, file_content: List[IO], **kwargs: Any) -> IO: request = build_upload_files_request( content_type=content_type, files=_files, - template_url=self.upload_files.metadata["url"], + template_url=self.upload_files.metadata['url'], ) request = _convert_request(request, _files) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,4 +214,5 @@ async def upload_files(self, file_content: List[IO], **kwargs: Any) -> IO: return deserialized - upload_files.metadata = {"url": "/formdata/stream/uploadfiles"} # type: ignore + upload_files.metadata = {'url': '/formdata/stream/uploadfiles'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py index a77b68765ac..e39dcfea486 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py @@ -16,7 +16,7 @@ from ._models import Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema # type: ignore __all__ = [ - "Error", - "Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema", - "Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema", + 'Error', + 'Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema', + 'Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models.py index b6e2b198c79..514536539e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema(msrest.serialization.Model): @@ -48,16 +51,19 @@ class Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDat """ _validation = { - "file_content": {"required": True}, - "file_name": {"required": True}, + 'file_content': {'required': True}, + 'file_name': {'required': True}, } _attribute_map = { - "file_content": {"key": "fileContent", "type": "IO"}, - "file_name": {"key": "fileName", "type": "str"}, + 'file_content': {'key': 'fileContent', 'type': 'IO'}, + 'file_name': {'key': 'fileName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword file_content: Required. File to upload. :paramtype file_content: IO @@ -65,11 +71,9 @@ def __init__(self, **kwargs): here. :paramtype file_name: str """ - super(Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema, self).__init__( - **kwargs - ) - self.file_content = kwargs["file_content"] - self.file_name = kwargs["file_name"] + super(Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema, self).__init__(**kwargs) + self.file_content = kwargs['file_content'] + self.file_name = kwargs['file_name'] class Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema(msrest.serialization.Model): @@ -82,19 +86,20 @@ class Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDa """ _validation = { - "file_content": {"required": True}, + 'file_content': {'required': True}, } _attribute_map = { - "file_content": {"key": "fileContent", "type": "[IO]"}, + 'file_content': {'key': 'fileContent', 'type': '[IO]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword file_content: Required. Files to upload. :paramtype file_content: list[IO] """ - super(Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema, self).__init__( - **kwargs - ) - self.file_content = kwargs["file_content"] + super(Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema, self).__init__(**kwargs) + self.file_content = kwargs['file_content'] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models_py3.py index 3eb75cf76be..edfc08684d4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -50,16 +56,22 @@ class Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDat """ _validation = { - "file_content": {"required": True}, - "file_name": {"required": True}, + 'file_content': {'required': True}, + 'file_name': {'required': True}, } _attribute_map = { - "file_content": {"key": "fileContent", "type": "IO"}, - "file_name": {"key": "fileName", "type": "str"}, + 'file_content': {'key': 'fileContent', 'type': 'IO'}, + 'file_name': {'key': 'fileName', 'type': 'str'}, } - def __init__(self, *, file_content: IO, file_name: str, **kwargs): + def __init__( + self, + *, + file_content: IO, + file_name: str, + **kwargs + ): """ :keyword file_content: Required. File to upload. :paramtype file_content: IO @@ -67,9 +79,7 @@ def __init__(self, *, file_content: IO, file_name: str, **kwargs): here. :paramtype file_name: str """ - super(Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema, self).__init__( - **kwargs - ) + super(Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema, self).__init__(**kwargs) self.file_content = file_content self.file_name = file_name @@ -84,19 +94,22 @@ class Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDa """ _validation = { - "file_content": {"required": True}, + 'file_content': {'required': True}, } _attribute_map = { - "file_content": {"key": "fileContent", "type": "[IO]"}, + 'file_content': {'key': 'fileContent', 'type': '[IO]'}, } - def __init__(self, *, file_content: List[IO], **kwargs): + def __init__( + self, + *, + file_content: List[IO], + **kwargs + ): """ :keyword file_content: Required. Files to upload. :paramtype file_content: list[IO] """ - super(Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema, self).__init__( - **kwargs - ) + super(Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema, self).__init__(**kwargs) self.file_content = file_content diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/__init__.py index 2f2f5503a3a..5d0ff2b3dda 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/__init__.py @@ -9,5 +9,5 @@ from ._formdata_operations import FormdataOperations __all__ = [ - "FormdataOperations", + 'FormdataOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py index d0d97ed7eb5..c067ed83ff2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, IO, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -149,11 +141,13 @@ def upload_file( :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct form data _files = { @@ -164,12 +158,16 @@ def upload_file( request = build_upload_file_request( content_type=content_type, files=_files, - template_url=self.upload_file.metadata["url"], + template_url=self.upload_file.metadata['url'], ) request = _convert_request(request, _files) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -184,7 +182,8 @@ def upload_file( return deserialized - upload_file.metadata = {"url": "/formdata/stream/uploadfile"} # type: ignore + upload_file.metadata = {'url': '/formdata/stream/uploadfile'} # type: ignore + @distributed_trace def upload_file_via_body( @@ -202,23 +201,29 @@ def upload_file_via_body( :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_content request = build_upload_file_via_body_request( content_type=content_type, content=_content, - template_url=self.upload_file_via_body.metadata["url"], + template_url=self.upload_file_via_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,7 +238,8 @@ def upload_file_via_body( return deserialized - upload_file_via_body.metadata = {"url": "/formdata/stream/uploadfile"} # type: ignore + upload_file_via_body.metadata = {'url': '/formdata/stream/uploadfile'} # type: ignore + @distributed_trace def upload_files( @@ -251,11 +257,13 @@ def upload_files( :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct form data _files = { @@ -265,12 +273,16 @@ def upload_files( request = build_upload_files_request( content_type=content_type, files=_files, - template_url=self.upload_files.metadata["url"], + template_url=self.upload_files.metadata['url'], ) request = _convert_request(request, _files) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -285,4 +297,5 @@ def upload_files( return deserialized - upload_files.metadata = {"url": "/formdata/stream/uploadfiles"} # type: ignore + upload_files.metadata = {'url': '/formdata/stream/uploadfiles'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py index b9c8a22987e..39e98d75b27 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/__init__.py index 1bbfaf60a8b..39430c90415 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["BodyFormsDataURLEncoded"] +__all__ = ['BodyFormsDataURLEncoded'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py index eb2056242b7..f1a349b65d1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class BodyFormsDataURLEncoded(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -45,9 +44,8 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.formdataurlencoded = FormdataurlencodedOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.formdataurlencoded = FormdataurlencodedOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_configuration.py index 1630989c8c5..d9c45a98063 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class BodyFormsDataURLEncodedConfiguration(Configuration): +class BodyFormsDataURLEncodedConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BodyFormsDataURLEncoded. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class BodyFormsDataURLEncodedConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(BodyFormsDataURLEncodedConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "bodyformsdataurlencoded/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodyformsdataurlencoded/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/__init__.py index 9eda7cfdb59..71fa91da75b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._body_forms_data_url_encoded import BodyFormsDataURLEncoded - -__all__ = ["BodyFormsDataURLEncoded"] +__all__ = ['BodyFormsDataURLEncoded'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py index 5a946a8e3cc..7f6f8253eaf 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import BodyFormsDataURLEncodedConfiguration from .operations import FormdataurlencodedOperations - class BodyFormsDataURLEncoded: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class BodyFormsDataURLEncoded: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = BodyFormsDataURLEncodedConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -35,11 +38,14 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.formdataurlencoded = FormdataurlencodedOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.formdataurlencoded = FormdataurlencodedOperations(self._client, self._config, self._serialize, self._deserialize) + - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_configuration.py index 71cd7fc41ca..f95a73a26b1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class BodyFormsDataURLEncodedConfiguration(Configuration): +class BodyFormsDataURLEncodedConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BodyFormsDataURLEncoded. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BodyFormsDataURLEncodedConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "bodyformsdataurlencoded/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodyformsdataurlencoded/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/__init__.py index 1f1a35610b1..e9f711cafa8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._formdataurlencoded_operations import FormdataurlencodedOperations __all__ = [ - "FormdataurlencodedOperations", + 'FormdataurlencodedOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py index feab8719888..293d5df7c26 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,15 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._formdataurlencoded_operations import ( - build_partial_constant_body_request, - build_update_pet_with_form_request, -) - -T = TypeVar("T") +from ...operations._formdataurlencoded_operations import build_partial_constant_body_request, build_update_pet_with_form_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FormdataurlencodedOperations: """FormdataurlencodedOperations async operations. @@ -86,11 +74,13 @@ async def update_pet_with_form( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] # Construct form data _data = { @@ -105,12 +95,16 @@ async def update_pet_with_form( pet_id=pet_id, content_type=content_type, data=_data, - template_url=self.update_pet_with_form.metadata["url"], + template_url=self.update_pet_with_form.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 405]: @@ -120,10 +114,16 @@ async def update_pet_with_form( if cls: return cls(pipeline_response, None, {}) - update_pet_with_form.metadata = {"url": "/formsdataurlencoded/pet/add/{petId}"} # type: ignore + update_pet_with_form.metadata = {'url': '/formsdataurlencoded/pet/add/{petId}'} # type: ignore + @distributed_trace_async - async def partial_constant_body(self, service: str, access_token: str, **kwargs: Any) -> None: + async def partial_constant_body( + self, + service: str, + access_token: str, + **kwargs: Any + ) -> None: """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: 'foo', service: 'bar' } to pass the test. @@ -140,12 +140,14 @@ async def partial_constant_body(self, service: str, access_token: str, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] - grant_type = kwargs.pop("grant_type", "access_token") # type: str + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + grant_type = kwargs.pop('grant_type', "access_token") # type: str # Construct form data _data = { @@ -157,12 +159,16 @@ async def partial_constant_body(self, service: str, access_token: str, **kwargs: request = build_partial_constant_body_request( content_type=content_type, data=_data, - template_url=self.partial_constant_body.metadata["url"], + template_url=self.partial_constant_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,4 +178,5 @@ async def partial_constant_body(self, service: str, access_token: str, **kwargs: if cls: return cls(pipeline_response, None, {}) - partial_constant_body.metadata = {"url": "/formsdataurlencoded/partialConstantBody"} # type: ignore + partial_constant_body.metadata = {'url': '/formsdataurlencoded/partialConstantBody'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py index 1c96c835392..fc012c1a224 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py @@ -7,12 +7,8 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import ( - Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, - ) - from ._models_py3 import ( - PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, - ) + from ._models_py3 import Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema + from ._models_py3 import PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema except (SyntaxError, ImportError): from ._models import Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema # type: ignore from ._models import PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema # type: ignore @@ -23,8 +19,8 @@ ) __all__ = [ - "Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema", - "PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema", - "PetFood", - "PetType", + 'Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema', + 'PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema', + 'PetFood', + 'PetType', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_body_forms_data_url_encoded_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_body_forms_data_url_encoded_enums.py index 86d0f7d40d7..b0f19a30ed7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_body_forms_data_url_encoded_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_body_forms_data_url_encoded_enums.py @@ -12,15 +12,16 @@ class PetFood(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Can take a value of meat, or fish, or plant""" + """Can take a value of meat, or fish, or plant + """ MEAT = "meat" FISH = "fish" PLANT = "plant" - class PetType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Can take a value of dog, or cat, or fish""" + """Can take a value of dog, or cat, or fish + """ DOG = "dog" CAT = "cat" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py index 2e852d6497d..d34fa32148c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models.py @@ -9,9 +9,7 @@ import msrest.serialization -class Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema( - msrest.serialization.Model -): +class Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema(msrest.serialization.Model): """Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. All required parameters must be populated in order to send to Azure. @@ -31,20 +29,23 @@ class Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicatio """ _validation = { - "pet_type": {"required": True}, - "pet_food": {"required": True}, - "pet_age": {"required": True}, + 'pet_type': {'required': True}, + 'pet_food': {'required': True}, + 'pet_age': {'required': True}, } _attribute_map = { - "pet_type": {"key": "pet_type", "type": "str"}, - "pet_food": {"key": "pet_food", "type": "str"}, - "pet_age": {"key": "pet_age", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, + 'pet_type': {'key': 'pet_type', 'type': 'str'}, + 'pet_food': {'key': 'pet_food', 'type': 'str'}, + 'pet_age': {'key': 'pet_age', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword pet_type: Required. Can take a value of dog, or cat, or fish. Possible values include: "dog", "cat", "fish". @@ -59,19 +60,15 @@ def __init__(self, **kwargs): :keyword status: Updated status of the pet. :paramtype status: str """ - super( - Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, self - ).__init__(**kwargs) - self.pet_type = kwargs["pet_type"] - self.pet_food = kwargs["pet_food"] - self.pet_age = kwargs["pet_age"] - self.name = kwargs.get("name", None) - self.status = kwargs.get("status", None) - - -class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema( - msrest.serialization.Model -): + super(Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, self).__init__(**kwargs) + self.pet_type = kwargs['pet_type'] + self.pet_food = kwargs['pet_food'] + self.pet_age = kwargs['pet_age'] + self.name = kwargs.get('name', None) + self.status = kwargs.get('status', None) + + +class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema(msrest.serialization.Model): """PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. Variables are only populated by the server, and will be ignored when sending a request. @@ -88,20 +85,23 @@ class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApp """ _validation = { - "grant_type": {"required": True, "constant": True}, - "service": {"required": True}, - "aad_access_token": {"required": True}, + 'grant_type': {'required': True, 'constant': True}, + 'service': {'required': True}, + 'aad_access_token': {'required': True}, } _attribute_map = { - "grant_type": {"key": "grant_type", "type": "str"}, - "service": {"key": "service", "type": "str"}, - "aad_access_token": {"key": "access_token", "type": "str"}, + 'grant_type': {'key': 'grant_type', 'type': 'str'}, + 'service': {'key': 'service', 'type': 'str'}, + 'aad_access_token': {'key': 'access_token', 'type': 'str'}, } grant_type = "access_token" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword service: Required. Indicates the name of your Azure container registry. :paramtype service: str @@ -109,9 +109,6 @@ def __init__(self, **kwargs): access_token_refresh_token or access_token. :paramtype aad_access_token: str """ - super( - PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, - self, - ).__init__(**kwargs) - self.service = kwargs["service"] - self.aad_access_token = kwargs["aad_access_token"] + super(PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, self).__init__(**kwargs) + self.service = kwargs['service'] + self.aad_access_token = kwargs['aad_access_token'] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py index 6f6e2642e53..77e767e06af 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_models_py3.py @@ -13,9 +13,7 @@ from ._body_forms_data_url_encoded_enums import * -class Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema( - msrest.serialization.Model -): +class Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema(msrest.serialization.Model): """Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. All required parameters must be populated in order to send to Azure. @@ -35,17 +33,17 @@ class Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicatio """ _validation = { - "pet_type": {"required": True}, - "pet_food": {"required": True}, - "pet_age": {"required": True}, + 'pet_type': {'required': True}, + 'pet_food': {'required': True}, + 'pet_age': {'required': True}, } _attribute_map = { - "pet_type": {"key": "pet_type", "type": "str"}, - "pet_food": {"key": "pet_food", "type": "str"}, - "pet_age": {"key": "pet_age", "type": "int"}, - "name": {"key": "name", "type": "str"}, - "status": {"key": "status", "type": "str"}, + 'pet_type': {'key': 'pet_type', 'type': 'str'}, + 'pet_food': {'key': 'pet_food', 'type': 'str'}, + 'pet_age': {'key': 'pet_age', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, } def __init__( @@ -72,9 +70,7 @@ def __init__( :keyword status: Updated status of the pet. :paramtype status: str """ - super( - Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, self - ).__init__(**kwargs) + super(Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, self).__init__(**kwargs) self.pet_type = pet_type self.pet_food = pet_food self.pet_age = pet_age @@ -82,9 +78,7 @@ def __init__( self.status = status -class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema( - msrest.serialization.Model -): +class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema(msrest.serialization.Model): """PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema. Variables are only populated by the server, and will be ignored when sending a request. @@ -101,20 +95,26 @@ class PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApp """ _validation = { - "grant_type": {"required": True, "constant": True}, - "service": {"required": True}, - "aad_access_token": {"required": True}, + 'grant_type': {'required': True, 'constant': True}, + 'service': {'required': True}, + 'aad_access_token': {'required': True}, } _attribute_map = { - "grant_type": {"key": "grant_type", "type": "str"}, - "service": {"key": "service", "type": "str"}, - "aad_access_token": {"key": "access_token", "type": "str"}, + 'grant_type': {'key': 'grant_type', 'type': 'str'}, + 'service': {'key': 'service', 'type': 'str'}, + 'aad_access_token': {'key': 'access_token', 'type': 'str'}, } grant_type = "access_token" - def __init__(self, *, service: str, aad_access_token: str, **kwargs): + def __init__( + self, + *, + service: str, + aad_access_token: str, + **kwargs + ): """ :keyword service: Required. Indicates the name of your Azure container registry. :paramtype service: str @@ -122,9 +122,6 @@ def __init__(self, *, service: str, aad_access_token: str, **kwargs): access_token_refresh_token or access_token. :paramtype aad_access_token: str """ - super( - PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, - self, - ).__init__(**kwargs) + super(PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, self).__init__(**kwargs) self.service = service self.aad_access_token = aad_access_token diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/__init__.py index 1f1a35610b1..e9f711cafa8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/__init__.py @@ -9,5 +9,5 @@ from ._formdataurlencoded_operations import FormdataurlencodedOperations __all__ = [ - "FormdataurlencodedOperations", + 'FormdataurlencodedOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py index a420835407c..fddbdff3c19 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -141,11 +133,13 @@ def update_pet_with_form( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] # Construct form data _data = { @@ -160,12 +154,16 @@ def update_pet_with_form( pet_id=pet_id, content_type=content_type, data=_data, - template_url=self.update_pet_with_form.metadata["url"], + template_url=self.update_pet_with_form.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 405]: @@ -175,7 +173,8 @@ def update_pet_with_form( if cls: return cls(pipeline_response, None, {}) - update_pet_with_form.metadata = {"url": "/formsdataurlencoded/pet/add/{petId}"} # type: ignore + update_pet_with_form.metadata = {'url': '/formsdataurlencoded/pet/add/{petId}'} # type: ignore + @distributed_trace def partial_constant_body( @@ -201,12 +200,14 @@ def partial_constant_body( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] - grant_type = kwargs.pop("grant_type", "access_token") # type: str + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + grant_type = kwargs.pop('grant_type', "access_token") # type: str # Construct form data _data = { @@ -218,12 +219,16 @@ def partial_constant_body( request = build_partial_constant_body_request( content_type=content_type, data=_data, - template_url=self.partial_constant_body.metadata["url"], + template_url=self.partial_constant_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,4 +238,5 @@ def partial_constant_body( if cls: return cls(pipeline_response, None, {}) - partial_constant_body.metadata = {"url": "/formsdataurlencoded/partialConstantBody"} # type: ignore + partial_constant_body.metadata = {'url': '/formsdataurlencoded/partialConstantBody'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py index 865983fb584..7d71a848053 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/__init__.py index 57b034a143f..df30011173d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestIntegerTestService"] +__all__ = ['AutoRestIntegerTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py index 7f79d0cdb83..9d979ae68c0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestIntegerTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_configuration.py index fc5968bb1a7..e05b886e506 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestIntegerTestServiceConfiguration(Configuration): +class AutoRestIntegerTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestIntegerTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestIntegerTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestIntegerTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestintegertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestintegertestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/__init__.py index 92e3cb60c63..6c38252cb2b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_integer_test_service import AutoRestIntegerTestService - -__all__ = ["AutoRestIntegerTestService"] +__all__ = ['AutoRestIntegerTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py index 2534f52b683..2428376db2a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestIntegerTestServiceConfiguration from .operations import IntOperations - class AutoRestIntegerTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestIntegerTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestIntegerTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_configuration.py index 68ab8b27e32..57034c6aa91 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestIntegerTestServiceConfiguration(Configuration): +class AutoRestIntegerTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestIntegerTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestIntegerTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestintegertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestintegertestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/__init__.py index fab8b7e8b40..938ee1d0c2b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._int_operations import IntOperations __all__ = [ - "IntOperations", + 'IntOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations.py index 55f6dd0ca85..d5bd6edbe70 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,27 +17,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._int_operations import ( - build_get_invalid_request, - build_get_invalid_unix_time_request, - build_get_null_request, - build_get_null_unix_time_request, - build_get_overflow_int32_request, - build_get_overflow_int64_request, - build_get_underflow_int32_request, - build_get_underflow_int64_request, - build_get_unix_time_request, - build_put_max32_request, - build_put_max64_request, - build_put_min32_request, - build_put_min64_request, - build_put_unix_time_date_request, -) - -T = TypeVar("T") +from ...operations._int_operations import build_get_invalid_request, build_get_invalid_unix_time_request, build_get_null_request, build_get_null_unix_time_request, build_get_overflow_int32_request, build_get_overflow_int64_request, build_get_underflow_int32_request, build_get_underflow_int64_request, build_get_unix_time_request, build_put_max32_request, build_put_max64_request, build_put_min32_request, build_put_min64_request, build_put_unix_time_date_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class IntOperations: """IntOperations async operations. @@ -68,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[int]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[int]: """Get null Int value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -76,17 +55,24 @@ async def get_null(self, **kwargs: Any) -> Optional[int]: :rtype: int or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,17 +80,21 @@ async def get_null(self, **kwargs: Any) -> Optional[int]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/int/null"} # type: ignore + get_null.metadata = {'url': '/int/null'} # type: ignore + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> int: + async def get_invalid( + self, + **kwargs: Any + ) -> int: """Get invalid Int value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -112,17 +102,24 @@ async def get_invalid(self, **kwargs: Any) -> int: :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,17 +127,21 @@ async def get_invalid(self, **kwargs: Any) -> int: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/int/invalid"} # type: ignore + get_invalid.metadata = {'url': '/int/invalid'} # type: ignore + @distributed_trace_async - async def get_overflow_int32(self, **kwargs: Any) -> int: + async def get_overflow_int32( + self, + **kwargs: Any + ) -> int: """Get overflow Int32 value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -148,17 +149,24 @@ async def get_overflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_int32_request( - template_url=self.get_overflow_int32.metadata["url"], + template_url=self.get_overflow_int32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -166,17 +174,21 @@ async def get_overflow_int32(self, **kwargs: Any) -> int: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow_int32.metadata = {"url": "/int/overflowint32"} # type: ignore + get_overflow_int32.metadata = {'url': '/int/overflowint32'} # type: ignore + @distributed_trace_async - async def get_underflow_int32(self, **kwargs: Any) -> int: + async def get_underflow_int32( + self, + **kwargs: Any + ) -> int: """Get underflow Int32 value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -184,17 +196,24 @@ async def get_underflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_int32_request( - template_url=self.get_underflow_int32.metadata["url"], + template_url=self.get_underflow_int32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -202,17 +221,21 @@ async def get_underflow_int32(self, **kwargs: Any) -> int: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow_int32.metadata = {"url": "/int/underflowint32"} # type: ignore + get_underflow_int32.metadata = {'url': '/int/underflowint32'} # type: ignore + @distributed_trace_async - async def get_overflow_int64(self, **kwargs: Any) -> int: + async def get_overflow_int64( + self, + **kwargs: Any + ) -> int: """Get overflow Int64 value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -220,17 +243,24 @@ async def get_overflow_int64(self, **kwargs: Any) -> int: :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_int64_request( - template_url=self.get_overflow_int64.metadata["url"], + template_url=self.get_overflow_int64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -238,17 +268,21 @@ async def get_overflow_int64(self, **kwargs: Any) -> int: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("long", pipeline_response) + deserialized = self._deserialize('long', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow_int64.metadata = {"url": "/int/overflowint64"} # type: ignore + get_overflow_int64.metadata = {'url': '/int/overflowint64'} # type: ignore + @distributed_trace_async - async def get_underflow_int64(self, **kwargs: Any) -> int: + async def get_underflow_int64( + self, + **kwargs: Any + ) -> int: """Get underflow Int64 value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -256,17 +290,24 @@ async def get_underflow_int64(self, **kwargs: Any) -> int: :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_int64_request( - template_url=self.get_underflow_int64.metadata["url"], + template_url=self.get_underflow_int64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,17 +315,22 @@ async def get_underflow_int64(self, **kwargs: Any) -> int: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("long", pipeline_response) + deserialized = self._deserialize('long', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow_int64.metadata = {"url": "/int/underflowint64"} # type: ignore + get_underflow_int64.metadata = {'url': '/int/underflowint64'} # type: ignore + @distributed_trace_async - async def put_max32(self, int_body: int, **kwargs: Any) -> None: + async def put_max32( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put max int32 value. :param int_body: int body. @@ -294,23 +340,29 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "int") + _json = self._serialize.body(int_body, 'int') request = build_put_max32_request( content_type=content_type, json=_json, - template_url=self.put_max32.metadata["url"], + template_url=self.put_max32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -321,10 +373,15 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_max32.metadata = {"url": "/int/max/32"} # type: ignore + put_max32.metadata = {'url': '/int/max/32'} # type: ignore + @distributed_trace_async - async def put_max64(self, int_body: int, **kwargs: Any) -> None: + async def put_max64( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put max int64 value. :param int_body: int body. @@ -334,23 +391,29 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "long") + _json = self._serialize.body(int_body, 'long') request = build_put_max64_request( content_type=content_type, json=_json, - template_url=self.put_max64.metadata["url"], + template_url=self.put_max64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -361,10 +424,15 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_max64.metadata = {"url": "/int/max/64"} # type: ignore + put_max64.metadata = {'url': '/int/max/64'} # type: ignore + @distributed_trace_async - async def put_min32(self, int_body: int, **kwargs: Any) -> None: + async def put_min32( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put min int32 value. :param int_body: int body. @@ -374,23 +442,29 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "int") + _json = self._serialize.body(int_body, 'int') request = build_put_min32_request( content_type=content_type, json=_json, - template_url=self.put_min32.metadata["url"], + template_url=self.put_min32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,10 +475,15 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_min32.metadata = {"url": "/int/min/32"} # type: ignore + put_min32.metadata = {'url': '/int/min/32'} # type: ignore + @distributed_trace_async - async def put_min64(self, int_body: int, **kwargs: Any) -> None: + async def put_min64( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put min int64 value. :param int_body: int body. @@ -414,23 +493,29 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "long") + _json = self._serialize.body(int_body, 'long') request = build_put_min64_request( content_type=content_type, json=_json, - template_url=self.put_min64.metadata["url"], + template_url=self.put_min64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,10 +526,14 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_min64.metadata = {"url": "/int/min/64"} # type: ignore + put_min64.metadata = {'url': '/int/min/64'} # type: ignore + @distributed_trace_async - async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: + async def get_unix_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get datetime encoded as Unix time value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -452,17 +541,24 @@ async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_unix_time_request( - template_url=self.get_unix_time.metadata["url"], + template_url=self.get_unix_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -470,17 +566,22 @@ async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("unix-time", pipeline_response) + deserialized = self._deserialize('unix-time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_unix_time.metadata = {"url": "/int/unixtime"} # type: ignore + get_unix_time.metadata = {'url': '/int/unixtime'} # type: ignore + @distributed_trace_async - async def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) -> None: + async def put_unix_time_date( + self, + int_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put datetime encoded as Unix time. :param int_body: int body. @@ -490,23 +591,29 @@ async def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "unix-time") + _json = self._serialize.body(int_body, 'unix-time') request = build_put_unix_time_date_request( content_type=content_type, json=_json, - template_url=self.put_unix_time_date.metadata["url"], + template_url=self.put_unix_time_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -517,10 +624,14 @@ async def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - put_unix_time_date.metadata = {"url": "/int/unixtime"} # type: ignore + put_unix_time_date.metadata = {'url': '/int/unixtime'} # type: ignore + @distributed_trace_async - async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: + async def get_invalid_unix_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid Unix time value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -528,17 +639,24 @@ async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_unix_time_request( - template_url=self.get_invalid_unix_time.metadata["url"], + template_url=self.get_invalid_unix_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -546,17 +664,21 @@ async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("unix-time", pipeline_response) + deserialized = self._deserialize('unix-time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_unix_time.metadata = {"url": "/int/invalidunixtime"} # type: ignore + get_invalid_unix_time.metadata = {'url': '/int/invalidunixtime'} # type: ignore + @distributed_trace_async - async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: + async def get_null_unix_time( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null Unix time value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -564,17 +686,24 @@ async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime] :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_unix_time_request( - template_url=self.get_null_unix_time.metadata["url"], + template_url=self.get_null_unix_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -582,11 +711,12 @@ async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime] error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("unix-time", pipeline_response) + deserialized = self._deserialize('unix-time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_unix_time.metadata = {"url": "/int/nullunixtime"} # type: ignore + get_null_unix_time.metadata = {'url': '/int/nullunixtime'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/__init__.py index fab8b7e8b40..938ee1d0c2b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/__init__.py @@ -9,5 +9,5 @@ from ._int_operations import IntOperations __all__ = [ - "IntOperations", + 'IntOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py index 6f83f4e1cda..2bbf40a6cf8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -361,7 +353,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[int] """Get null Int value. @@ -371,17 +364,24 @@ def get_null( :rtype: int or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -389,18 +389,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/int/null"} # type: ignore + get_null.metadata = {'url': '/int/null'} # type: ignore + @distributed_trace def get_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> int """Get invalid Int value. @@ -410,17 +412,24 @@ def get_invalid( :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], + template_url=self.get_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -428,18 +437,20 @@ def get_invalid( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid.metadata = {"url": "/int/invalid"} # type: ignore + get_invalid.metadata = {'url': '/int/invalid'} # type: ignore + @distributed_trace def get_overflow_int32( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> int """Get overflow Int32 value. @@ -449,17 +460,24 @@ def get_overflow_int32( :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_int32_request( - template_url=self.get_overflow_int32.metadata["url"], + template_url=self.get_overflow_int32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -467,18 +485,20 @@ def get_overflow_int32( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow_int32.metadata = {"url": "/int/overflowint32"} # type: ignore + get_overflow_int32.metadata = {'url': '/int/overflowint32'} # type: ignore + @distributed_trace def get_underflow_int32( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> int """Get underflow Int32 value. @@ -488,17 +508,24 @@ def get_underflow_int32( :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_int32_request( - template_url=self.get_underflow_int32.metadata["url"], + template_url=self.get_underflow_int32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -506,18 +533,20 @@ def get_underflow_int32( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow_int32.metadata = {"url": "/int/underflowint32"} # type: ignore + get_underflow_int32.metadata = {'url': '/int/underflowint32'} # type: ignore + @distributed_trace def get_overflow_int64( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> int """Get overflow Int64 value. @@ -527,17 +556,24 @@ def get_overflow_int64( :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_overflow_int64_request( - template_url=self.get_overflow_int64.metadata["url"], + template_url=self.get_overflow_int64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -545,18 +581,20 @@ def get_overflow_int64( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("long", pipeline_response) + deserialized = self._deserialize('long', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_overflow_int64.metadata = {"url": "/int/overflowint64"} # type: ignore + get_overflow_int64.metadata = {'url': '/int/overflowint64'} # type: ignore + @distributed_trace def get_underflow_int64( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> int """Get underflow Int64 value. @@ -566,17 +604,24 @@ def get_underflow_int64( :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_underflow_int64_request( - template_url=self.get_underflow_int64.metadata["url"], + template_url=self.get_underflow_int64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,14 +629,15 @@ def get_underflow_int64( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("long", pipeline_response) + deserialized = self._deserialize('long', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_underflow_int64.metadata = {"url": "/int/underflowint64"} # type: ignore + get_underflow_int64.metadata = {'url': '/int/underflowint64'} # type: ignore + @distributed_trace def put_max32( @@ -609,23 +655,29 @@ def put_max32( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "int") + _json = self._serialize.body(int_body, 'int') request = build_put_max32_request( content_type=content_type, json=_json, - template_url=self.put_max32.metadata["url"], + template_url=self.put_max32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -636,7 +688,8 @@ def put_max32( if cls: return cls(pipeline_response, None, {}) - put_max32.metadata = {"url": "/int/max/32"} # type: ignore + put_max32.metadata = {'url': '/int/max/32'} # type: ignore + @distributed_trace def put_max64( @@ -654,23 +707,29 @@ def put_max64( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "long") + _json = self._serialize.body(int_body, 'long') request = build_put_max64_request( content_type=content_type, json=_json, - template_url=self.put_max64.metadata["url"], + template_url=self.put_max64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,7 +740,8 @@ def put_max64( if cls: return cls(pipeline_response, None, {}) - put_max64.metadata = {"url": "/int/max/64"} # type: ignore + put_max64.metadata = {'url': '/int/max/64'} # type: ignore + @distributed_trace def put_min32( @@ -699,23 +759,29 @@ def put_min32( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "int") + _json = self._serialize.body(int_body, 'int') request = build_put_min32_request( content_type=content_type, json=_json, - template_url=self.put_min32.metadata["url"], + template_url=self.put_min32.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,7 +792,8 @@ def put_min32( if cls: return cls(pipeline_response, None, {}) - put_min32.metadata = {"url": "/int/min/32"} # type: ignore + put_min32.metadata = {'url': '/int/min/32'} # type: ignore + @distributed_trace def put_min64( @@ -744,23 +811,29 @@ def put_min64( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "long") + _json = self._serialize.body(int_body, 'long') request = build_put_min64_request( content_type=content_type, json=_json, - template_url=self.put_min64.metadata["url"], + template_url=self.put_min64.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -771,11 +844,13 @@ def put_min64( if cls: return cls(pipeline_response, None, {}) - put_min64.metadata = {"url": "/int/min/64"} # type: ignore + put_min64.metadata = {'url': '/int/min/64'} # type: ignore + @distributed_trace def get_unix_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get datetime encoded as Unix time value. @@ -785,17 +860,24 @@ def get_unix_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_unix_time_request( - template_url=self.get_unix_time.metadata["url"], + template_url=self.get_unix_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -803,14 +885,15 @@ def get_unix_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("unix-time", pipeline_response) + deserialized = self._deserialize('unix-time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_unix_time.metadata = {"url": "/int/unixtime"} # type: ignore + get_unix_time.metadata = {'url': '/int/unixtime'} # type: ignore + @distributed_trace def put_unix_time_date( @@ -828,23 +911,29 @@ def put_unix_time_date( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(int_body, "unix-time") + _json = self._serialize.body(int_body, 'unix-time') request = build_put_unix_time_date_request( content_type=content_type, json=_json, - template_url=self.put_unix_time_date.metadata["url"], + template_url=self.put_unix_time_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -855,11 +944,13 @@ def put_unix_time_date( if cls: return cls(pipeline_response, None, {}) - put_unix_time_date.metadata = {"url": "/int/unixtime"} # type: ignore + put_unix_time_date.metadata = {'url': '/int/unixtime'} # type: ignore + @distributed_trace def get_invalid_unix_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.datetime """Get invalid Unix time value. @@ -869,17 +960,24 @@ def get_invalid_unix_time( :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_unix_time_request( - template_url=self.get_invalid_unix_time.metadata["url"], + template_url=self.get_invalid_unix_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -887,18 +985,20 @@ def get_invalid_unix_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("unix-time", pipeline_response) + deserialized = self._deserialize('unix-time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_unix_time.metadata = {"url": "/int/invalidunixtime"} # type: ignore + get_invalid_unix_time.metadata = {'url': '/int/invalidunixtime'} # type: ignore + @distributed_trace def get_null_unix_time( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[datetime.datetime] """Get null Unix time value. @@ -908,17 +1008,24 @@ def get_null_unix_time( :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_unix_time_request( - template_url=self.get_null_unix_time.metadata["url"], + template_url=self.get_null_unix_time.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -926,11 +1033,12 @@ def get_null_unix_time( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("unix-time", pipeline_response) + deserialized = self._deserialize('unix-time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_unix_time.metadata = {"url": "/int/nullunixtime"} # type: ignore + get_null_unix_time.metadata = {'url': '/int/nullunixtime'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py index bcd0dece55b..2171cf31990 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/__init__.py index 9b131940e32..f031d50102e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestNumberTestService"] +__all__ = ['AutoRestNumberTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py index 179fd0d2403..b5b9bf4692a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestNumberTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.number = NumberOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_configuration.py index da1fbd323a5..f97860abda2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestNumberTestServiceConfiguration(Configuration): +class AutoRestNumberTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestNumberTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestNumberTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestNumberTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestnumbertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestnumbertestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/__init__.py index 4b6e06f5364..b3cdd84231d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_number_test_service import AutoRestNumberTestService - -__all__ = ["AutoRestNumberTestService"] +__all__ = ['AutoRestNumberTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py index 0f3cdc6d48a..5355ef618c2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestNumberTestServiceConfiguration from .operations import NumberOperations - class AutoRestNumberTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestNumberTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestNumberTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.number = NumberOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_configuration.py index aa79cc51c32..d6e3c56a3e0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestNumberTestServiceConfiguration(Configuration): +class AutoRestNumberTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestNumberTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestNumberTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestnumbertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestnumbertestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/__init__.py index e1236613fc6..186262af5a4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._number_operations import NumberOperations __all__ = [ - "NumberOperations", + 'NumberOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py index 54d1d8e4083..56febe73475 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,38 +16,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._number_operations import ( - build_get_big_decimal_negative_decimal_request, - build_get_big_decimal_positive_decimal_request, - build_get_big_decimal_request, - build_get_big_double_negative_decimal_request, - build_get_big_double_positive_decimal_request, - build_get_big_double_request, - build_get_big_float_request, - build_get_invalid_decimal_request, - build_get_invalid_double_request, - build_get_invalid_float_request, - build_get_null_request, - build_get_small_decimal_request, - build_get_small_double_request, - build_get_small_float_request, - build_put_big_decimal_negative_decimal_request, - build_put_big_decimal_positive_decimal_request, - build_put_big_decimal_request, - build_put_big_double_negative_decimal_request, - build_put_big_double_positive_decimal_request, - build_put_big_double_request, - build_put_big_float_request, - build_put_small_decimal_request, - build_put_small_double_request, - build_put_small_float_request, -) - -T = TypeVar("T") +from ...operations._number_operations import build_get_big_decimal_negative_decimal_request, build_get_big_decimal_positive_decimal_request, build_get_big_decimal_request, build_get_big_double_negative_decimal_request, build_get_big_double_positive_decimal_request, build_get_big_double_request, build_get_big_float_request, build_get_invalid_decimal_request, build_get_invalid_double_request, build_get_invalid_float_request, build_get_null_request, build_get_small_decimal_request, build_get_small_double_request, build_get_small_float_request, build_put_big_decimal_negative_decimal_request, build_put_big_decimal_positive_decimal_request, build_put_big_decimal_request, build_put_big_double_negative_decimal_request, build_put_big_double_positive_decimal_request, build_put_big_double_request, build_put_big_float_request, build_put_small_decimal_request, build_put_small_double_request, build_put_small_float_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class NumberOperations: +class NumberOperations: # pylint: disable=too-many-public-methods """NumberOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -77,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[float]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[float]: """Get null Number value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -85,17 +54,24 @@ async def get_null(self, **kwargs: Any) -> Optional[float]: :rtype: float or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,17 +79,21 @@ async def get_null(self, **kwargs: Any) -> Optional[float]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/number/null"} # type: ignore + get_null.metadata = {'url': '/number/null'} # type: ignore + @distributed_trace_async - async def get_invalid_float(self, **kwargs: Any) -> float: + async def get_invalid_float( + self, + **kwargs: Any + ) -> float: """Get invalid float Number value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -121,17 +101,24 @@ async def get_invalid_float(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_float_request( - template_url=self.get_invalid_float.metadata["url"], + template_url=self.get_invalid_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -139,17 +126,21 @@ async def get_invalid_float(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_float.metadata = {"url": "/number/invalidfloat"} # type: ignore + get_invalid_float.metadata = {'url': '/number/invalidfloat'} # type: ignore + @distributed_trace_async - async def get_invalid_double(self, **kwargs: Any) -> float: + async def get_invalid_double( + self, + **kwargs: Any + ) -> float: """Get invalid double Number value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -157,17 +148,24 @@ async def get_invalid_double(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_double_request( - template_url=self.get_invalid_double.metadata["url"], + template_url=self.get_invalid_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,17 +173,21 @@ async def get_invalid_double(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_double.metadata = {"url": "/number/invaliddouble"} # type: ignore + get_invalid_double.metadata = {'url': '/number/invaliddouble'} # type: ignore + @distributed_trace_async - async def get_invalid_decimal(self, **kwargs: Any) -> float: + async def get_invalid_decimal( + self, + **kwargs: Any + ) -> float: """Get invalid decimal Number value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -193,17 +195,24 @@ async def get_invalid_decimal(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_decimal_request( - template_url=self.get_invalid_decimal.metadata["url"], + template_url=self.get_invalid_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -211,17 +220,22 @@ async def get_invalid_decimal(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_decimal.metadata = {"url": "/number/invaliddecimal"} # type: ignore + get_invalid_decimal.metadata = {'url': '/number/invaliddecimal'} # type: ignore + @distributed_trace_async - async def put_big_float(self, number_body: float, **kwargs: Any) -> None: + async def put_big_float( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big float value 3.402823e+20. :param number_body: number body. @@ -231,23 +245,29 @@ async def put_big_float(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_big_float_request( content_type=content_type, json=_json, - template_url=self.put_big_float.metadata["url"], + template_url=self.put_big_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -258,10 +278,14 @@ async def put_big_float(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_big_float.metadata = {"url": "/number/big/float/3.402823e+20"} # type: ignore + put_big_float.metadata = {'url': '/number/big/float/3.402823e+20'} # type: ignore + @distributed_trace_async - async def get_big_float(self, **kwargs: Any) -> float: + async def get_big_float( + self, + **kwargs: Any + ) -> float: """Get big float value 3.402823e+20. :keyword callable cls: A custom type or function that will be passed the direct response @@ -269,17 +293,24 @@ async def get_big_float(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_float_request( - template_url=self.get_big_float.metadata["url"], + template_url=self.get_big_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -287,17 +318,22 @@ async def get_big_float(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_float.metadata = {"url": "/number/big/float/3.402823e+20"} # type: ignore + get_big_float.metadata = {'url': '/number/big/float/3.402823e+20'} # type: ignore + @distributed_trace_async - async def put_big_double(self, number_body: float, **kwargs: Any) -> None: + async def put_big_double( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big double value 2.5976931e+101. :param number_body: number body. @@ -307,23 +343,29 @@ async def put_big_double(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_big_double_request( content_type=content_type, json=_json, - template_url=self.put_big_double.metadata["url"], + template_url=self.put_big_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -334,10 +376,14 @@ async def put_big_double(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_big_double.metadata = {"url": "/number/big/double/2.5976931e+101"} # type: ignore + put_big_double.metadata = {'url': '/number/big/double/2.5976931e+101'} # type: ignore + @distributed_trace_async - async def get_big_double(self, **kwargs: Any) -> float: + async def get_big_double( + self, + **kwargs: Any + ) -> float: """Get big double value 2.5976931e+101. :keyword callable cls: A custom type or function that will be passed the direct response @@ -345,17 +391,24 @@ async def get_big_double(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_double_request( - template_url=self.get_big_double.metadata["url"], + template_url=self.get_big_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -363,17 +416,21 @@ async def get_big_double(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_double.metadata = {"url": "/number/big/double/2.5976931e+101"} # type: ignore + get_big_double.metadata = {'url': '/number/big/double/2.5976931e+101'} # type: ignore + @distributed_trace_async - async def put_big_double_positive_decimal(self, **kwargs: Any) -> None: + async def put_big_double_positive_decimal( + self, + **kwargs: Any + ) -> None: """Put big double value 99999999.99. :keyword number_body: The default value is 99999999.99. Note that overriding this default value @@ -384,22 +441,29 @@ async def put_big_double_positive_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_put_big_double_positive_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_double_positive_decimal.metadata["url"], + template_url=self.put_big_double_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -410,10 +474,14 @@ async def put_big_double_positive_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_big_double_positive_decimal.metadata = {"url": "/number/big/double/99999999.99"} # type: ignore + put_big_double_positive_decimal.metadata = {'url': '/number/big/double/99999999.99'} # type: ignore + @distributed_trace_async - async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: + async def get_big_double_positive_decimal( + self, + **kwargs: Any + ) -> float: """Get big double value 99999999.99. :keyword callable cls: A custom type or function that will be passed the direct response @@ -421,17 +489,24 @@ async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_double_positive_decimal_request( - template_url=self.get_big_double_positive_decimal.metadata["url"], + template_url=self.get_big_double_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -439,17 +514,21 @@ async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_double_positive_decimal.metadata = {"url": "/number/big/double/99999999.99"} # type: ignore + get_big_double_positive_decimal.metadata = {'url': '/number/big/double/99999999.99'} # type: ignore + @distributed_trace_async - async def put_big_double_negative_decimal(self, **kwargs: Any) -> None: + async def put_big_double_negative_decimal( + self, + **kwargs: Any + ) -> None: """Put big double value -99999999.99. :keyword number_body: The default value is -99999999.99. Note that overriding this default @@ -460,22 +539,29 @@ async def put_big_double_negative_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_put_big_double_negative_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_double_negative_decimal.metadata["url"], + template_url=self.put_big_double_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -486,10 +572,14 @@ async def put_big_double_negative_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_big_double_negative_decimal.metadata = {"url": "/number/big/double/-99999999.99"} # type: ignore + put_big_double_negative_decimal.metadata = {'url': '/number/big/double/-99999999.99'} # type: ignore + @distributed_trace_async - async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: + async def get_big_double_negative_decimal( + self, + **kwargs: Any + ) -> float: """Get big double value -99999999.99. :keyword callable cls: A custom type or function that will be passed the direct response @@ -497,17 +587,24 @@ async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_double_negative_decimal_request( - template_url=self.get_big_double_negative_decimal.metadata["url"], + template_url=self.get_big_double_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -515,17 +612,22 @@ async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_double_negative_decimal.metadata = {"url": "/number/big/double/-99999999.99"} # type: ignore + get_big_double_negative_decimal.metadata = {'url': '/number/big/double/-99999999.99'} # type: ignore + @distributed_trace_async - async def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: + async def put_big_decimal( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big decimal value 2.5976931e+101. :param number_body: number body. @@ -535,23 +637,29 @@ async def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_big_decimal_request( content_type=content_type, json=_json, - template_url=self.put_big_decimal.metadata["url"], + template_url=self.put_big_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -562,10 +670,14 @@ async def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_big_decimal.metadata = {"url": "/number/big/decimal/2.5976931e+101"} # type: ignore + put_big_decimal.metadata = {'url': '/number/big/decimal/2.5976931e+101'} # type: ignore + @distributed_trace_async - async def get_big_decimal(self, **kwargs: Any) -> float: + async def get_big_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value 2.5976931e+101. :keyword callable cls: A custom type or function that will be passed the direct response @@ -573,17 +685,24 @@ async def get_big_decimal(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_decimal_request( - template_url=self.get_big_decimal.metadata["url"], + template_url=self.get_big_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -591,17 +710,21 @@ async def get_big_decimal(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_decimal.metadata = {"url": "/number/big/decimal/2.5976931e+101"} # type: ignore + get_big_decimal.metadata = {'url': '/number/big/decimal/2.5976931e+101'} # type: ignore + @distributed_trace_async - async def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: + async def put_big_decimal_positive_decimal( + self, + **kwargs: Any + ) -> None: """Put big decimal value 99999999.99. :keyword number_body: The default value is 99999999.99. Note that overriding this default value @@ -612,22 +735,29 @@ async def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_put_big_decimal_positive_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_decimal_positive_decimal.metadata["url"], + template_url=self.put_big_decimal_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -638,10 +768,14 @@ async def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_big_decimal_positive_decimal.metadata = {"url": "/number/big/decimal/99999999.99"} # type: ignore + put_big_decimal_positive_decimal.metadata = {'url': '/number/big/decimal/99999999.99'} # type: ignore + @distributed_trace_async - async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: + async def get_big_decimal_positive_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value 99999999.99. :keyword callable cls: A custom type or function that will be passed the direct response @@ -649,17 +783,24 @@ async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_decimal_positive_decimal_request( - template_url=self.get_big_decimal_positive_decimal.metadata["url"], + template_url=self.get_big_decimal_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -667,17 +808,21 @@ async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_decimal_positive_decimal.metadata = {"url": "/number/big/decimal/99999999.99"} # type: ignore + get_big_decimal_positive_decimal.metadata = {'url': '/number/big/decimal/99999999.99'} # type: ignore + @distributed_trace_async - async def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: + async def put_big_decimal_negative_decimal( + self, + **kwargs: Any + ) -> None: """Put big decimal value -99999999.99. :keyword number_body: The default value is -99999999.99. Note that overriding this default @@ -688,22 +833,29 @@ async def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_put_big_decimal_negative_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_decimal_negative_decimal.metadata["url"], + template_url=self.put_big_decimal_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -714,10 +866,14 @@ async def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_big_decimal_negative_decimal.metadata = {"url": "/number/big/decimal/-99999999.99"} # type: ignore + put_big_decimal_negative_decimal.metadata = {'url': '/number/big/decimal/-99999999.99'} # type: ignore + @distributed_trace_async - async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: + async def get_big_decimal_negative_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value -99999999.99. :keyword callable cls: A custom type or function that will be passed the direct response @@ -725,17 +881,24 @@ async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_decimal_negative_decimal_request( - template_url=self.get_big_decimal_negative_decimal.metadata["url"], + template_url=self.get_big_decimal_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -743,17 +906,22 @@ async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_decimal_negative_decimal.metadata = {"url": "/number/big/decimal/-99999999.99"} # type: ignore + get_big_decimal_negative_decimal.metadata = {'url': '/number/big/decimal/-99999999.99'} # type: ignore + @distributed_trace_async - async def put_small_float(self, number_body: float, **kwargs: Any) -> None: + async def put_small_float( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small float value 3.402823e-20. :param number_body: number body. @@ -763,23 +931,29 @@ async def put_small_float(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_small_float_request( content_type=content_type, json=_json, - template_url=self.put_small_float.metadata["url"], + template_url=self.put_small_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -790,10 +964,14 @@ async def put_small_float(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_small_float.metadata = {"url": "/number/small/float/3.402823e-20"} # type: ignore + put_small_float.metadata = {'url': '/number/small/float/3.402823e-20'} # type: ignore + @distributed_trace_async - async def get_small_float(self, **kwargs: Any) -> float: + async def get_small_float( + self, + **kwargs: Any + ) -> float: """Get big double value 3.402823e-20. :keyword callable cls: A custom type or function that will be passed the direct response @@ -801,17 +979,24 @@ async def get_small_float(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_small_float_request( - template_url=self.get_small_float.metadata["url"], + template_url=self.get_small_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -819,17 +1004,22 @@ async def get_small_float(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_small_float.metadata = {"url": "/number/small/float/3.402823e-20"} # type: ignore + get_small_float.metadata = {'url': '/number/small/float/3.402823e-20'} # type: ignore + @distributed_trace_async - async def put_small_double(self, number_body: float, **kwargs: Any) -> None: + async def put_small_double( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small double value 2.5976931e-101. :param number_body: number body. @@ -839,23 +1029,29 @@ async def put_small_double(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_small_double_request( content_type=content_type, json=_json, - template_url=self.put_small_double.metadata["url"], + template_url=self.put_small_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -866,10 +1062,14 @@ async def put_small_double(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_small_double.metadata = {"url": "/number/small/double/2.5976931e-101"} # type: ignore + put_small_double.metadata = {'url': '/number/small/double/2.5976931e-101'} # type: ignore + @distributed_trace_async - async def get_small_double(self, **kwargs: Any) -> float: + async def get_small_double( + self, + **kwargs: Any + ) -> float: """Get big double value 2.5976931e-101. :keyword callable cls: A custom type or function that will be passed the direct response @@ -877,17 +1077,24 @@ async def get_small_double(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_small_double_request( - template_url=self.get_small_double.metadata["url"], + template_url=self.get_small_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -895,17 +1102,22 @@ async def get_small_double(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_small_double.metadata = {"url": "/number/small/double/2.5976931e-101"} # type: ignore + get_small_double.metadata = {'url': '/number/small/double/2.5976931e-101'} # type: ignore + @distributed_trace_async - async def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: + async def put_small_decimal( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small decimal value 2.5976931e-101. :param number_body: number body. @@ -915,23 +1127,29 @@ async def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_small_decimal_request( content_type=content_type, json=_json, - template_url=self.put_small_decimal.metadata["url"], + template_url=self.put_small_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -942,10 +1160,14 @@ async def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_small_decimal.metadata = {"url": "/number/small/decimal/2.5976931e-101"} # type: ignore + put_small_decimal.metadata = {'url': '/number/small/decimal/2.5976931e-101'} # type: ignore + @distributed_trace_async - async def get_small_decimal(self, **kwargs: Any) -> float: + async def get_small_decimal( + self, + **kwargs: Any + ) -> float: """Get small decimal value 2.5976931e-101. :keyword callable cls: A custom type or function that will be passed the direct response @@ -953,17 +1175,24 @@ async def get_small_decimal(self, **kwargs: Any) -> float: :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_small_decimal_request( - template_url=self.get_small_decimal.metadata["url"], + template_url=self.get_small_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -971,11 +1200,12 @@ async def get_small_decimal(self, **kwargs: Any) -> float: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_small_decimal.metadata = {"url": "/number/small/decimal/2.5976931e-101"} # type: ignore + get_small_decimal.metadata = {'url': '/number/small/decimal/2.5976931e-101'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/__init__.py index e1236613fc6..186262af5a4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/__init__.py @@ -9,5 +9,5 @@ from ._number_operations import NumberOperations __all__ = [ - "NumberOperations", + 'NumberOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py index d77be7e5071..fbdad435567 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -564,7 +556,7 @@ def build_get_small_decimal_request( ) # fmt: on -class NumberOperations(object): +class NumberOperations(object): # pylint: disable=too-many-public-methods """NumberOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -588,7 +580,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[float] """Get null Number value. @@ -598,17 +591,24 @@ def get_null( :rtype: float or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -616,18 +616,20 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/number/null"} # type: ignore + get_null.metadata = {'url': '/number/null'} # type: ignore + @distributed_trace def get_invalid_float( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get invalid float Number value. @@ -637,17 +639,24 @@ def get_invalid_float( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_float_request( - template_url=self.get_invalid_float.metadata["url"], + template_url=self.get_invalid_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -655,18 +664,20 @@ def get_invalid_float( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_float.metadata = {"url": "/number/invalidfloat"} # type: ignore + get_invalid_float.metadata = {'url': '/number/invalidfloat'} # type: ignore + @distributed_trace def get_invalid_double( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get invalid double Number value. @@ -676,17 +687,24 @@ def get_invalid_double( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_double_request( - template_url=self.get_invalid_double.metadata["url"], + template_url=self.get_invalid_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -694,18 +712,20 @@ def get_invalid_double( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_double.metadata = {"url": "/number/invaliddouble"} # type: ignore + get_invalid_double.metadata = {'url': '/number/invaliddouble'} # type: ignore + @distributed_trace def get_invalid_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get invalid decimal Number value. @@ -715,17 +735,24 @@ def get_invalid_decimal( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_invalid_decimal_request( - template_url=self.get_invalid_decimal.metadata["url"], + template_url=self.get_invalid_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -733,14 +760,15 @@ def get_invalid_decimal( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_invalid_decimal.metadata = {"url": "/number/invaliddecimal"} # type: ignore + get_invalid_decimal.metadata = {'url': '/number/invaliddecimal'} # type: ignore + @distributed_trace def put_big_float( @@ -758,23 +786,29 @@ def put_big_float( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_big_float_request( content_type=content_type, json=_json, - template_url=self.put_big_float.metadata["url"], + template_url=self.put_big_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -785,11 +819,13 @@ def put_big_float( if cls: return cls(pipeline_response, None, {}) - put_big_float.metadata = {"url": "/number/big/float/3.402823e+20"} # type: ignore + put_big_float.metadata = {'url': '/number/big/float/3.402823e+20'} # type: ignore + @distributed_trace def get_big_float( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big float value 3.402823e+20. @@ -799,17 +835,24 @@ def get_big_float( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_float_request( - template_url=self.get_big_float.metadata["url"], + template_url=self.get_big_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -817,14 +860,15 @@ def get_big_float( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_float.metadata = {"url": "/number/big/float/3.402823e+20"} # type: ignore + get_big_float.metadata = {'url': '/number/big/float/3.402823e+20'} # type: ignore + @distributed_trace def put_big_double( @@ -842,23 +886,29 @@ def put_big_double( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_big_double_request( content_type=content_type, json=_json, - template_url=self.put_big_double.metadata["url"], + template_url=self.put_big_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -869,11 +919,13 @@ def put_big_double( if cls: return cls(pipeline_response, None, {}) - put_big_double.metadata = {"url": "/number/big/double/2.5976931e+101"} # type: ignore + put_big_double.metadata = {'url': '/number/big/double/2.5976931e+101'} # type: ignore + @distributed_trace def get_big_double( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big double value 2.5976931e+101. @@ -883,17 +935,24 @@ def get_big_double( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_double_request( - template_url=self.get_big_double.metadata["url"], + template_url=self.get_big_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -901,18 +960,20 @@ def get_big_double( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_double.metadata = {"url": "/number/big/double/2.5976931e+101"} # type: ignore + get_big_double.metadata = {'url': '/number/big/double/2.5976931e+101'} # type: ignore + @distributed_trace def put_big_double_positive_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Put big double value 99999999.99. @@ -925,22 +986,29 @@ def put_big_double_positive_decimal( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_put_big_double_positive_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_double_positive_decimal.metadata["url"], + template_url=self.put_big_double_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -951,11 +1019,13 @@ def put_big_double_positive_decimal( if cls: return cls(pipeline_response, None, {}) - put_big_double_positive_decimal.metadata = {"url": "/number/big/double/99999999.99"} # type: ignore + put_big_double_positive_decimal.metadata = {'url': '/number/big/double/99999999.99'} # type: ignore + @distributed_trace def get_big_double_positive_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big double value 99999999.99. @@ -965,17 +1035,24 @@ def get_big_double_positive_decimal( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_double_positive_decimal_request( - template_url=self.get_big_double_positive_decimal.metadata["url"], + template_url=self.get_big_double_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -983,18 +1060,20 @@ def get_big_double_positive_decimal( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_double_positive_decimal.metadata = {"url": "/number/big/double/99999999.99"} # type: ignore + get_big_double_positive_decimal.metadata = {'url': '/number/big/double/99999999.99'} # type: ignore + @distributed_trace def put_big_double_negative_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Put big double value -99999999.99. @@ -1007,22 +1086,29 @@ def put_big_double_negative_decimal( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_put_big_double_negative_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_double_negative_decimal.metadata["url"], + template_url=self.put_big_double_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1033,11 +1119,13 @@ def put_big_double_negative_decimal( if cls: return cls(pipeline_response, None, {}) - put_big_double_negative_decimal.metadata = {"url": "/number/big/double/-99999999.99"} # type: ignore + put_big_double_negative_decimal.metadata = {'url': '/number/big/double/-99999999.99'} # type: ignore + @distributed_trace def get_big_double_negative_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big double value -99999999.99. @@ -1047,17 +1135,24 @@ def get_big_double_negative_decimal( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_double_negative_decimal_request( - template_url=self.get_big_double_negative_decimal.metadata["url"], + template_url=self.get_big_double_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1065,14 +1160,15 @@ def get_big_double_negative_decimal( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_double_negative_decimal.metadata = {"url": "/number/big/double/-99999999.99"} # type: ignore + get_big_double_negative_decimal.metadata = {'url': '/number/big/double/-99999999.99'} # type: ignore + @distributed_trace def put_big_decimal( @@ -1090,23 +1186,29 @@ def put_big_decimal( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_big_decimal_request( content_type=content_type, json=_json, - template_url=self.put_big_decimal.metadata["url"], + template_url=self.put_big_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1117,11 +1219,13 @@ def put_big_decimal( if cls: return cls(pipeline_response, None, {}) - put_big_decimal.metadata = {"url": "/number/big/decimal/2.5976931e+101"} # type: ignore + put_big_decimal.metadata = {'url': '/number/big/decimal/2.5976931e+101'} # type: ignore + @distributed_trace def get_big_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big decimal value 2.5976931e+101. @@ -1131,17 +1235,24 @@ def get_big_decimal( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_decimal_request( - template_url=self.get_big_decimal.metadata["url"], + template_url=self.get_big_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1149,18 +1260,20 @@ def get_big_decimal( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_decimal.metadata = {"url": "/number/big/decimal/2.5976931e+101"} # type: ignore + get_big_decimal.metadata = {'url': '/number/big/decimal/2.5976931e+101'} # type: ignore + @distributed_trace def put_big_decimal_positive_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Put big decimal value 99999999.99. @@ -1173,22 +1286,29 @@ def put_big_decimal_positive_decimal( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_put_big_decimal_positive_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_decimal_positive_decimal.metadata["url"], + template_url=self.put_big_decimal_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1199,11 +1319,13 @@ def put_big_decimal_positive_decimal( if cls: return cls(pipeline_response, None, {}) - put_big_decimal_positive_decimal.metadata = {"url": "/number/big/decimal/99999999.99"} # type: ignore + put_big_decimal_positive_decimal.metadata = {'url': '/number/big/decimal/99999999.99'} # type: ignore + @distributed_trace def get_big_decimal_positive_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big decimal value 99999999.99. @@ -1213,17 +1335,24 @@ def get_big_decimal_positive_decimal( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_decimal_positive_decimal_request( - template_url=self.get_big_decimal_positive_decimal.metadata["url"], + template_url=self.get_big_decimal_positive_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1231,18 +1360,20 @@ def get_big_decimal_positive_decimal( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_decimal_positive_decimal.metadata = {"url": "/number/big/decimal/99999999.99"} # type: ignore + get_big_decimal_positive_decimal.metadata = {'url': '/number/big/decimal/99999999.99'} # type: ignore + @distributed_trace def put_big_decimal_negative_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Put big decimal value -99999999.99. @@ -1255,22 +1386,29 @@ def put_big_decimal_negative_decimal( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_put_big_decimal_negative_decimal_request( content_type=content_type, json=number_body, - template_url=self.put_big_decimal_negative_decimal.metadata["url"], + template_url=self.put_big_decimal_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1281,11 +1419,13 @@ def put_big_decimal_negative_decimal( if cls: return cls(pipeline_response, None, {}) - put_big_decimal_negative_decimal.metadata = {"url": "/number/big/decimal/-99999999.99"} # type: ignore + put_big_decimal_negative_decimal.metadata = {'url': '/number/big/decimal/-99999999.99'} # type: ignore + @distributed_trace def get_big_decimal_negative_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big decimal value -99999999.99. @@ -1295,17 +1435,24 @@ def get_big_decimal_negative_decimal( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_big_decimal_negative_decimal_request( - template_url=self.get_big_decimal_negative_decimal.metadata["url"], + template_url=self.get_big_decimal_negative_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1313,14 +1460,15 @@ def get_big_decimal_negative_decimal( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_big_decimal_negative_decimal.metadata = {"url": "/number/big/decimal/-99999999.99"} # type: ignore + get_big_decimal_negative_decimal.metadata = {'url': '/number/big/decimal/-99999999.99'} # type: ignore + @distributed_trace def put_small_float( @@ -1338,23 +1486,29 @@ def put_small_float( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_small_float_request( content_type=content_type, json=_json, - template_url=self.put_small_float.metadata["url"], + template_url=self.put_small_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1365,11 +1519,13 @@ def put_small_float( if cls: return cls(pipeline_response, None, {}) - put_small_float.metadata = {"url": "/number/small/float/3.402823e-20"} # type: ignore + put_small_float.metadata = {'url': '/number/small/float/3.402823e-20'} # type: ignore + @distributed_trace def get_small_float( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big double value 3.402823e-20. @@ -1379,17 +1535,24 @@ def get_small_float( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_small_float_request( - template_url=self.get_small_float.metadata["url"], + template_url=self.get_small_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1397,14 +1560,15 @@ def get_small_float( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_small_float.metadata = {"url": "/number/small/float/3.402823e-20"} # type: ignore + get_small_float.metadata = {'url': '/number/small/float/3.402823e-20'} # type: ignore + @distributed_trace def put_small_double( @@ -1422,23 +1586,29 @@ def put_small_double( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_small_double_request( content_type=content_type, json=_json, - template_url=self.put_small_double.metadata["url"], + template_url=self.put_small_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1449,11 +1619,13 @@ def put_small_double( if cls: return cls(pipeline_response, None, {}) - put_small_double.metadata = {"url": "/number/small/double/2.5976931e-101"} # type: ignore + put_small_double.metadata = {'url': '/number/small/double/2.5976931e-101'} # type: ignore + @distributed_trace def get_small_double( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get big double value 2.5976931e-101. @@ -1463,17 +1635,24 @@ def get_small_double( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_small_double_request( - template_url=self.get_small_double.metadata["url"], + template_url=self.get_small_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1481,14 +1660,15 @@ def get_small_double( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_small_double.metadata = {"url": "/number/small/double/2.5976931e-101"} # type: ignore + get_small_double.metadata = {'url': '/number/small/double/2.5976931e-101'} # type: ignore + @distributed_trace def put_small_decimal( @@ -1506,23 +1686,29 @@ def put_small_decimal( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(number_body, "float") + _json = self._serialize.body(number_body, 'float') request = build_put_small_decimal_request( content_type=content_type, json=_json, - template_url=self.put_small_decimal.metadata["url"], + template_url=self.put_small_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1533,11 +1719,13 @@ def put_small_decimal( if cls: return cls(pipeline_response, None, {}) - put_small_decimal.metadata = {"url": "/number/small/decimal/2.5976931e-101"} # type: ignore + put_small_decimal.metadata = {'url': '/number/small/decimal/2.5976931e-101'} # type: ignore + @distributed_trace def get_small_decimal( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> float """Get small decimal value 2.5976931e-101. @@ -1547,17 +1735,24 @@ def get_small_decimal( :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_small_decimal_request( - template_url=self.get_small_decimal.metadata["url"], + template_url=self.get_small_decimal.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1565,11 +1760,12 @@ def get_small_decimal( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_small_decimal.metadata = {"url": "/number/small/decimal/2.5976931e-101"} # type: ignore + get_small_decimal.metadata = {'url': '/number/small/decimal/2.5976931e-101'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py index f2c282a12aa..b71e9aed9fc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/__init__.py index 86f0d888647..d160e037104 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATService"] +__all__ = ['AutoRestSwaggerBATService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py index 752a41e29e0..24d370eb7e5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -50,6 +49,7 @@ def __init__( self.string = StringOperations(self._client, self._config, self._serialize, self._deserialize) self.enum = EnumOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_configuration.py index 79befee47c6..30844bde201 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATServiceConfiguration(Configuration): +class AutoRestSwaggerBATServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/__init__.py index 865075d6286..9fe2b43623d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_service import AutoRestSwaggerBATService - -__all__ = ["AutoRestSwaggerBATService"] +__all__ = ['AutoRestSwaggerBATService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py index 196bebd74bc..8a397df5199 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATServiceConfiguration from .operations import EnumOperations, StringOperations - class AutoRestSwaggerBATService: """Test Infrastructure for AutoRest Swagger BAT. @@ -29,7 +28,11 @@ class AutoRestSwaggerBATService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -40,7 +43,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self.string = StringOperations(self._client, self._config, self._serialize, self._deserialize) self.enum = EnumOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_configuration.py index b78427e6b41..95456b43dd5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATServiceConfiguration(Configuration): +class AutoRestSwaggerBATServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/__init__.py index 09c18bc20bf..7fd1174a43c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._enum_operations import EnumOperations __all__ = [ - "StringOperations", - "EnumOperations", + 'StringOperations', + 'EnumOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py index 03937948fe8..288b0a0f571 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,19 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._enum_operations import ( - build_get_not_expandable_request, - build_get_referenced_constant_request, - build_get_referenced_request, - build_put_not_expandable_request, - build_put_referenced_constant_request, - build_put_referenced_request, -) - -T = TypeVar("T") +from ...operations._enum_operations import build_get_not_expandable_request, build_get_referenced_constant_request, build_get_referenced_request, build_put_not_expandable_request, build_put_referenced_constant_request, build_put_referenced_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class EnumOperations: """EnumOperations async operations. @@ -59,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_not_expandable(self, **kwargs: Any) -> Union[str, "_models.Colors"]: + async def get_not_expandable( + self, + **kwargs: Any + ) -> Union[str, "_models.Colors"]: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -67,17 +54,24 @@ async def get_not_expandable(self, **kwargs: Any) -> Union[str, "_models.Colors" :rtype: str or ~bodystring.models.Colors :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[str, "_models.Colors"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[str, "_models.Colors"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_expandable_request( - template_url=self.get_not_expandable.metadata["url"], + template_url=self.get_not_expandable.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,17 +79,22 @@ async def get_not_expandable(self, **kwargs: Any) -> Union[str, "_models.Colors" error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_expandable.metadata = {"url": "/string/enum/notExpandable"} # type: ignore + get_not_expandable.metadata = {'url': '/string/enum/notExpandable'} # type: ignore + @distributed_trace_async - async def put_not_expandable(self, string_body: Union[str, "_models.Colors"], **kwargs: Any) -> None: + async def put_not_expandable( + self, + string_body: Union[str, "_models.Colors"], + **kwargs: Any + ) -> None: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :param string_body: string body. @@ -105,23 +104,29 @@ async def put_not_expandable(self, string_body: Union[str, "_models.Colors"], ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(string_body, "str") + _json = self._serialize.body(string_body, 'str') request = build_put_not_expandable_request( content_type=content_type, json=_json, - template_url=self.put_not_expandable.metadata["url"], + template_url=self.put_not_expandable.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,10 +137,14 @@ async def put_not_expandable(self, string_body: Union[str, "_models.Colors"], ** if cls: return cls(pipeline_response, None, {}) - put_not_expandable.metadata = {"url": "/string/enum/notExpandable"} # type: ignore + put_not_expandable.metadata = {'url': '/string/enum/notExpandable'} # type: ignore + @distributed_trace_async - async def get_referenced(self, **kwargs: Any) -> Union[str, "_models.Colors"]: + async def get_referenced( + self, + **kwargs: Any + ) -> Union[str, "_models.Colors"]: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -143,17 +152,24 @@ async def get_referenced(self, **kwargs: Any) -> Union[str, "_models.Colors"]: :rtype: str or ~bodystring.models.Colors :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[str, "_models.Colors"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[str, "_models.Colors"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_referenced_request( - template_url=self.get_referenced.metadata["url"], + template_url=self.get_referenced.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -161,17 +177,22 @@ async def get_referenced(self, **kwargs: Any) -> Union[str, "_models.Colors"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_referenced.metadata = {"url": "/string/enum/Referenced"} # type: ignore + get_referenced.metadata = {'url': '/string/enum/Referenced'} # type: ignore + @distributed_trace_async - async def put_referenced(self, enum_string_body: Union[str, "_models.Colors"], **kwargs: Any) -> None: + async def put_referenced( + self, + enum_string_body: Union[str, "_models.Colors"], + **kwargs: Any + ) -> None: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :param enum_string_body: enum string body. @@ -181,23 +202,29 @@ async def put_referenced(self, enum_string_body: Union[str, "_models.Colors"], * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(enum_string_body, "str") + _json = self._serialize.body(enum_string_body, 'str') request = build_put_referenced_request( content_type=content_type, json=_json, - template_url=self.put_referenced.metadata["url"], + template_url=self.put_referenced.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -208,10 +235,14 @@ async def put_referenced(self, enum_string_body: Union[str, "_models.Colors"], * if cls: return cls(pipeline_response, None, {}) - put_referenced.metadata = {"url": "/string/enum/Referenced"} # type: ignore + put_referenced.metadata = {'url': '/string/enum/Referenced'} # type: ignore + @distributed_trace_async - async def get_referenced_constant(self, **kwargs: Any) -> "_models.RefColorConstant": + async def get_referenced_constant( + self, + **kwargs: Any + ) -> "_models.RefColorConstant": """Get value 'green-color' from the constant. :keyword callable cls: A custom type or function that will be passed the direct response @@ -219,17 +250,24 @@ async def get_referenced_constant(self, **kwargs: Any) -> "_models.RefColorConst :rtype: ~bodystring.models.RefColorConstant :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.RefColorConstant"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.RefColorConstant"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_referenced_constant_request( - template_url=self.get_referenced_constant.metadata["url"], + template_url=self.get_referenced_constant.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -237,17 +275,22 @@ async def get_referenced_constant(self, **kwargs: Any) -> "_models.RefColorConst error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("RefColorConstant", pipeline_response) + deserialized = self._deserialize('RefColorConstant', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_referenced_constant.metadata = {"url": "/string/enum/ReferencedConstant"} # type: ignore + get_referenced_constant.metadata = {'url': '/string/enum/ReferencedConstant'} # type: ignore + @distributed_trace_async - async def put_referenced_constant(self, field1: Optional[str] = None, **kwargs: Any) -> None: + async def put_referenced_constant( + self, + field1: Optional[str] = None, + **kwargs: Any + ) -> None: """Sends value 'green-color' from a constant. :param field1: Sample string. @@ -260,25 +303,31 @@ async def put_referenced_constant(self, field1: Optional[str] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - color_constant = kwargs.pop("color_constant", "green-color") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + color_constant = kwargs.pop('color_constant', "green-color") # type: str _enum_string_body = _models.RefColorConstant(color_constant=color_constant, field1=field1) - _json = self._serialize.body(_enum_string_body, "RefColorConstant") + _json = self._serialize.body(_enum_string_body, 'RefColorConstant') request = build_put_referenced_constant_request( content_type=content_type, json=_json, - template_url=self.put_referenced_constant.metadata["url"], + template_url=self.put_referenced_constant.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -289,4 +338,5 @@ async def put_referenced_constant(self, field1: Optional[str] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) - put_referenced_constant.metadata = {"url": "/string/enum/ReferencedConstant"} # type: ignore + put_referenced_constant.metadata = {'url': '/string/enum/ReferencedConstant'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py index d0fd0e470a0..5084650f294 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,26 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._string_operations import ( - build_get_base64_encoded_request, - build_get_base64_url_encoded_request, - build_get_empty_request, - build_get_mbcs_request, - build_get_not_provided_request, - build_get_null_base64_url_encoded_request, - build_get_null_request, - build_get_whitespace_request, - build_put_base64_url_encoded_request, - build_put_empty_request, - build_put_mbcs_request, - build_put_null_request, - build_put_whitespace_request, -) - -T = TypeVar("T") +from ...operations._string_operations import build_get_base64_encoded_request, build_get_base64_url_encoded_request, build_get_empty_request, build_get_mbcs_request, build_get_not_provided_request, build_get_null_base64_url_encoded_request, build_get_null_request, build_get_whitespace_request, build_put_base64_url_encoded_request, build_put_empty_request, build_put_mbcs_request, build_put_null_request, build_put_whitespace_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class StringOperations: """StringOperations async operations. @@ -66,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[str]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[str]: """Get null string value value. :keyword callable cls: A custom type or function that will be passed the direct response @@ -74,17 +54,24 @@ async def get_null(self, **kwargs: Any) -> Optional[str]: :rtype: str or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,17 +79,22 @@ async def get_null(self, **kwargs: Any) -> Optional[str]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/string/null"} # type: ignore + get_null.metadata = {'url': '/string/null'} # type: ignore + @distributed_trace_async - async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> None: + async def put_null( + self, + string_body: Optional[str] = None, + **kwargs: Any + ) -> None: """Set string value null. :param string_body: string body. @@ -112,26 +104,32 @@ async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if string_body is not None: - _json = self._serialize.body(string_body, "str") + _json = self._serialize.body(string_body, 'str') else: _json = None request = build_put_null_request( content_type=content_type, json=_json, - template_url=self.put_null.metadata["url"], + template_url=self.put_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -142,10 +140,14 @@ async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - put_null.metadata = {"url": "/string/null"} # type: ignore + put_null.metadata = {'url': '/string/null'} # type: ignore + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> str: + async def get_empty( + self, + **kwargs: Any + ) -> str: """Get empty string value value ''. :keyword callable cls: A custom type or function that will be passed the direct response @@ -153,17 +155,24 @@ async def get_empty(self, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,17 +180,21 @@ async def get_empty(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/string/empty"} # type: ignore + get_empty.metadata = {'url': '/string/empty'} # type: ignore + @distributed_trace_async - async def put_empty(self, **kwargs: Any) -> None: + async def put_empty( + self, + **kwargs: Any + ) -> None: """Set string value empty ''. :keyword string_body: string body. The default value is "". Note that overriding this default @@ -192,22 +205,29 @@ async def put_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop("string_body", "") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "") # type: str + request = build_put_empty_request( content_type=content_type, json=string_body, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -218,10 +238,14 @@ async def put_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/string/empty"} # type: ignore + put_empty.metadata = {'url': '/string/empty'} # type: ignore + @distributed_trace_async - async def get_mbcs(self, **kwargs: Any) -> str: + async def get_mbcs( + self, + **kwargs: Any + ) -> str: """Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -229,17 +253,24 @@ async def get_mbcs(self, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_mbcs_request( - template_url=self.get_mbcs.metadata["url"], + template_url=self.get_mbcs.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,17 +278,21 @@ async def get_mbcs(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_mbcs.metadata = {"url": "/string/mbcs"} # type: ignore + get_mbcs.metadata = {'url': '/string/mbcs'} # type: ignore + @distributed_trace_async - async def put_mbcs(self, **kwargs: Any) -> None: + async def put_mbcs( + self, + **kwargs: Any + ) -> None: """Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. :keyword string_body: string body. The default value is @@ -269,24 +304,29 @@ async def put_mbcs(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€" - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str + request = build_put_mbcs_request( content_type=content_type, json=string_body, - template_url=self.put_mbcs.metadata["url"], + template_url=self.put_mbcs.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -297,10 +337,14 @@ async def put_mbcs(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_mbcs.metadata = {"url": "/string/mbcs"} # type: ignore + put_mbcs.metadata = {'url': '/string/mbcs'} # type: ignore + @distributed_trace_async - async def get_whitespace(self, **kwargs: Any) -> str: + async def get_whitespace( + self, + **kwargs: Any + ) -> str: """Get string value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -310,17 +354,24 @@ async def get_whitespace(self, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_whitespace_request( - template_url=self.get_whitespace.metadata["url"], + template_url=self.get_whitespace.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,17 +379,21 @@ async def get_whitespace(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_whitespace.metadata = {"url": "/string/whitespace"} # type: ignore + get_whitespace.metadata = {'url': '/string/whitespace'} # type: ignore + @distributed_trace_async - async def put_whitespace(self, **kwargs: Any) -> None: + async def put_whitespace( + self, + **kwargs: Any + ) -> None: """Set String value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -352,24 +407,29 @@ async def put_whitespace(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", " Now is the time for all good men to come to the aid of their country " - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', " Now is the time for all good men to come to the aid of their country ") # type: str + request = build_put_whitespace_request( content_type=content_type, json=string_body, - template_url=self.put_whitespace.metadata["url"], + template_url=self.put_whitespace.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -380,10 +440,14 @@ async def put_whitespace(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_whitespace.metadata = {"url": "/string/whitespace"} # type: ignore + put_whitespace.metadata = {'url': '/string/whitespace'} # type: ignore + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> str: + async def get_not_provided( + self, + **kwargs: Any + ) -> str: """Get String value when no string value is sent in response payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -391,17 +455,24 @@ async def get_not_provided(self, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,17 +480,21 @@ async def get_not_provided(self, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/string/notProvided"} # type: ignore + get_not_provided.metadata = {'url': '/string/notProvided'} # type: ignore + @distributed_trace_async - async def get_base64_encoded(self, **kwargs: Any) -> bytearray: + async def get_base64_encoded( + self, + **kwargs: Any + ) -> bytearray: """Get value that is base64 encoded. :keyword callable cls: A custom type or function that will be passed the direct response @@ -427,17 +502,24 @@ async def get_base64_encoded(self, **kwargs: Any) -> bytearray: :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_encoded_request( - template_url=self.get_base64_encoded.metadata["url"], + template_url=self.get_base64_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -445,17 +527,21 @@ async def get_base64_encoded(self, **kwargs: Any) -> bytearray: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_encoded.metadata = {"url": "/string/base64Encoding"} # type: ignore + get_base64_encoded.metadata = {'url': '/string/base64Encoding'} # type: ignore + @distributed_trace_async - async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: + async def get_base64_url_encoded( + self, + **kwargs: Any + ) -> bytes: """Get value that is base64url encoded. :keyword callable cls: A custom type or function that will be passed the direct response @@ -463,17 +549,24 @@ async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytes] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytes] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_encoded_request( - template_url=self.get_base64_url_encoded.metadata["url"], + template_url=self.get_base64_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -481,17 +574,22 @@ async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("base64", pipeline_response) + deserialized = self._deserialize('base64', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url_encoded.metadata = {"url": "/string/base64UrlEncoding"} # type: ignore + get_base64_url_encoded.metadata = {'url': '/string/base64UrlEncoding'} # type: ignore + @distributed_trace_async - async def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> None: + async def put_base64_url_encoded( + self, + string_body: bytes, + **kwargs: Any + ) -> None: """Put value that is base64url encoded. :param string_body: string body. @@ -501,23 +599,29 @@ async def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(string_body, "base64") + _json = self._serialize.body(string_body, 'base64') request = build_put_base64_url_encoded_request( content_type=content_type, json=_json, - template_url=self.put_base64_url_encoded.metadata["url"], + template_url=self.put_base64_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -528,10 +632,14 @@ async def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - put_base64_url_encoded.metadata = {"url": "/string/base64UrlEncoding"} # type: ignore + put_base64_url_encoded.metadata = {'url': '/string/base64UrlEncoding'} # type: ignore + @distributed_trace_async - async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: + async def get_null_base64_url_encoded( + self, + **kwargs: Any + ) -> Optional[bytes]: """Get null value that is expected to be base64url encoded. :keyword callable cls: A custom type or function that will be passed the direct response @@ -539,17 +647,24 @@ async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: :rtype: bytes or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_base64_url_encoded_request( - template_url=self.get_null_base64_url_encoded.metadata["url"], + template_url=self.get_null_base64_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,11 +672,12 @@ async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("base64", pipeline_response) + deserialized = self._deserialize('base64', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_base64_url_encoded.metadata = {"url": "/string/nullBase64UrlEncoding"} # type: ignore + get_null_base64_url_encoded.metadata = {'url': '/string/nullBase64UrlEncoding'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py index abc5af6bcb3..9a63af93a33 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py @@ -18,7 +18,7 @@ ) __all__ = [ - "Error", - "RefColorConstant", - "Colors", + 'Error', + 'RefColorConstant', + 'Colors', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_auto_rest_swagger_bat_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_auto_rest_swagger_bat_service_enums.py index c749a18ba65..6d154c05d74 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_auto_rest_swagger_bat_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_auto_rest_swagger_bat_service_enums.py @@ -12,7 +12,8 @@ class Colors(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Referenced Color Enum Description.""" + """Referenced Color Enum Description. + """ RED_COLOR = "red color" GREEN_COLOR = "green-color" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py index 33c2cae6518..5e08de4e9b4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class RefColorConstant(msrest.serialization.Model): @@ -50,20 +53,23 @@ class RefColorConstant(msrest.serialization.Model): """ _validation = { - "color_constant": {"required": True, "constant": True}, + 'color_constant': {'required': True, 'constant': True}, } _attribute_map = { - "color_constant": {"key": "ColorConstant", "type": "str"}, - "field1": {"key": "field1", "type": "str"}, + 'color_constant': {'key': 'ColorConstant', 'type': 'str'}, + 'field1': {'key': 'field1', 'type': 'str'}, } color_constant = "green-color" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword field1: Sample string. :paramtype field1: str """ super(RefColorConstant, self).__init__(**kwargs) - self.field1 = kwargs.get("field1", None) + self.field1 = kwargs.get('field1', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py index ce27fb34c93..e8f3deed8b9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -52,17 +58,22 @@ class RefColorConstant(msrest.serialization.Model): """ _validation = { - "color_constant": {"required": True, "constant": True}, + 'color_constant': {'required': True, 'constant': True}, } _attribute_map = { - "color_constant": {"key": "ColorConstant", "type": "str"}, - "field1": {"key": "field1", "type": "str"}, + 'color_constant': {'key': 'ColorConstant', 'type': 'str'}, + 'field1': {'key': 'field1', 'type': 'str'}, } color_constant = "green-color" - def __init__(self, *, field1: Optional[str] = None, **kwargs): + def __init__( + self, + *, + field1: Optional[str] = None, + **kwargs + ): """ :keyword field1: Sample string. :paramtype field1: str diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/__init__.py index 09c18bc20bf..7fd1174a43c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/__init__.py @@ -10,6 +10,6 @@ from ._enum_operations import EnumOperations __all__ = [ - "StringOperations", - "EnumOperations", + 'StringOperations', + 'EnumOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py index 7c4623a2054..9f65edff615 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -192,7 +184,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_not_expandable( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union[str, "_models.Colors"] """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. @@ -202,17 +195,24 @@ def get_not_expandable( :rtype: str or ~bodystring.models.Colors :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[str, "_models.Colors"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[str, "_models.Colors"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_expandable_request( - template_url=self.get_not_expandable.metadata["url"], + template_url=self.get_not_expandable.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -220,14 +220,15 @@ def get_not_expandable( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_expandable.metadata = {"url": "/string/enum/notExpandable"} # type: ignore + get_not_expandable.metadata = {'url': '/string/enum/notExpandable'} # type: ignore + @distributed_trace def put_not_expandable( @@ -245,23 +246,29 @@ def put_not_expandable( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(string_body, "str") + _json = self._serialize.body(string_body, 'str') request = build_put_not_expandable_request( content_type=content_type, json=_json, - template_url=self.put_not_expandable.metadata["url"], + template_url=self.put_not_expandable.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,11 +279,13 @@ def put_not_expandable( if cls: return cls(pipeline_response, None, {}) - put_not_expandable.metadata = {"url": "/string/enum/notExpandable"} # type: ignore + put_not_expandable.metadata = {'url': '/string/enum/notExpandable'} # type: ignore + @distributed_trace def get_referenced( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union[str, "_models.Colors"] """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. @@ -286,17 +295,24 @@ def get_referenced( :rtype: str or ~bodystring.models.Colors :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[str, "_models.Colors"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[str, "_models.Colors"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_referenced_request( - template_url=self.get_referenced.metadata["url"], + template_url=self.get_referenced.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -304,14 +320,15 @@ def get_referenced( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_referenced.metadata = {"url": "/string/enum/Referenced"} # type: ignore + get_referenced.metadata = {'url': '/string/enum/Referenced'} # type: ignore + @distributed_trace def put_referenced( @@ -329,23 +346,29 @@ def put_referenced( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(enum_string_body, "str") + _json = self._serialize.body(enum_string_body, 'str') request = build_put_referenced_request( content_type=content_type, json=_json, - template_url=self.put_referenced.metadata["url"], + template_url=self.put_referenced.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -356,11 +379,13 @@ def put_referenced( if cls: return cls(pipeline_response, None, {}) - put_referenced.metadata = {"url": "/string/enum/Referenced"} # type: ignore + put_referenced.metadata = {'url': '/string/enum/Referenced'} # type: ignore + @distributed_trace def get_referenced_constant( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.RefColorConstant" """Get value 'green-color' from the constant. @@ -370,17 +395,24 @@ def get_referenced_constant( :rtype: ~bodystring.models.RefColorConstant :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.RefColorConstant"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.RefColorConstant"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_referenced_constant_request( - template_url=self.get_referenced_constant.metadata["url"], + template_url=self.get_referenced_constant.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -388,14 +420,15 @@ def get_referenced_constant( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("RefColorConstant", pipeline_response) + deserialized = self._deserialize('RefColorConstant', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_referenced_constant.metadata = {"url": "/string/enum/ReferencedConstant"} # type: ignore + get_referenced_constant.metadata = {'url': '/string/enum/ReferencedConstant'} # type: ignore + @distributed_trace def put_referenced_constant( @@ -416,25 +449,31 @@ def put_referenced_constant( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - color_constant = kwargs.pop("color_constant", "green-color") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + color_constant = kwargs.pop('color_constant', "green-color") # type: str _enum_string_body = _models.RefColorConstant(color_constant=color_constant, field1=field1) - _json = self._serialize.body(_enum_string_body, "RefColorConstant") + _json = self._serialize.body(_enum_string_body, 'RefColorConstant') request = build_put_referenced_constant_request( content_type=content_type, json=_json, - template_url=self.put_referenced_constant.metadata["url"], + template_url=self.put_referenced_constant.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -445,4 +484,5 @@ def put_referenced_constant( if cls: return cls(pipeline_response, None, {}) - put_referenced_constant.metadata = {"url": "/string/enum/ReferencedConstant"} # type: ignore + put_referenced_constant.metadata = {'url': '/string/enum/ReferencedConstant'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py index e10e7ee11c7..3dbbdb792d7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -346,7 +338,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_null( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[str] """Get null string value value. @@ -356,17 +349,24 @@ def get_null( :rtype: str or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_request( - template_url=self.get_null.metadata["url"], + template_url=self.get_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -374,14 +374,15 @@ def get_null( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null.metadata = {"url": "/string/null"} # type: ignore + get_null.metadata = {'url': '/string/null'} # type: ignore + @distributed_trace def put_null( @@ -399,26 +400,32 @@ def put_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if string_body is not None: - _json = self._serialize.body(string_body, "str") + _json = self._serialize.body(string_body, 'str') else: _json = None request = build_put_null_request( content_type=content_type, json=_json, - template_url=self.put_null.metadata["url"], + template_url=self.put_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -429,11 +436,13 @@ def put_null( if cls: return cls(pipeline_response, None, {}) - put_null.metadata = {"url": "/string/null"} # type: ignore + put_null.metadata = {'url': '/string/null'} # type: ignore + @distributed_trace def get_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> str """Get empty string value value ''. @@ -443,17 +452,24 @@ def get_empty( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -461,18 +477,20 @@ def get_empty( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty.metadata = {"url": "/string/empty"} # type: ignore + get_empty.metadata = {'url': '/string/empty'} # type: ignore + @distributed_trace def put_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Set string value empty ''. @@ -485,22 +503,29 @@ def put_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop("string_body", "") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "") # type: str + request = build_put_empty_request( content_type=content_type, json=string_body, - template_url=self.put_empty.metadata["url"], + template_url=self.put_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -511,11 +536,13 @@ def put_empty( if cls: return cls(pipeline_response, None, {}) - put_empty.metadata = {"url": "/string/empty"} # type: ignore + put_empty.metadata = {'url': '/string/empty'} # type: ignore + @distributed_trace def get_mbcs( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> str """Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. @@ -525,17 +552,24 @@ def get_mbcs( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_mbcs_request( - template_url=self.get_mbcs.metadata["url"], + template_url=self.get_mbcs.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -543,18 +577,20 @@ def get_mbcs( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_mbcs.metadata = {"url": "/string/mbcs"} # type: ignore + get_mbcs.metadata = {'url': '/string/mbcs'} # type: ignore + @distributed_trace def put_mbcs( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. @@ -568,24 +604,29 @@ def put_mbcs( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€" - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str + request = build_put_mbcs_request( content_type=content_type, json=string_body, - template_url=self.put_mbcs.metadata["url"], + template_url=self.put_mbcs.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,11 +637,13 @@ def put_mbcs( if cls: return cls(pipeline_response, None, {}) - put_mbcs.metadata = {"url": "/string/mbcs"} # type: ignore + put_mbcs.metadata = {'url': '/string/mbcs'} # type: ignore + @distributed_trace def get_whitespace( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> str """Get string value with leading and trailing whitespace @@ -612,17 +655,24 @@ def get_whitespace( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_whitespace_request( - template_url=self.get_whitespace.metadata["url"], + template_url=self.get_whitespace.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -630,18 +680,20 @@ def get_whitespace( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_whitespace.metadata = {"url": "/string/whitespace"} # type: ignore + get_whitespace.metadata = {'url': '/string/whitespace'} # type: ignore + @distributed_trace def put_whitespace( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Set String value with leading and trailing whitespace @@ -657,24 +709,29 @@ def put_whitespace( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", " Now is the time for all good men to come to the aid of their country " - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', " Now is the time for all good men to come to the aid of their country ") # type: str + request = build_put_whitespace_request( content_type=content_type, json=string_body, - template_url=self.put_whitespace.metadata["url"], + template_url=self.put_whitespace.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -685,11 +742,13 @@ def put_whitespace( if cls: return cls(pipeline_response, None, {}) - put_whitespace.metadata = {"url": "/string/whitespace"} # type: ignore + put_whitespace.metadata = {'url': '/string/whitespace'} # type: ignore + @distributed_trace def get_not_provided( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> str """Get String value when no string value is sent in response payload. @@ -699,17 +758,24 @@ def get_not_provided( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_not_provided_request( - template_url=self.get_not_provided.metadata["url"], + template_url=self.get_not_provided.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -717,18 +783,20 @@ def get_not_provided( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_not_provided.metadata = {"url": "/string/notProvided"} # type: ignore + get_not_provided.metadata = {'url': '/string/notProvided'} # type: ignore + @distributed_trace def get_base64_encoded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytearray """Get value that is base64 encoded. @@ -738,17 +806,24 @@ def get_base64_encoded( :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_encoded_request( - template_url=self.get_base64_encoded.metadata["url"], + template_url=self.get_base64_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -756,18 +831,20 @@ def get_base64_encoded( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bytearray", pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_encoded.metadata = {"url": "/string/base64Encoding"} # type: ignore + get_base64_encoded.metadata = {'url': '/string/base64Encoding'} # type: ignore + @distributed_trace def get_base64_url_encoded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bytes """Get value that is base64url encoded. @@ -777,17 +854,24 @@ def get_base64_url_encoded( :rtype: bytes :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytes] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bytes] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_base64_url_encoded_request( - template_url=self.get_base64_url_encoded.metadata["url"], + template_url=self.get_base64_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -795,14 +879,15 @@ def get_base64_url_encoded( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("base64", pipeline_response) + deserialized = self._deserialize('base64', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_base64_url_encoded.metadata = {"url": "/string/base64UrlEncoding"} # type: ignore + get_base64_url_encoded.metadata = {'url': '/string/base64UrlEncoding'} # type: ignore + @distributed_trace def put_base64_url_encoded( @@ -820,23 +905,29 @@ def put_base64_url_encoded( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(string_body, "base64") + _json = self._serialize.body(string_body, 'base64') request = build_put_base64_url_encoded_request( content_type=content_type, json=_json, - template_url=self.put_base64_url_encoded.metadata["url"], + template_url=self.put_base64_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -847,11 +938,13 @@ def put_base64_url_encoded( if cls: return cls(pipeline_response, None, {}) - put_base64_url_encoded.metadata = {"url": "/string/base64UrlEncoding"} # type: ignore + put_base64_url_encoded.metadata = {'url': '/string/base64UrlEncoding'} # type: ignore + @distributed_trace def get_null_base64_url_encoded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[bytes] """Get null value that is expected to be base64url encoded. @@ -861,17 +954,24 @@ def get_null_base64_url_encoded( :rtype: bytes or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_null_base64_url_encoded_request( - template_url=self.get_null_base64_url_encoded.metadata["url"], + template_url=self.get_null_base64_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -879,11 +979,12 @@ def get_null_base64_url_encoded( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("base64", pipeline_response) + deserialized = self._deserialize('base64', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_null_base64_url_encoded.metadata = {"url": "/string/nullBase64UrlEncoding"} # type: ignore + get_null_base64_url_encoded.metadata = {'url': '/string/nullBase64UrlEncoding'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py index f9bbe0b13fa..ae0d28c8999 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/__init__.py index 56812fdf84f..53543c20c80 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestTimeTestService"] +__all__ = ['AutoRestTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py index 45b7958c9bf..08bdf2b6ed4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestTimeTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.time = TimeOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_configuration.py index afe602fc9d6..4845e185ac8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestTimeTestServiceConfiguration(Configuration): +class AutoRestTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestTimeTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestTimeTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresttimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresttimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/__init__.py index fc22a80891c..2bd831529fc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_time_test_service import AutoRestTimeTestService - -__all__ = ["AutoRestTimeTestService"] +__all__ = ['AutoRestTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py index d73a6264b05..00cd3b9333f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestTimeTestServiceConfiguration from .operations import TimeOperations - class AutoRestTimeTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestTimeTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.time = TimeOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_configuration.py index b77c2f46895..16d51d576b8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestTimeTestServiceConfiguration(Configuration): +class AutoRestTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresttimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresttimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/__init__.py index 8d397b58e26..07965659acf 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._time_operations import TimeOperations __all__ = [ - "TimeOperations", + 'TimeOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py index 3c0505fc4c1..548f9b4dc59 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -25,11 +18,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._time_operations import build_get_request, build_put_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class TimeOperations: """TimeOperations async operations. @@ -53,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get(self, **kwargs: Any) -> datetime.time: + async def get( + self, + **kwargs: Any + ) -> datetime.time: """Get time value "11:34:56". :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,17 +55,24 @@ async def get(self, **kwargs: Any) -> datetime.time: :rtype: ~datetime.time :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.time] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.time] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -79,17 +80,22 @@ async def get(self, **kwargs: Any) -> datetime.time: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("time", pipeline_response) + deserialized = self._deserialize('time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/time/get"} # type: ignore + get.metadata = {'url': '/time/get'} # type: ignore + @distributed_trace_async - async def put(self, time_body: datetime.time, **kwargs: Any) -> str: + async def put( + self, + time_body: datetime.time, + **kwargs: Any + ) -> str: """Put time value "08:07:56". :param time_body: Put time value "08:07:56" in parameter to pass testserver. @@ -99,23 +105,29 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(time_body, "time") + _json = self._serialize.body(time_body, 'time') request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -123,11 +135,12 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {"url": "/time/put"} # type: ignore + put.metadata = {'url': '/time/put'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/__init__.py index 8d397b58e26..07965659acf 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/__init__.py @@ -9,5 +9,5 @@ from ._time_operations import TimeOperations __all__ = [ - "TimeOperations", + 'TimeOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py index 4011d6cc00e..59ec05202bb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -105,7 +97,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> datetime.time """Get time value "11:34:56". @@ -115,17 +108,24 @@ def get( :rtype: ~datetime.time :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.time] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[datetime.time] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,14 +133,15 @@ def get( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("time", pipeline_response) + deserialized = self._deserialize('time', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/time/get"} # type: ignore + get.metadata = {'url': '/time/get'} # type: ignore + @distributed_trace def put( @@ -158,23 +159,29 @@ def put( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(time_body, "time") + _json = self._serialize.body(time_body, 'time') request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -182,11 +189,12 @@ def put( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {"url": "/time/put"} # type: ignore + put.metadata = {'url': '/time/put'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py index 4c61b19cc21..83bbaeff6d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/__init__.py index 6010eb2ed79..1fbf0c53df8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerConstantService"] +__all__ = ['AutoRestSwaggerConstantService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py index 899e9f7c8d6..73a2c86f834 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerConstantService(object): """Test Infrastructure for AutoRest Swagger Constant. @@ -59,6 +58,7 @@ def __init__( self._serialize.client_side_validation = False self.contants = ContantsOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_configuration.py index 2c1083cce5b..82c1acef244 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_configuration.py @@ -18,45 +18,54 @@ from typing import Any -class AutoRestSwaggerConstantServiceConfiguration(Configuration): +class AutoRestSwaggerConstantServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerConstantService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword header_constant: Constant header property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is True. Note that overriding this default value may result in unsupported behavior. + :keyword header_constant: Constant header property on the client that is a required parameter + for operation 'constants_putClientConstants'. The default value is True. Note that overriding + this default value may result in unsupported behavior. :paramtype header_constant: bool - :keyword query_constant: Constant query property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is 100. Note that overriding this default value may result in unsupported behavior. + :keyword query_constant: Constant query property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is 100. Note that overriding this + default value may result in unsupported behavior. :paramtype query_constant: int - :keyword path_constant: Constant path property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is "path". Note that overriding this default value may result in unsupported behavior. + :keyword path_constant: Constant path property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is "path". Note that overriding + this default value may result in unsupported behavior. :paramtype path_constant: str """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerConstantServiceConfiguration, self).__init__(**kwargs) - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str + self.header_constant = header_constant self.query_constant = query_constant self.path_constant = path_constant - kwargs.setdefault("sdk_moniker", "autorestswaggerconstantservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerconstantservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/__init__.py index 84d9e53e91d..06b58b00b84 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_constant_service import AutoRestSwaggerConstantService - -__all__ = ["AutoRestSwaggerConstantService"] +__all__ = ['AutoRestSwaggerConstantService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py index bd83a105609..9eaa600de13 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerConstantServiceConfiguration from .operations import ContantsOperations - class AutoRestSwaggerConstantService: """Test Infrastructure for AutoRest Swagger Constant. @@ -39,7 +38,11 @@ class AutoRestSwaggerConstantService: :paramtype path_constant: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerConstantServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -49,7 +52,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.contants = ContantsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_configuration.py index 0f10bc85b73..7b9bc4f8ac9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_configuration.py @@ -14,39 +14,52 @@ from .._version import VERSION -class AutoRestSwaggerConstantServiceConfiguration(Configuration): +class AutoRestSwaggerConstantServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerConstantService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword header_constant: Constant header property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is True. Note that overriding this default value may result in unsupported behavior. + :keyword header_constant: Constant header property on the client that is a required parameter + for operation 'constants_putClientConstants'. The default value is True. Note that overriding + this default value may result in unsupported behavior. :paramtype header_constant: bool - :keyword query_constant: Constant query property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is 100. Note that overriding this default value may result in unsupported behavior. + :keyword query_constant: Constant query property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is 100. Note that overriding this + default value may result in unsupported behavior. :paramtype query_constant: int - :keyword path_constant: Constant path property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is "path". Note that overriding this default value may result in unsupported behavior. + :keyword path_constant: Constant path property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is "path". Note that overriding + this default value may result in unsupported behavior. :paramtype path_constant: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerConstantServiceConfiguration, self).__init__(**kwargs) - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str + self.header_constant = header_constant self.query_constant = query_constant self.path_constant = path_constant - kwargs.setdefault("sdk_moniker", "autorestswaggerconstantservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerconstantservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/__init__.py index ae549297dab..1ef6a2e07a5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._contants_operations import ContantsOperations __all__ = [ - "ContantsOperations", + 'ContantsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py index 38088f57e97..113b642770c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,30 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._contants_operations import ( - build_put_client_constants_request, - build_put_model_as_string_no_required_one_value_default_request, - build_put_model_as_string_no_required_one_value_no_default_request, - build_put_model_as_string_no_required_two_value_default_request, - build_put_model_as_string_no_required_two_value_no_default_request, - build_put_model_as_string_required_one_value_default_request, - build_put_model_as_string_required_one_value_no_default_request, - build_put_model_as_string_required_two_value_default_request, - build_put_model_as_string_required_two_value_no_default_request, - build_put_no_model_as_string_no_required_one_value_default_request, - build_put_no_model_as_string_no_required_one_value_no_default_request, - build_put_no_model_as_string_no_required_two_value_default_request, - build_put_no_model_as_string_no_required_two_value_no_default_request, - build_put_no_model_as_string_required_one_value_default_request, - build_put_no_model_as_string_required_one_value_no_default_request, - build_put_no_model_as_string_required_two_value_default_request, - build_put_no_model_as_string_required_two_value_no_default_request, -) - -T = TypeVar("T") +from ...operations._contants_operations import build_put_client_constants_request, build_put_model_as_string_no_required_one_value_default_request, build_put_model_as_string_no_required_one_value_no_default_request, build_put_model_as_string_no_required_two_value_default_request, build_put_model_as_string_no_required_two_value_no_default_request, build_put_model_as_string_required_one_value_default_request, build_put_model_as_string_required_one_value_no_default_request, build_put_model_as_string_required_two_value_default_request, build_put_model_as_string_required_two_value_no_default_request, build_put_no_model_as_string_no_required_one_value_default_request, build_put_no_model_as_string_no_required_one_value_no_default_request, build_put_no_model_as_string_no_required_two_value_default_request, build_put_no_model_as_string_no_required_two_value_no_default_request, build_put_no_model_as_string_required_one_value_default_request, build_put_no_model_as_string_required_one_value_no_default_request, build_put_no_model_as_string_required_two_value_default_request, build_put_no_model_as_string_required_two_value_no_default_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ContantsOperations: """ContantsOperations async operations. @@ -86,18 +59,25 @@ async def put_no_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_two_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_two_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -107,7 +87,8 @@ async def put_no_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_two_value_no_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredTwoValueNoDefault"} # type: ignore + put_no_model_as_string_no_required_two_value_no_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace_async async def put_no_model_as_string_no_required_two_value_default( @@ -126,18 +107,25 @@ async def put_no_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_two_value_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_two_value_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -147,11 +135,14 @@ async def put_no_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_two_value_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredTwoValueDefault"} # type: ignore + put_no_model_as_string_no_required_two_value_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredTwoValueDefault'} # type: ignore + @distributed_trace_async async def put_no_model_as_string_no_required_one_value_no_default( - self, input: Optional[str] = "value1", **kwargs: Any + self, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -164,18 +155,25 @@ async def put_no_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_one_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_one_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -185,11 +183,14 @@ async def put_no_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_one_value_no_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredOneValueNoDefault"} # type: ignore + put_no_model_as_string_no_required_one_value_no_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredOneValueNoDefault'} # type: ignore + @distributed_trace_async async def put_no_model_as_string_no_required_one_value_default( - self, input: Optional[str] = "value1", **kwargs: Any + self, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -202,18 +203,25 @@ async def put_no_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_one_value_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_one_value_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -223,11 +231,14 @@ async def put_no_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_one_value_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredOneValueDefault"} # type: ignore + put_no_model_as_string_no_required_one_value_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredOneValueDefault'} # type: ignore + @distributed_trace_async async def put_no_model_as_string_required_two_value_no_default( - self, input: Union[str, "_models.NoModelAsStringRequiredTwoValueNoDefaultOpEnum"], **kwargs: Any + self, + input: Union[str, "_models.NoModelAsStringRequiredTwoValueNoDefaultOpEnum"], + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -240,18 +251,25 @@ async def put_no_model_as_string_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_required_two_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_required_two_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -261,11 +279,14 @@ async def put_no_model_as_string_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_two_value_no_default.metadata = {"url": "/constants/putNoModelAsStringRequiredTwoValueNoDefault"} # type: ignore + put_no_model_as_string_required_two_value_no_default.metadata = {'url': '/constants/putNoModelAsStringRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace_async async def put_no_model_as_string_required_two_value_default( - self, input: Union[str, "_models.NoModelAsStringRequiredTwoValueDefaultOpEnum"] = "value1", **kwargs: Any + self, + input: Union[str, "_models.NoModelAsStringRequiredTwoValueDefaultOpEnum"] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -278,18 +299,25 @@ async def put_no_model_as_string_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_required_two_value_default_request( input=input, - template_url=self.put_no_model_as_string_required_two_value_default.metadata["url"], + template_url=self.put_no_model_as_string_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -299,10 +327,14 @@ async def put_no_model_as_string_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_two_value_default.metadata = {"url": "/constants/putNoModelAsStringRequiredTwoValueDefault"} # type: ignore + put_no_model_as_string_required_two_value_default.metadata = {'url': '/constants/putNoModelAsStringRequiredTwoValueDefault'} # type: ignore + @distributed_trace_async - async def put_no_model_as_string_required_one_value_no_default(self, **kwargs: Any) -> None: + async def put_no_model_as_string_required_one_value_no_default( + self, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -315,20 +347,27 @@ async def put_no_model_as_string_required_one_value_no_default(self, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_put_no_model_as_string_required_one_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_required_one_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -338,10 +377,14 @@ async def put_no_model_as_string_required_one_value_no_default(self, **kwargs: A if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_one_value_no_default.metadata = {"url": "/constants/putNoModelAsStringRequiredOneValueNoDefault"} # type: ignore + put_no_model_as_string_required_one_value_no_default.metadata = {'url': '/constants/putNoModelAsStringRequiredOneValueNoDefault'} # type: ignore + @distributed_trace_async - async def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) -> None: + async def put_no_model_as_string_required_one_value_default( + self, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -354,20 +397,27 @@ async def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_put_no_model_as_string_required_one_value_default_request( input=input, - template_url=self.put_no_model_as_string_required_one_value_default.metadata["url"], + template_url=self.put_no_model_as_string_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -377,7 +427,8 @@ async def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_one_value_default.metadata = {"url": "/constants/putNoModelAsStringRequiredOneValueDefault"} # type: ignore + put_no_model_as_string_required_one_value_default.metadata = {'url': '/constants/putNoModelAsStringRequiredOneValueDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_no_required_two_value_no_default( @@ -396,18 +447,25 @@ async def put_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_two_value_no_default_request( input=input, - template_url=self.put_model_as_string_no_required_two_value_no_default.metadata["url"], + template_url=self.put_model_as_string_no_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -417,7 +475,8 @@ async def put_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_two_value_no_default.metadata = {"url": "/constants/putModelAsStringNoRequiredTwoValueNoDefault"} # type: ignore + put_model_as_string_no_required_two_value_no_default.metadata = {'url': '/constants/putModelAsStringNoRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_no_required_two_value_default( @@ -436,18 +495,25 @@ async def put_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_two_value_default_request( input=input, - template_url=self.put_model_as_string_no_required_two_value_default.metadata["url"], + template_url=self.put_model_as_string_no_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -457,7 +523,8 @@ async def put_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_two_value_default.metadata = {"url": "/constants/putModelAsStringNoRequiredTwoValueDefault"} # type: ignore + put_model_as_string_no_required_two_value_default.metadata = {'url': '/constants/putModelAsStringNoRequiredTwoValueDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_no_required_one_value_no_default( @@ -476,18 +543,25 @@ async def put_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_one_value_no_default_request( input=input, - template_url=self.put_model_as_string_no_required_one_value_no_default.metadata["url"], + template_url=self.put_model_as_string_no_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -497,7 +571,8 @@ async def put_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_one_value_no_default.metadata = {"url": "/constants/putModelAsStringNoRequiredOneValueNoDefault"} # type: ignore + put_model_as_string_no_required_one_value_no_default.metadata = {'url': '/constants/putModelAsStringNoRequiredOneValueNoDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_no_required_one_value_default( @@ -516,18 +591,25 @@ async def put_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_one_value_default_request( input=input, - template_url=self.put_model_as_string_no_required_one_value_default.metadata["url"], + template_url=self.put_model_as_string_no_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -537,11 +619,14 @@ async def put_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_one_value_default.metadata = {"url": "/constants/putModelAsStringNoRequiredOneValueDefault"} # type: ignore + put_model_as_string_no_required_one_value_default.metadata = {'url': '/constants/putModelAsStringNoRequiredOneValueDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_required_two_value_no_default( - self, input: Union[str, "_models.ModelAsStringRequiredTwoValueNoDefaultOpEnum"], **kwargs: Any + self, + input: Union[str, "_models.ModelAsStringRequiredTwoValueNoDefaultOpEnum"], + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -554,18 +639,25 @@ async def put_model_as_string_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_two_value_no_default_request( input=input, - template_url=self.put_model_as_string_required_two_value_no_default.metadata["url"], + template_url=self.put_model_as_string_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -575,11 +667,14 @@ async def put_model_as_string_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_two_value_no_default.metadata = {"url": "/constants/putModelAsStringRequiredTwoValueNoDefault"} # type: ignore + put_model_as_string_required_two_value_no_default.metadata = {'url': '/constants/putModelAsStringRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_required_two_value_default( - self, input: Union[str, "_models.ModelAsStringRequiredTwoValueDefaultOpEnum"] = "value1", **kwargs: Any + self, + input: Union[str, "_models.ModelAsStringRequiredTwoValueDefaultOpEnum"] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -592,18 +687,25 @@ async def put_model_as_string_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_two_value_default_request( input=input, - template_url=self.put_model_as_string_required_two_value_default.metadata["url"], + template_url=self.put_model_as_string_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -613,11 +715,14 @@ async def put_model_as_string_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_two_value_default.metadata = {"url": "/constants/putModelAsStringRequiredTwoValueDefault"} # type: ignore + put_model_as_string_required_two_value_default.metadata = {'url': '/constants/putModelAsStringRequiredTwoValueDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_required_one_value_no_default( - self, input: Union[str, "_models.ModelAsStringRequiredOneValueNoDefaultOpEnum"], **kwargs: Any + self, + input: Union[str, "_models.ModelAsStringRequiredOneValueNoDefaultOpEnum"], + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -630,18 +735,25 @@ async def put_model_as_string_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_one_value_no_default_request( input=input, - template_url=self.put_model_as_string_required_one_value_no_default.metadata["url"], + template_url=self.put_model_as_string_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -651,11 +763,14 @@ async def put_model_as_string_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_one_value_no_default.metadata = {"url": "/constants/putModelAsStringRequiredOneValueNoDefault"} # type: ignore + put_model_as_string_required_one_value_no_default.metadata = {'url': '/constants/putModelAsStringRequiredOneValueNoDefault'} # type: ignore + @distributed_trace_async async def put_model_as_string_required_one_value_default( - self, input: Union[str, "_models.ModelAsStringRequiredOneValueDefaultOpEnum"] = "value1", **kwargs: Any + self, + input: Union[str, "_models.ModelAsStringRequiredOneValueDefaultOpEnum"] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -668,18 +783,25 @@ async def put_model_as_string_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_one_value_default_request( input=input, - template_url=self.put_model_as_string_required_one_value_default.metadata["url"], + template_url=self.put_model_as_string_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -689,10 +811,14 @@ async def put_model_as_string_required_one_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_one_value_default.metadata = {"url": "/constants/putModelAsStringRequiredOneValueDefault"} # type: ignore + put_model_as_string_required_one_value_default.metadata = {'url': '/constants/putModelAsStringRequiredOneValueDefault'} # type: ignore + @distributed_trace_async - async def put_client_constants(self, **kwargs: Any) -> None: + async def put_client_constants( + self, + **kwargs: Any + ) -> None: """Pass constants from the client to this function. Will pass in constant path, query, and header parameters. @@ -701,20 +827,27 @@ async def put_client_constants(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_client_constants_request( header_constant=self._config.header_constant, query_constant=self._config.query_constant, path_constant=self._config.path_constant, - template_url=self.put_client_constants.metadata["url"], + template_url=self.put_client_constants.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -724,4 +857,5 @@ async def put_client_constants(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_client_constants.metadata = {"url": "/constants/clientConstants/{path-constant}"} # type: ignore + put_client_constants.metadata = {'url': '/constants/clientConstants/{path-constant}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py index 2cf789fb0d0..2120c341ca9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py @@ -69,44 +69,44 @@ ) __all__ = [ - "ModelAsStringNoRequiredOneValueDefault", - "ModelAsStringNoRequiredOneValueNoDefault", - "ModelAsStringNoRequiredTwoValueDefault", - "ModelAsStringNoRequiredTwoValueNoDefault", - "ModelAsStringRequiredOneValueDefault", - "ModelAsStringRequiredOneValueNoDefault", - "ModelAsStringRequiredTwoValueDefault", - "ModelAsStringRequiredTwoValueNoDefault", - "NoModelAsStringNoRequiredOneValueDefault", - "NoModelAsStringNoRequiredOneValueNoDefault", - "NoModelAsStringNoRequiredTwoValueDefault", - "NoModelAsStringNoRequiredTwoValueNoDefault", - "NoModelAsStringRequiredOneValueDefault", - "NoModelAsStringRequiredOneValueNoDefault", - "NoModelAsStringRequiredTwoValueDefault", - "NoModelAsStringRequiredTwoValueNoDefault", - "ModelAsStringNoRequiredOneValueDefaultEnum", - "ModelAsStringNoRequiredOneValueDefaultOpEnum", - "ModelAsStringNoRequiredOneValueNoDefaultEnum", - "ModelAsStringNoRequiredOneValueNoDefaultOpEnum", - "ModelAsStringNoRequiredTwoValueDefaultEnum", - "ModelAsStringNoRequiredTwoValueDefaultOpEnum", - "ModelAsStringNoRequiredTwoValueNoDefaultEnum", - "ModelAsStringNoRequiredTwoValueNoDefaultOpEnum", - "ModelAsStringRequiredOneValueDefaultEnum", - "ModelAsStringRequiredOneValueDefaultOpEnum", - "ModelAsStringRequiredOneValueNoDefaultEnum", - "ModelAsStringRequiredOneValueNoDefaultOpEnum", - "ModelAsStringRequiredTwoValueDefaultEnum", - "ModelAsStringRequiredTwoValueDefaultOpEnum", - "ModelAsStringRequiredTwoValueNoDefaultEnum", - "ModelAsStringRequiredTwoValueNoDefaultOpEnum", - "NoModelAsStringNoRequiredTwoValueDefaultEnum", - "NoModelAsStringNoRequiredTwoValueDefaultOpEnum", - "NoModelAsStringNoRequiredTwoValueNoDefaultEnum", - "NoModelAsStringNoRequiredTwoValueNoDefaultOpEnum", - "NoModelAsStringRequiredTwoValueDefaultEnum", - "NoModelAsStringRequiredTwoValueDefaultOpEnum", - "NoModelAsStringRequiredTwoValueNoDefaultEnum", - "NoModelAsStringRequiredTwoValueNoDefaultOpEnum", + 'ModelAsStringNoRequiredOneValueDefault', + 'ModelAsStringNoRequiredOneValueNoDefault', + 'ModelAsStringNoRequiredTwoValueDefault', + 'ModelAsStringNoRequiredTwoValueNoDefault', + 'ModelAsStringRequiredOneValueDefault', + 'ModelAsStringRequiredOneValueNoDefault', + 'ModelAsStringRequiredTwoValueDefault', + 'ModelAsStringRequiredTwoValueNoDefault', + 'NoModelAsStringNoRequiredOneValueDefault', + 'NoModelAsStringNoRequiredOneValueNoDefault', + 'NoModelAsStringNoRequiredTwoValueDefault', + 'NoModelAsStringNoRequiredTwoValueNoDefault', + 'NoModelAsStringRequiredOneValueDefault', + 'NoModelAsStringRequiredOneValueNoDefault', + 'NoModelAsStringRequiredTwoValueDefault', + 'NoModelAsStringRequiredTwoValueNoDefault', + 'ModelAsStringNoRequiredOneValueDefaultEnum', + 'ModelAsStringNoRequiredOneValueDefaultOpEnum', + 'ModelAsStringNoRequiredOneValueNoDefaultEnum', + 'ModelAsStringNoRequiredOneValueNoDefaultOpEnum', + 'ModelAsStringNoRequiredTwoValueDefaultEnum', + 'ModelAsStringNoRequiredTwoValueDefaultOpEnum', + 'ModelAsStringNoRequiredTwoValueNoDefaultEnum', + 'ModelAsStringNoRequiredTwoValueNoDefaultOpEnum', + 'ModelAsStringRequiredOneValueDefaultEnum', + 'ModelAsStringRequiredOneValueDefaultOpEnum', + 'ModelAsStringRequiredOneValueNoDefaultEnum', + 'ModelAsStringRequiredOneValueNoDefaultOpEnum', + 'ModelAsStringRequiredTwoValueDefaultEnum', + 'ModelAsStringRequiredTwoValueDefaultOpEnum', + 'ModelAsStringRequiredTwoValueNoDefaultEnum', + 'ModelAsStringRequiredTwoValueNoDefaultOpEnum', + 'NoModelAsStringNoRequiredTwoValueDefaultEnum', + 'NoModelAsStringNoRequiredTwoValueDefaultOpEnum', + 'NoModelAsStringNoRequiredTwoValueNoDefaultEnum', + 'NoModelAsStringNoRequiredTwoValueNoDefaultOpEnum', + 'NoModelAsStringRequiredTwoValueDefaultEnum', + 'NoModelAsStringRequiredTwoValueDefaultOpEnum', + 'NoModelAsStringRequiredTwoValueNoDefaultEnum', + 'NoModelAsStringRequiredTwoValueNoDefaultOpEnum', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_auto_rest_swagger_constant_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_auto_rest_swagger_constant_service_enums.py index 51d90dc2630..141cb01fa78 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_auto_rest_swagger_constant_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_auto_rest_swagger_constant_service_enums.py @@ -15,132 +15,109 @@ class ModelAsStringNoRequiredOneValueDefaultEnum(with_metaclass(CaseInsensitiveE VALUE1 = "value1" - class ModelAsStringNoRequiredOneValueDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" - class ModelAsStringNoRequiredOneValueNoDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" - class ModelAsStringNoRequiredOneValueNoDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" - class ModelAsStringNoRequiredTwoValueDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class ModelAsStringNoRequiredTwoValueDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class ModelAsStringNoRequiredTwoValueNoDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class ModelAsStringNoRequiredTwoValueNoDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class ModelAsStringRequiredOneValueDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" - class ModelAsStringRequiredOneValueDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" - class ModelAsStringRequiredOneValueNoDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" - class ModelAsStringRequiredOneValueNoDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" - class ModelAsStringRequiredTwoValueDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class ModelAsStringRequiredTwoValueDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class ModelAsStringRequiredTwoValueNoDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class ModelAsStringRequiredTwoValueNoDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringNoRequiredTwoValueDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringNoRequiredTwoValueDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringNoRequiredTwoValueNoDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringNoRequiredTwoValueNoDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringRequiredTwoValueDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringRequiredTwoValueDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringRequiredTwoValueNoDefaultEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" VALUE2 = "value2" - class NoModelAsStringRequiredTwoValueNoDefaultOpEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VALUE1 = "value1" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models.py index 7f73ff02e96..5ff57f499b0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models.py @@ -17,16 +17,19 @@ class ModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Possible values include: "value1". :paramtype parameter: str or ~constants.models.ModelAsStringNoRequiredOneValueDefaultEnum """ super(ModelAsStringNoRequiredOneValueDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", "value1") + self.parameter = kwargs.get('parameter', "value1") class ModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): @@ -37,16 +40,19 @@ class ModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Possible values include: "value1". :paramtype parameter: str or ~constants.models.ModelAsStringNoRequiredOneValueNoDefaultEnum """ super(ModelAsStringNoRequiredOneValueNoDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", None) + self.parameter = kwargs.get('parameter', None) class ModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): @@ -57,16 +63,19 @@ class ModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.ModelAsStringNoRequiredTwoValueDefaultEnum """ super(ModelAsStringNoRequiredTwoValueDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", "value1") + self.parameter = kwargs.get('parameter', "value1") class ModelAsStringNoRequiredTwoValueNoDefault(msrest.serialization.Model): @@ -77,16 +86,19 @@ class ModelAsStringNoRequiredTwoValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.ModelAsStringNoRequiredTwoValueNoDefaultEnum """ super(ModelAsStringNoRequiredTwoValueNoDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", None) + self.parameter = kwargs.get('parameter', None) class ModelAsStringRequiredOneValueDefault(msrest.serialization.Model): @@ -99,20 +111,23 @@ class ModelAsStringRequiredOneValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredOneValueDefaultEnum """ super(ModelAsStringRequiredOneValueDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", "value1") + self.parameter = kwargs.get('parameter', "value1") class ModelAsStringRequiredOneValueNoDefault(msrest.serialization.Model): @@ -125,20 +140,23 @@ class ModelAsStringRequiredOneValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredOneValueNoDefaultEnum """ super(ModelAsStringRequiredOneValueNoDefault, self).__init__(**kwargs) - self.parameter = kwargs["parameter"] + self.parameter = kwargs['parameter'] class ModelAsStringRequiredTwoValueDefault(msrest.serialization.Model): @@ -151,20 +169,23 @@ class ModelAsStringRequiredTwoValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredTwoValueDefaultEnum """ super(ModelAsStringRequiredTwoValueDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", "value1") + self.parameter = kwargs.get('parameter', "value1") class ModelAsStringRequiredTwoValueNoDefault(msrest.serialization.Model): @@ -177,20 +198,23 @@ class ModelAsStringRequiredTwoValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredTwoValueNoDefaultEnum """ super(ModelAsStringRequiredTwoValueNoDefault, self).__init__(**kwargs) - self.parameter = kwargs["parameter"] + self.parameter = kwargs['parameter'] class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): @@ -202,17 +226,20 @@ class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: The only acceptable values to pass in are None and "value1". The default value is "value1". :paramtype parameter: str """ super(NoModelAsStringNoRequiredOneValueDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", "value1") + self.parameter = kwargs.get('parameter', "value1") class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): @@ -224,17 +251,20 @@ class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: The only acceptable values to pass in are None and "value1". The default value is None. :paramtype parameter: str """ super(NoModelAsStringNoRequiredOneValueNoDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", None) + self.parameter = kwargs.get('parameter', None) class NoModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): @@ -245,16 +275,19 @@ class NoModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.NoModelAsStringNoRequiredTwoValueDefaultEnum """ super(NoModelAsStringNoRequiredTwoValueDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", "value1") + self.parameter = kwargs.get('parameter', "value1") class NoModelAsStringNoRequiredTwoValueNoDefault(msrest.serialization.Model): @@ -265,16 +298,19 @@ class NoModelAsStringNoRequiredTwoValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.NoModelAsStringNoRequiredTwoValueNoDefaultEnum """ super(NoModelAsStringNoRequiredTwoValueNoDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", None) + self.parameter = kwargs.get('parameter', None) class NoModelAsStringRequiredOneValueDefault(msrest.serialization.Model): @@ -289,17 +325,21 @@ class NoModelAsStringRequiredOneValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True, "constant": True}, + 'parameter': {'required': True, 'constant': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } parameter = "value1" - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(NoModelAsStringRequiredOneValueDefault, self).__init__(**kwargs) @@ -315,17 +355,21 @@ class NoModelAsStringRequiredOneValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True, "constant": True}, + 'parameter': {'required': True, 'constant': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } parameter = "value1" - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(NoModelAsStringRequiredOneValueNoDefault, self).__init__(**kwargs) @@ -339,20 +383,23 @@ class NoModelAsStringRequiredTwoValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.NoModelAsStringRequiredTwoValueDefaultEnum """ super(NoModelAsStringRequiredTwoValueDefault, self).__init__(**kwargs) - self.parameter = kwargs.get("parameter", "value1") + self.parameter = kwargs.get('parameter', "value1") class NoModelAsStringRequiredTwoValueNoDefault(msrest.serialization.Model): @@ -365,17 +412,20 @@ class NoModelAsStringRequiredTwoValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.NoModelAsStringRequiredTwoValueNoDefaultEnum """ super(NoModelAsStringRequiredTwoValueNoDefault, self).__init__(**kwargs) - self.parameter = kwargs["parameter"] + self.parameter = kwargs['parameter'] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py index ca450e3dd93..a671a38f55c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_models_py3.py @@ -21,11 +21,14 @@ class ModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } def __init__( - self, *, parameter: Optional[Union[str, "ModelAsStringNoRequiredOneValueDefaultEnum"]] = "value1", **kwargs + self, + *, + parameter: Optional[Union[str, "ModelAsStringNoRequiredOneValueDefaultEnum"]] = "value1", + **kwargs ): """ :keyword parameter: Possible values include: "value1". @@ -43,11 +46,14 @@ class ModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } def __init__( - self, *, parameter: Optional[Union[str, "ModelAsStringNoRequiredOneValueNoDefaultEnum"]] = None, **kwargs + self, + *, + parameter: Optional[Union[str, "ModelAsStringNoRequiredOneValueNoDefaultEnum"]] = None, + **kwargs ): """ :keyword parameter: Possible values include: "value1". @@ -65,11 +71,14 @@ class ModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } def __init__( - self, *, parameter: Optional[Union[str, "ModelAsStringNoRequiredTwoValueDefaultEnum"]] = "value1", **kwargs + self, + *, + parameter: Optional[Union[str, "ModelAsStringNoRequiredTwoValueDefaultEnum"]] = "value1", + **kwargs ): """ :keyword parameter: Possible values include: "value1", "value2". @@ -87,11 +96,14 @@ class ModelAsStringNoRequiredTwoValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } def __init__( - self, *, parameter: Optional[Union[str, "ModelAsStringNoRequiredTwoValueNoDefaultEnum"]] = None, **kwargs + self, + *, + parameter: Optional[Union[str, "ModelAsStringNoRequiredTwoValueNoDefaultEnum"]] = None, + **kwargs ): """ :keyword parameter: Possible values include: "value1", "value2". @@ -111,14 +123,19 @@ class ModelAsStringRequiredOneValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Union[str, "ModelAsStringRequiredOneValueDefaultEnum"] = "value1", **kwargs): + def __init__( + self, + *, + parameter: Union[str, "ModelAsStringRequiredOneValueDefaultEnum"] = "value1", + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredOneValueDefaultEnum @@ -137,14 +154,19 @@ class ModelAsStringRequiredOneValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Union[str, "ModelAsStringRequiredOneValueNoDefaultEnum"], **kwargs): + def __init__( + self, + *, + parameter: Union[str, "ModelAsStringRequiredOneValueNoDefaultEnum"], + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredOneValueNoDefaultEnum @@ -163,14 +185,19 @@ class ModelAsStringRequiredTwoValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Union[str, "ModelAsStringRequiredTwoValueDefaultEnum"] = "value1", **kwargs): + def __init__( + self, + *, + parameter: Union[str, "ModelAsStringRequiredTwoValueDefaultEnum"] = "value1", + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredTwoValueDefaultEnum @@ -189,14 +216,19 @@ class ModelAsStringRequiredTwoValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Union[str, "ModelAsStringRequiredTwoValueNoDefaultEnum"], **kwargs): + def __init__( + self, + *, + parameter: Union[str, "ModelAsStringRequiredTwoValueNoDefaultEnum"], + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.ModelAsStringRequiredTwoValueNoDefaultEnum @@ -214,10 +246,15 @@ class NoModelAsStringNoRequiredOneValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Optional[str] = "value1", **kwargs): + def __init__( + self, + *, + parameter: Optional[str] = "value1", + **kwargs + ): """ :keyword parameter: The only acceptable values to pass in are None and "value1". The default value is "value1". @@ -236,10 +273,15 @@ class NoModelAsStringNoRequiredOneValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Optional[str] = None, **kwargs): + def __init__( + self, + *, + parameter: Optional[str] = None, + **kwargs + ): """ :keyword parameter: The only acceptable values to pass in are None and "value1". The default value is None. @@ -257,11 +299,14 @@ class NoModelAsStringNoRequiredTwoValueDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } def __init__( - self, *, parameter: Optional[Union[str, "NoModelAsStringNoRequiredTwoValueDefaultEnum"]] = "value1", **kwargs + self, + *, + parameter: Optional[Union[str, "NoModelAsStringNoRequiredTwoValueDefaultEnum"]] = "value1", + **kwargs ): """ :keyword parameter: Possible values include: "value1", "value2". @@ -279,11 +324,14 @@ class NoModelAsStringNoRequiredTwoValueNoDefault(msrest.serialization.Model): """ _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } def __init__( - self, *, parameter: Optional[Union[str, "NoModelAsStringNoRequiredTwoValueNoDefaultEnum"]] = None, **kwargs + self, + *, + parameter: Optional[Union[str, "NoModelAsStringNoRequiredTwoValueNoDefaultEnum"]] = None, + **kwargs ): """ :keyword parameter: Possible values include: "value1", "value2". @@ -305,17 +353,21 @@ class NoModelAsStringRequiredOneValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True, "constant": True}, + 'parameter': {'required': True, 'constant': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } parameter = "value1" - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(NoModelAsStringRequiredOneValueDefault, self).__init__(**kwargs) @@ -331,17 +383,21 @@ class NoModelAsStringRequiredOneValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True, "constant": True}, + 'parameter': {'required': True, 'constant': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } parameter = "value1" - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(NoModelAsStringRequiredOneValueNoDefault, self).__init__(**kwargs) @@ -355,14 +411,19 @@ class NoModelAsStringRequiredTwoValueDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Union[str, "NoModelAsStringRequiredTwoValueDefaultEnum"] = "value1", **kwargs): + def __init__( + self, + *, + parameter: Union[str, "NoModelAsStringRequiredTwoValueDefaultEnum"] = "value1", + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.NoModelAsStringRequiredTwoValueDefaultEnum @@ -381,14 +442,19 @@ class NoModelAsStringRequiredTwoValueNoDefault(msrest.serialization.Model): """ _validation = { - "parameter": {"required": True}, + 'parameter': {'required': True}, } _attribute_map = { - "parameter": {"key": "parameter", "type": "str"}, + 'parameter': {'key': 'parameter', 'type': 'str'}, } - def __init__(self, *, parameter: Union[str, "NoModelAsStringRequiredTwoValueNoDefaultEnum"], **kwargs): + def __init__( + self, + *, + parameter: Union[str, "NoModelAsStringRequiredTwoValueNoDefaultEnum"], + **kwargs + ): """ :keyword parameter: Required. Possible values include: "value1", "value2". :paramtype parameter: str or ~constants.models.NoModelAsStringRequiredTwoValueNoDefaultEnum diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/__init__.py index ae549297dab..1ef6a2e07a5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/__init__.py @@ -9,5 +9,5 @@ from ._contants_operations import ContantsOperations __all__ = [ - "ContantsOperations", + 'ContantsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py index 5d7585dd4b7..c3118a7b32e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -453,18 +445,25 @@ def put_no_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_two_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_two_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -474,7 +473,8 @@ def put_no_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_two_value_no_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredTwoValueNoDefault"} # type: ignore + put_no_model_as_string_no_required_two_value_no_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace def put_no_model_as_string_no_required_two_value_default( @@ -494,18 +494,25 @@ def put_no_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_two_value_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_two_value_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -515,7 +522,8 @@ def put_no_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_two_value_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredTwoValueDefault"} # type: ignore + put_no_model_as_string_no_required_two_value_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredTwoValueDefault'} # type: ignore + @distributed_trace def put_no_model_as_string_no_required_one_value_no_default( @@ -535,18 +543,25 @@ def put_no_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_one_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_one_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -556,7 +571,8 @@ def put_no_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_one_value_no_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredOneValueNoDefault"} # type: ignore + put_no_model_as_string_no_required_one_value_no_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredOneValueNoDefault'} # type: ignore + @distributed_trace def put_no_model_as_string_no_required_one_value_default( @@ -576,18 +592,25 @@ def put_no_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_no_required_one_value_default_request( input=input, - template_url=self.put_no_model_as_string_no_required_one_value_default.metadata["url"], + template_url=self.put_no_model_as_string_no_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -597,7 +620,8 @@ def put_no_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_no_required_one_value_default.metadata = {"url": "/constants/putNoModelAsStringNoRequiredOneValueDefault"} # type: ignore + put_no_model_as_string_no_required_one_value_default.metadata = {'url': '/constants/putNoModelAsStringNoRequiredOneValueDefault'} # type: ignore + @distributed_trace def put_no_model_as_string_required_two_value_no_default( @@ -617,18 +641,25 @@ def put_no_model_as_string_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_required_two_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_required_two_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -638,7 +669,8 @@ def put_no_model_as_string_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_two_value_no_default.metadata = {"url": "/constants/putNoModelAsStringRequiredTwoValueNoDefault"} # type: ignore + put_no_model_as_string_required_two_value_no_default.metadata = {'url': '/constants/putNoModelAsStringRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace def put_no_model_as_string_required_two_value_default( @@ -658,18 +690,25 @@ def put_no_model_as_string_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_no_model_as_string_required_two_value_default_request( input=input, - template_url=self.put_no_model_as_string_required_two_value_default.metadata["url"], + template_url=self.put_no_model_as_string_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -679,11 +718,13 @@ def put_no_model_as_string_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_two_value_default.metadata = {"url": "/constants/putNoModelAsStringRequiredTwoValueDefault"} # type: ignore + put_no_model_as_string_required_two_value_default.metadata = {'url': '/constants/putNoModelAsStringRequiredTwoValueDefault'} # type: ignore + @distributed_trace def put_no_model_as_string_required_one_value_no_default( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Puts constants to the testserver. @@ -698,20 +739,27 @@ def put_no_model_as_string_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_put_no_model_as_string_required_one_value_no_default_request( input=input, - template_url=self.put_no_model_as_string_required_one_value_no_default.metadata["url"], + template_url=self.put_no_model_as_string_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -721,11 +769,13 @@ def put_no_model_as_string_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_one_value_no_default.metadata = {"url": "/constants/putNoModelAsStringRequiredOneValueNoDefault"} # type: ignore + put_no_model_as_string_required_one_value_no_default.metadata = {'url': '/constants/putNoModelAsStringRequiredOneValueNoDefault'} # type: ignore + @distributed_trace def put_no_model_as_string_required_one_value_default( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Puts constants to the testserver. @@ -740,20 +790,27 @@ def put_no_model_as_string_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_put_no_model_as_string_required_one_value_default_request( input=input, - template_url=self.put_no_model_as_string_required_one_value_default.metadata["url"], + template_url=self.put_no_model_as_string_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -763,7 +820,8 @@ def put_no_model_as_string_required_one_value_default( if cls: return cls(pipeline_response, None, {}) - put_no_model_as_string_required_one_value_default.metadata = {"url": "/constants/putNoModelAsStringRequiredOneValueDefault"} # type: ignore + put_no_model_as_string_required_one_value_default.metadata = {'url': '/constants/putNoModelAsStringRequiredOneValueDefault'} # type: ignore + @distributed_trace def put_model_as_string_no_required_two_value_no_default( @@ -783,18 +841,25 @@ def put_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_two_value_no_default_request( input=input, - template_url=self.put_model_as_string_no_required_two_value_no_default.metadata["url"], + template_url=self.put_model_as_string_no_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -804,7 +869,8 @@ def put_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_two_value_no_default.metadata = {"url": "/constants/putModelAsStringNoRequiredTwoValueNoDefault"} # type: ignore + put_model_as_string_no_required_two_value_no_default.metadata = {'url': '/constants/putModelAsStringNoRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace def put_model_as_string_no_required_two_value_default( @@ -824,18 +890,25 @@ def put_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_two_value_default_request( input=input, - template_url=self.put_model_as_string_no_required_two_value_default.metadata["url"], + template_url=self.put_model_as_string_no_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -845,7 +918,8 @@ def put_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_two_value_default.metadata = {"url": "/constants/putModelAsStringNoRequiredTwoValueDefault"} # type: ignore + put_model_as_string_no_required_two_value_default.metadata = {'url': '/constants/putModelAsStringNoRequiredTwoValueDefault'} # type: ignore + @distributed_trace def put_model_as_string_no_required_one_value_no_default( @@ -865,18 +939,25 @@ def put_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_one_value_no_default_request( input=input, - template_url=self.put_model_as_string_no_required_one_value_no_default.metadata["url"], + template_url=self.put_model_as_string_no_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -886,7 +967,8 @@ def put_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_one_value_no_default.metadata = {"url": "/constants/putModelAsStringNoRequiredOneValueNoDefault"} # type: ignore + put_model_as_string_no_required_one_value_no_default.metadata = {'url': '/constants/putModelAsStringNoRequiredOneValueNoDefault'} # type: ignore + @distributed_trace def put_model_as_string_no_required_one_value_default( @@ -906,18 +988,25 @@ def put_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_no_required_one_value_default_request( input=input, - template_url=self.put_model_as_string_no_required_one_value_default.metadata["url"], + template_url=self.put_model_as_string_no_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -927,7 +1016,8 @@ def put_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_no_required_one_value_default.metadata = {"url": "/constants/putModelAsStringNoRequiredOneValueDefault"} # type: ignore + put_model_as_string_no_required_one_value_default.metadata = {'url': '/constants/putModelAsStringNoRequiredOneValueDefault'} # type: ignore + @distributed_trace def put_model_as_string_required_two_value_no_default( @@ -947,18 +1037,25 @@ def put_model_as_string_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_two_value_no_default_request( input=input, - template_url=self.put_model_as_string_required_two_value_no_default.metadata["url"], + template_url=self.put_model_as_string_required_two_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -968,7 +1065,8 @@ def put_model_as_string_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_two_value_no_default.metadata = {"url": "/constants/putModelAsStringRequiredTwoValueNoDefault"} # type: ignore + put_model_as_string_required_two_value_no_default.metadata = {'url': '/constants/putModelAsStringRequiredTwoValueNoDefault'} # type: ignore + @distributed_trace def put_model_as_string_required_two_value_default( @@ -988,18 +1086,25 @@ def put_model_as_string_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_two_value_default_request( input=input, - template_url=self.put_model_as_string_required_two_value_default.metadata["url"], + template_url=self.put_model_as_string_required_two_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1009,7 +1114,8 @@ def put_model_as_string_required_two_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_two_value_default.metadata = {"url": "/constants/putModelAsStringRequiredTwoValueDefault"} # type: ignore + put_model_as_string_required_two_value_default.metadata = {'url': '/constants/putModelAsStringRequiredTwoValueDefault'} # type: ignore + @distributed_trace def put_model_as_string_required_one_value_no_default( @@ -1029,18 +1135,25 @@ def put_model_as_string_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_one_value_no_default_request( input=input, - template_url=self.put_model_as_string_required_one_value_no_default.metadata["url"], + template_url=self.put_model_as_string_required_one_value_no_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1050,7 +1163,8 @@ def put_model_as_string_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_one_value_no_default.metadata = {"url": "/constants/putModelAsStringRequiredOneValueNoDefault"} # type: ignore + put_model_as_string_required_one_value_no_default.metadata = {'url': '/constants/putModelAsStringRequiredOneValueNoDefault'} # type: ignore + @distributed_trace def put_model_as_string_required_one_value_default( @@ -1070,18 +1184,25 @@ def put_model_as_string_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_model_as_string_required_one_value_default_request( input=input, - template_url=self.put_model_as_string_required_one_value_default.metadata["url"], + template_url=self.put_model_as_string_required_one_value_default.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1091,11 +1212,13 @@ def put_model_as_string_required_one_value_default( if cls: return cls(pipeline_response, None, {}) - put_model_as_string_required_one_value_default.metadata = {"url": "/constants/putModelAsStringRequiredOneValueDefault"} # type: ignore + put_model_as_string_required_one_value_default.metadata = {'url': '/constants/putModelAsStringRequiredOneValueDefault'} # type: ignore + @distributed_trace def put_client_constants( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Pass constants from the client to this function. Will pass in constant path, query, and header @@ -1106,20 +1229,27 @@ def put_client_constants( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_client_constants_request( header_constant=self._config.header_constant, query_constant=self._config.query_constant, path_constant=self._config.path_constant, - template_url=self.put_client_constants.metadata["url"], + template_url=self.put_client_constants.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1129,4 +1259,5 @@ def put_client_constants( if cls: return cls(pipeline_response, None, {}) - put_client_constants.metadata = {"url": "/constants/clientConstants/{path-constant}"} # type: ignore + put_client_constants.metadata = {'url': '/constants/clientConstants/{path-constant}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py index 56088d4f1fe..5bad33ccda0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger Constant. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py index bcd7bcd9fec..6ef996852a7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py index 55f40f4a580..d54ee24b218 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py @@ -22,7 +22,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class AutoRestParameterizedHostTestClient(object): """Test Infrastructure for AutoRest. @@ -38,7 +37,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - _base_url = "http://{accountName}{host}" + _base_url = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -47,6 +46,7 @@ def __init__( self._deserialize = Deserializer(client_models) self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest @@ -72,7 +72,7 @@ def _send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py index 164a6df014a..fd19d981016 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -39,19 +39,20 @@ def __init__( raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py index 0fe5782d645..3b422c27c1d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient - -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py index ef6c57e3ffc..6b67d681d6c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py @@ -17,7 +17,6 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -27,8 +26,12 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _base_url = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _base_url = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer(client_models) self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -57,7 +65,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py index cf7cbb01aaf..789b6e8a4d7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py index a7ad56ef36b..2f0d3b169c3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._paths_operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py index 14c724b05ec..b82aaf5c107 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._paths_operations import build_get_empty_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathsOperations: """PathsOperations async operations. @@ -52,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_empty(self, account_name: str, **kwargs: Any) -> None: + async def get_empty( + self, + account_name: str, + **kwargs: Any + ) -> None: """Get a 200 to test a valid base uri. :param account_name: Account Name. @@ -62,21 +57,28 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -87,4 +89,5 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_empty.metadata = {"url": "/customuri"} # type: ignore + get_empty.metadata = {'url': '/customuri'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py index a7ad56ef36b..2f0d3b169c3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/__init__.py @@ -9,5 +9,5 @@ from ._paths_operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py index 05f2bebe9bf..7e3ea2bf54f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -93,21 +85,28 @@ def get_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,4 +117,5 @@ def get_empty( if cls: return cls(pipeline_response, None, {}) - get_empty.metadata = {"url": "/customuri"} # type: ignore + get_empty.metadata = {'url': '/customuri'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index c250c733c08..63bc16d691a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/__init__.py index d7e63b40724..d8d75b9e768 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedCustomHostTestClient"] +__all__ = ['AutoRestParameterizedCustomHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py index 0f3adf798b8..e1bd1d233ac 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py @@ -22,7 +22,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class AutoRestParameterizedCustomHostTestClient(object): """Test Infrastructure for AutoRest. @@ -42,10 +41,8 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - _base_url = "{vault}{secret}{dnsSuffix}" - self._config = AutoRestParameterizedCustomHostTestClientConfiguration( - subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs - ) + _base_url = '{vault}{secret}{dnsSuffix}' + self._config = AutoRestParameterizedCustomHostTestClientConfiguration(subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -54,6 +51,7 @@ def __init__( self._serialize.client_side_validation = False self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest @@ -79,9 +77,7 @@ def _send_request( request_copy = deepcopy(request) path_format_arguments = { - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_configuration.py index 9d325677e59..630d8f6b6d9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): +class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedCustomHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): :param subscription_id: The subscription id with value 'test12'. :type subscription_id: str - :param dns_suffix: A string value that is used as a global part of the parameterized host. Default value 'host'. + :param dns_suffix: A string value that is used as a global part of the parameterized host. + Default value 'host'. :type dns_suffix: str """ @@ -45,19 +46,20 @@ def __init__( self.subscription_id = subscription_id self.dns_suffix = dns_suffix - kwargs.setdefault("sdk_moniker", "autorestparameterizedcustomhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedcustomhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/__init__.py index 2a17c79123c..d3a3857329b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_custom_host_test_client import AutoRestParameterizedCustomHostTestClient - -__all__ = ["AutoRestParameterizedCustomHostTestClient"] +__all__ = ['AutoRestParameterizedCustomHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py index d39e8b1b373..8b15e107018 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py @@ -17,7 +17,6 @@ from ._configuration import AutoRestParameterizedCustomHostTestClientConfiguration from .operations import PathsOperations - class AutoRestParameterizedCustomHostTestClient: """Test Infrastructure for AutoRest. @@ -30,11 +29,14 @@ class AutoRestParameterizedCustomHostTestClient: :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: - _base_url = "{vault}{secret}{dnsSuffix}" - self._config = AutoRestParameterizedCustomHostTestClientConfiguration( - subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs - ) + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: + _base_url = '{vault}{secret}{dnsSuffix}' + self._config = AutoRestParameterizedCustomHostTestClientConfiguration(subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -43,7 +45,12 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self._serialize.client_side_validation = False self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -63,9 +70,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) path_format_arguments = { - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_configuration.py index b99c9e62730..8e3df826b37 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): +class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedCustomHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -22,11 +22,17 @@ class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): :param subscription_id: The subscription id with value 'test12'. :type subscription_id: str - :param dns_suffix: A string value that is used as a global part of the parameterized host. Default value 'host'. + :param dns_suffix: A string value that is used as a global part of the parameterized host. + Default value 'host'. :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedCustomHostTestClientConfiguration, self).__init__(**kwargs) if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -35,16 +41,19 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self.subscription_id = subscription_id self.dns_suffix = dns_suffix - kwargs.setdefault("sdk_moniker", "autorestparameterizedcustomhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedcustomhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/__init__.py index a7ad56ef36b..2f0d3b169c3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._paths_operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py index 1f9e1739dcb..4ee945a6096 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._paths_operations import build_get_empty_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathsOperations: """PathsOperations async operations. @@ -53,7 +44,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: @distributed_trace_async async def get_empty( - self, vault: str, secret: str, key_name: str, key_version: Optional[str] = "v1", **kwargs: Any + self, + vault: str, + secret: str, + key_name: str, + key_version: Optional[str] = "v1", + **kwargs: Any ) -> None: """Get a 200 to test a valid base uri. @@ -70,27 +66,32 @@ async def get_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( key_name=key_name, subscription_id=self._config.subscription_id, key_version=key_version, - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "vault": self._serialize.url("vault", vault, "str", skip_quote=True), - "secret": self._serialize.url("secret", secret, "str", skip_quote=True), - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "vault": self._serialize.url("vault", vault, 'str', skip_quote=True), + "secret": self._serialize.url("secret", secret, 'str', skip_quote=True), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,4 +102,5 @@ async def get_empty( if cls: return cls(pipeline_response, None, {}) - get_empty.metadata = {"url": "/customuri/{subscriptionId}/{keyName}"} # type: ignore + get_empty.metadata = {'url': '/customuri/{subscriptionId}/{keyName}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/__init__.py index a7ad56ef36b..2f0d3b169c3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/__init__.py @@ -9,5 +9,5 @@ from ._paths_operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py index 8969ce50da1..7c2c5e479c5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -119,27 +111,32 @@ def get_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_request( key_name=key_name, subscription_id=self._config.subscription_id, key_version=key_version, - template_url=self.get_empty.metadata["url"], + template_url=self.get_empty.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "vault": self._serialize.url("vault", vault, "str", skip_quote=True), - "secret": self._serialize.url("secret", secret, "str", skip_quote=True), - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "vault": self._serialize.url("vault", vault, 'str', skip_quote=True), + "secret": self._serialize.url("secret", secret, 'str', skip_quote=True), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -150,4 +147,5 @@ def get_empty( if cls: return cls(pipeline_response, None, {}) - get_empty.metadata = {"url": "/customuri/{subscriptionId}/{keyName}"} # type: ignore + get_empty.metadata = {'url': '/customuri/{subscriptionId}/{keyName}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py index d2c84ca63b8..633bfcb7cf4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/__init__.py index e0c77f64b36..28acd6da58d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["PetStoreInc"] +__all__ = ['PetStoreInc'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_configuration.py index 32885416ee0..1c705815dcd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class PetStoreIncConfiguration(Configuration): +class PetStoreIncConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for PetStoreInc. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class PetStoreIncConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(PetStoreIncConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "petstoreinc/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'petstoreinc/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py index a81ac3fde50..5bf0046ca24 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class PetStoreInc(object): """PetStore. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/__init__.py index 98a70166f99..668e6ffc1a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._pet_store_inc import PetStoreInc - -__all__ = ["PetStoreInc"] +__all__ = ['PetStoreInc'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_configuration.py index f20dc3de00b..b49c97d8170 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class PetStoreIncConfiguration(Configuration): +class PetStoreIncConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for PetStoreInc. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(PetStoreIncConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "petstoreinc/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'petstoreinc/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py index 7b19bbd46d8..204f9b86090 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import PetStoreIncConfiguration from .operations import PetOperations - class PetStoreInc: """PetStore. @@ -27,7 +26,11 @@ class PetStoreInc: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = PetStoreIncConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/__init__.py index a072d24cd5c..5c1da84e7fb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._pet_operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py index ef42db8457a..94594e27c44 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._pet_operations import build_add_pet_request, build_get_by_pet_id_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PetOperations: """PetOperations async operations. @@ -52,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> "_models.Pet": + async def get_by_pet_id( + self, + pet_id: str, + **kwargs: Any + ) -> "_models.Pet": """get pet by id. :param pet_id: Pet id. @@ -62,35 +57,47 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> "_models.Pet": :rtype: ~extensibleenumsswagger.models.Pet :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Pet"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Pet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_by_pet_id_request( pet_id=pet_id, - template_url=self.get_by_pet_id.metadata["url"], + template_url=self.get_by_pet_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_by_pet_id.metadata = {"url": "/extensibleenums/pet/{petId}"} # type: ignore + get_by_pet_id.metadata = {'url': '/extensibleenums/pet/{petId}'} # type: ignore + @distributed_trace_async - async def add_pet(self, pet_param: Optional["_models.Pet"] = None, **kwargs: Any) -> "_models.Pet": + async def add_pet( + self, + pet_param: Optional["_models.Pet"] = None, + **kwargs: Any + ) -> "_models.Pet": """add pet. :param pet_param: pet param. @@ -100,37 +107,44 @@ async def add_pet(self, pet_param: Optional["_models.Pet"] = None, **kwargs: Any :rtype: ~extensibleenumsswagger.models.Pet :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Pet"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Pet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if pet_param is not None: - _json = self._serialize.body(pet_param, "Pet") + _json = self._serialize.body(pet_param, 'Pet') else: _json = None request = build_add_pet_request( content_type=content_type, json=_json, - template_url=self.add_pet.metadata["url"], + template_url=self.add_pet.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - add_pet.metadata = {"url": "/extensibleenums/pet/addPet"} # type: ignore + add_pet.metadata = {'url': '/extensibleenums/pet/addPet'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py index ba3595b7779..a365d52b8dc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py @@ -17,7 +17,7 @@ ) __all__ = [ - "Pet", - "DaysOfWeekExtensibleEnum", - "IntEnum", + 'Pet', + 'DaysOfWeekExtensibleEnum', + 'IntEnum', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models.py index d7ad82cbff7..ec53df9f59b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models.py @@ -24,16 +24,19 @@ class Pet(msrest.serialization.Model): """ _validation = { - "int_enum": {"required": True}, + 'int_enum': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "days_of_week": {"key": "DaysOfWeek", "type": "str"}, - "int_enum": {"key": "IntEnum", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'days_of_week': {'key': 'DaysOfWeek', 'type': 'str'}, + 'int_enum': {'key': 'IntEnum', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: name. :paramtype name: str @@ -44,6 +47,6 @@ def __init__(self, **kwargs): :paramtype int_enum: str or ~extensibleenumsswagger.models.IntEnum """ super(Pet, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.days_of_week = kwargs.get("days_of_week", "Friday") - self.int_enum = kwargs["int_enum"] + self.name = kwargs.get('name', None) + self.days_of_week = kwargs.get('days_of_week', "Friday") + self.int_enum = kwargs['int_enum'] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models_py3.py index 8bfb0587f6a..4d98d961606 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_models_py3.py @@ -28,13 +28,13 @@ class Pet(msrest.serialization.Model): """ _validation = { - "int_enum": {"required": True}, + 'int_enum': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "days_of_week": {"key": "DaysOfWeek", "type": "str"}, - "int_enum": {"key": "IntEnum", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'days_of_week': {'key': 'DaysOfWeek', 'type': 'str'}, + 'int_enum': {'key': 'IntEnum', 'type': 'str'}, } def __init__( diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_pet_store_inc_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_pet_store_inc_enums.py index 5a1b6c24d09..dd6f6db6a59 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_pet_store_inc_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_pet_store_inc_enums.py @@ -12,7 +12,8 @@ class DaysOfWeekExtensibleEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of Pet""" + """Type of Pet + """ MONDAY = "Monday" TUESDAY = "Tuesday" @@ -22,7 +23,6 @@ class DaysOfWeekExtensibleEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum SATURDAY = "Saturday" SUNDAY = "Sunday" - class IntEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is a really long comment to see what wrapping looks like. This comment is really long and diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/__init__.py index a072d24cd5c..5c1da84e7fb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/__init__.py @@ -9,5 +9,5 @@ from ._pet_operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py index c71aa2c6f0e..4557ec705e7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -124,32 +116,40 @@ def get_by_pet_id( :rtype: ~extensibleenumsswagger.models.Pet :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Pet"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Pet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_by_pet_id_request( pet_id=pet_id, - template_url=self.get_by_pet_id.metadata["url"], + template_url=self.get_by_pet_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_by_pet_id.metadata = {"url": "/extensibleenums/pet/{petId}"} # type: ignore + get_by_pet_id.metadata = {'url': '/extensibleenums/pet/{petId}'} # type: ignore + @distributed_trace def add_pet( @@ -167,37 +167,44 @@ def add_pet( :rtype: ~extensibleenumsswagger.models.Pet :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Pet"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Pet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if pet_param is not None: - _json = self._serialize.body(pet_param, "Pet") + _json = self._serialize.body(pet_param, 'Pet') else: _json = None request = build_add_pet_request( content_type=content_type, json=_json, - template_url=self.add_pet.metadata["url"], + template_url=self.add_pet.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - add_pet.metadata = {"url": "/extensibleenums/pet/addPet"} # type: ignore + add_pet.metadata = {'url': '/extensibleenums/pet/addPet'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py index a7ea89c9d01..e8dfe80d67d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ PetStore. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/__init__.py index 3fe0f0f8751..d10c57f2e46 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATHeaderService"] +__all__ = ['AutoRestSwaggerBATHeaderService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py index c466b6dceb0..3f40bfc2d9c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATHeaderService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_configuration.py index 25a01661b0c..a06fcff3228 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): +class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATHeaderService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATHeaderServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatheaderservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatheaderservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/__init__.py index cf7d0b372e7..2df70cd716b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_header_service import AutoRestSwaggerBATHeaderService - -__all__ = ["AutoRestSwaggerBATHeaderService"] +__all__ = ['AutoRestSwaggerBATHeaderService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py index 468be86357d..ea6e9d316de 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATHeaderServiceConfiguration from .operations import HeaderOperations - class AutoRestSwaggerBATHeaderService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATHeaderService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATHeaderServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_configuration.py index d7e96d2334c..352eabee6af 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): +class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATHeaderService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATHeaderServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatheaderservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatheaderservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/__init__.py index edb8b75dc2d..6201248980f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._header_operations import HeaderOperations __all__ = [ - "HeaderOperations", + 'HeaderOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py index 82c8bf5bfbf..01d16453035 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,43 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._header_operations import ( - build_custom_request_id_request, - build_param_bool_request, - build_param_byte_request, - build_param_date_request, - build_param_datetime_request, - build_param_datetime_rfc1123_request, - build_param_double_request, - build_param_duration_request, - build_param_enum_request, - build_param_existing_key_request, - build_param_float_request, - build_param_integer_request, - build_param_long_request, - build_param_protected_key_request, - build_param_string_request, - build_response_bool_request, - build_response_byte_request, - build_response_date_request, - build_response_datetime_request, - build_response_datetime_rfc1123_request, - build_response_double_request, - build_response_duration_request, - build_response_enum_request, - build_response_existing_key_request, - build_response_float_request, - build_response_integer_request, - build_response_long_request, - build_response_protected_key_request, - build_response_string_request, -) - -T = TypeVar("T") +from ...operations._header_operations import build_custom_request_id_request, build_param_bool_request, build_param_byte_request, build_param_date_request, build_param_datetime_request, build_param_datetime_rfc1123_request, build_param_double_request, build_param_duration_request, build_param_enum_request, build_param_existing_key_request, build_param_float_request, build_param_integer_request, build_param_long_request, build_param_protected_key_request, build_param_string_request, build_response_bool_request, build_response_byte_request, build_response_date_request, build_response_datetime_request, build_response_datetime_rfc1123_request, build_response_double_request, build_response_duration_request, build_response_enum_request, build_response_existing_key_request, build_response_float_request, build_response_integer_request, build_response_long_request, build_response_protected_key_request, build_response_string_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class HeaderOperations: +class HeaderOperations: # pylint: disable=too-many-public-methods """HeaderOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -83,7 +44,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def param_existing_key(self, user_agent_parameter: str, **kwargs: Any) -> None: + async def param_existing_key( + self, + user_agent_parameter: str, + **kwargs: Any + ) -> None: """Send a post request with header value "User-Agent": "overwrite". :param user_agent_parameter: Send a post request with header value "User-Agent": "overwrite". @@ -93,18 +58,25 @@ async def param_existing_key(self, user_agent_parameter: str, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_existing_key_request( user_agent_parameter=user_agent_parameter, - template_url=self.param_existing_key.metadata["url"], + template_url=self.param_existing_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,10 +87,14 @@ async def param_existing_key(self, user_agent_parameter: str, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - param_existing_key.metadata = {"url": "/header/param/existingkey"} # type: ignore + param_existing_key.metadata = {'url': '/header/param/existingkey'} # type: ignore + @distributed_trace_async - async def response_existing_key(self, **kwargs: Any) -> None: + async def response_existing_key( + self, + **kwargs: Any + ) -> None: """Get a response with header value "User-Agent": "overwrite". :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,17 +102,24 @@ async def response_existing_key(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_existing_key_request( - template_url=self.response_existing_key.metadata["url"], + template_url=self.response_existing_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,15 +128,20 @@ async def response_existing_key(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["User-Agent"] = self._deserialize("str", response.headers.get("User-Agent")) + response_headers['User-Agent']=self._deserialize('str', response.headers.get('User-Agent')) + if cls: return cls(pipeline_response, None, response_headers) - response_existing_key.metadata = {"url": "/header/response/existingkey"} # type: ignore + response_existing_key.metadata = {'url': '/header/response/existingkey'} # type: ignore + @distributed_trace_async - async def param_protected_key(self, **kwargs: Any) -> None: + async def param_protected_key( + self, + **kwargs: Any + ) -> None: """Send a post request with header value "Content-Type": "text/html". :keyword callable cls: A custom type or function that will be passed the direct response @@ -161,20 +149,27 @@ async def param_protected_key(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type") # type: str + content_type = kwargs.pop('content_type') # type: str + request = build_param_protected_key_request( content_type=content_type, - template_url=self.param_protected_key.metadata["url"], + template_url=self.param_protected_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,10 +180,14 @@ async def param_protected_key(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - param_protected_key.metadata = {"url": "/header/param/protectedkey"} # type: ignore + param_protected_key.metadata = {'url': '/header/param/protectedkey'} # type: ignore + @distributed_trace_async - async def response_protected_key(self, **kwargs: Any) -> None: + async def response_protected_key( + self, + **kwargs: Any + ) -> None: """Get a response with header value "Content-Type": "text/html". :keyword callable cls: A custom type or function that will be passed the direct response @@ -196,17 +195,24 @@ async def response_protected_key(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_protected_key_request( - template_url=self.response_protected_key.metadata["url"], + template_url=self.response_protected_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -215,15 +221,22 @@ async def response_protected_key(self, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + if cls: return cls(pipeline_response, None, response_headers) - response_protected_key.metadata = {"url": "/header/response/protectedkey"} # type: ignore + response_protected_key.metadata = {'url': '/header/response/protectedkey'} # type: ignore + @distributed_trace_async - async def param_integer(self, scenario: str, value: int, **kwargs: Any) -> None: + async def param_integer( + self, + scenario: str, + value: int, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 1 or "scenario": "negative", "value": -2. @@ -236,19 +249,26 @@ async def param_integer(self, scenario: str, value: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_integer_request( scenario=scenario, value=value, - template_url=self.param_integer.metadata["url"], + template_url=self.param_integer.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -259,10 +279,15 @@ async def param_integer(self, scenario: str, value: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - param_integer.metadata = {"url": "/header/param/prim/integer"} # type: ignore + param_integer.metadata = {'url': '/header/param/prim/integer'} # type: ignore + @distributed_trace_async - async def response_integer(self, scenario: str, **kwargs: Any) -> None: + async def response_integer( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 1 or -2. :param scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -272,18 +297,25 @@ async def response_integer(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_integer_request( scenario=scenario, - template_url=self.response_integer.metadata["url"], + template_url=self.response_integer.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -292,15 +324,22 @@ async def response_integer(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("int", response.headers.get("value")) + response_headers['value']=self._deserialize('int', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_integer.metadata = {"url": "/header/response/prim/integer"} # type: ignore + response_integer.metadata = {'url': '/header/response/prim/integer'} # type: ignore + @distributed_trace_async - async def param_long(self, scenario: str, value: int, **kwargs: Any) -> None: + async def param_long( + self, + scenario: str, + value: int, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 105 or "scenario": "negative", "value": -2. @@ -313,19 +352,26 @@ async def param_long(self, scenario: str, value: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_long_request( scenario=scenario, value=value, - template_url=self.param_long.metadata["url"], + template_url=self.param_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -336,10 +382,15 @@ async def param_long(self, scenario: str, value: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - param_long.metadata = {"url": "/header/param/prim/long"} # type: ignore + param_long.metadata = {'url': '/header/param/prim/long'} # type: ignore + @distributed_trace_async - async def response_long(self, scenario: str, **kwargs: Any) -> None: + async def response_long( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 105 or -2. :param scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -349,18 +400,25 @@ async def response_long(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_long_request( scenario=scenario, - template_url=self.response_long.metadata["url"], + template_url=self.response_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -369,15 +427,22 @@ async def response_long(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("long", response.headers.get("value")) + response_headers['value']=self._deserialize('long', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_long.metadata = {"url": "/header/response/prim/long"} # type: ignore + response_long.metadata = {'url': '/header/response/prim/long'} # type: ignore + @distributed_trace_async - async def param_float(self, scenario: str, value: float, **kwargs: Any) -> None: + async def param_float( + self, + scenario: str, + value: float, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": "negative", "value": -3.0. @@ -390,19 +455,26 @@ async def param_float(self, scenario: str, value: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_float_request( scenario=scenario, value=value, - template_url=self.param_float.metadata["url"], + template_url=self.param_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -413,10 +485,15 @@ async def param_float(self, scenario: str, value: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - param_float.metadata = {"url": "/header/param/prim/float"} # type: ignore + param_float.metadata = {'url': '/header/param/prim/float'} # type: ignore + @distributed_trace_async - async def response_float(self, scenario: str, **kwargs: Any) -> None: + async def response_float( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 0.07 or -3.0. :param scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -426,18 +503,25 @@ async def response_float(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_float_request( scenario=scenario, - template_url=self.response_float.metadata["url"], + template_url=self.response_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -446,15 +530,22 @@ async def response_float(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_float.metadata = {"url": "/header/response/prim/float"} # type: ignore + response_float.metadata = {'url': '/header/response/prim/float'} # type: ignore + @distributed_trace_async - async def param_double(self, scenario: str, value: float, **kwargs: Any) -> None: + async def param_double( + self, + scenario: str, + value: float, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": "negative", "value": -3.0. @@ -467,19 +558,26 @@ async def param_double(self, scenario: str, value: float, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_double_request( scenario=scenario, value=value, - template_url=self.param_double.metadata["url"], + template_url=self.param_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -490,10 +588,15 @@ async def param_double(self, scenario: str, value: float, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - param_double.metadata = {"url": "/header/param/prim/double"} # type: ignore + param_double.metadata = {'url': '/header/param/prim/double'} # type: ignore + @distributed_trace_async - async def response_double(self, scenario: str, **kwargs: Any) -> None: + async def response_double( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 7e120 or -3.0. :param scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -503,18 +606,25 @@ async def response_double(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_double_request( scenario=scenario, - template_url=self.response_double.metadata["url"], + template_url=self.response_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -523,15 +633,22 @@ async def response_double(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_double.metadata = {"url": "/header/response/prim/double"} # type: ignore + response_double.metadata = {'url': '/header/response/prim/double'} # type: ignore + @distributed_trace_async - async def param_bool(self, scenario: str, value: bool, **kwargs: Any) -> None: + async def param_bool( + self, + scenario: str, + value: bool, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "true", "value": true or "scenario": "false", "value": false. @@ -544,19 +661,26 @@ async def param_bool(self, scenario: str, value: bool, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_bool_request( scenario=scenario, value=value, - template_url=self.param_bool.metadata["url"], + template_url=self.param_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -567,10 +691,15 @@ async def param_bool(self, scenario: str, value: bool, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - param_bool.metadata = {"url": "/header/param/prim/bool"} # type: ignore + param_bool.metadata = {'url': '/header/param/prim/bool'} # type: ignore + @distributed_trace_async - async def response_bool(self, scenario: str, **kwargs: Any) -> None: + async def response_bool( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": true or false. :param scenario: Send a post request with header values "scenario": "true" or "false". @@ -580,18 +709,25 @@ async def response_bool(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_bool_request( scenario=scenario, - template_url=self.response_bool.metadata["url"], + template_url=self.response_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -600,15 +736,22 @@ async def response_bool(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("bool", response.headers.get("value")) + response_headers['value']=self._deserialize('bool', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_bool.metadata = {"url": "/header/response/prim/bool"} # type: ignore + response_bool.metadata = {'url': '/header/response/prim/bool'} # type: ignore + @distributed_trace_async - async def param_string(self, scenario: str, value: Optional[str] = None, **kwargs: Any) -> None: + async def param_string( + self, + scenario: str, + value: Optional[str] = None, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps over the lazy dog" or "scenario": "null", "value": null or "scenario": "empty", "value": "". @@ -623,19 +766,26 @@ async def param_string(self, scenario: str, value: Optional[str] = None, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_string_request( scenario=scenario, value=value, - template_url=self.param_string.metadata["url"], + template_url=self.param_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -646,10 +796,15 @@ async def param_string(self, scenario: str, value: Optional[str] = None, **kwarg if cls: return cls(pipeline_response, None, {}) - param_string.metadata = {"url": "/header/param/prim/string"} # type: ignore + param_string.metadata = {'url': '/header/param/prim/string'} # type: ignore + @distributed_trace_async - async def response_string(self, scenario: str, **kwargs: Any) -> None: + async def response_string( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "". :param scenario: Send a post request with header values "scenario": "valid" or "null" or @@ -660,18 +815,25 @@ async def response_string(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_string_request( scenario=scenario, - template_url=self.response_string.metadata["url"], + template_url=self.response_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -680,15 +842,22 @@ async def response_string(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_string.metadata = {"url": "/header/response/prim/string"} # type: ignore + response_string.metadata = {'url': '/header/response/prim/string'} # type: ignore + @distributed_trace_async - async def param_date(self, scenario: str, value: datetime.date, **kwargs: Any) -> None: + async def param_date( + self, + scenario: str, + value: datetime.date, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "2010-01-01" or "scenario": "min", "value": "0001-01-01". @@ -701,19 +870,26 @@ async def param_date(self, scenario: str, value: datetime.date, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_date_request( scenario=scenario, value=value, - template_url=self.param_date.metadata["url"], + template_url=self.param_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -724,10 +900,15 @@ async def param_date(self, scenario: str, value: datetime.date, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - param_date.metadata = {"url": "/header/param/prim/date"} # type: ignore + param_date.metadata = {'url': '/header/param/prim/date'} # type: ignore + @distributed_trace_async - async def response_date(self, scenario: str, **kwargs: Any) -> None: + async def response_date( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "2010-01-01" or "0001-01-01". :param scenario: Send a post request with header values "scenario": "valid" or "min". @@ -737,18 +918,25 @@ async def response_date(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_date_request( scenario=scenario, - template_url=self.response_date.metadata["url"], + template_url=self.response_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -757,15 +945,22 @@ async def response_date(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("date", response.headers.get("value")) + response_headers['value']=self._deserialize('date', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_date.metadata = {"url": "/header/response/prim/date"} # type: ignore + response_date.metadata = {'url': '/header/response/prim/date'} # type: ignore + @distributed_trace_async - async def param_datetime(self, scenario: str, value: datetime.datetime, **kwargs: Any) -> None: + async def param_datetime( + self, + scenario: str, + value: datetime.datetime, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or "scenario": "min", "value": "0001-01-01T00:00:00Z". @@ -779,19 +974,26 @@ async def param_datetime(self, scenario: str, value: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_datetime_request( scenario=scenario, value=value, - template_url=self.param_datetime.metadata["url"], + template_url=self.param_datetime.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -802,10 +1004,15 @@ async def param_datetime(self, scenario: str, value: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) - param_datetime.metadata = {"url": "/header/param/prim/datetime"} # type: ignore + param_datetime.metadata = {'url': '/header/param/prim/datetime'} # type: ignore + @distributed_trace_async - async def response_datetime(self, scenario: str, **kwargs: Any) -> None: + async def response_datetime( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z". :param scenario: Send a post request with header values "scenario": "valid" or "min". @@ -815,18 +1022,25 @@ async def response_datetime(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_datetime_request( scenario=scenario, - template_url=self.response_datetime.metadata["url"], + template_url=self.response_datetime.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -835,16 +1049,21 @@ async def response_datetime(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) + response_headers['value']=self._deserialize('iso-8601', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_datetime.metadata = {"url": "/header/response/prim/datetime"} # type: ignore + response_datetime.metadata = {'url': '/header/response/prim/datetime'} # type: ignore + @distributed_trace_async async def param_datetime_rfc1123( - self, scenario: str, value: Optional[datetime.datetime] = None, **kwargs: Any + self, + scenario: str, + value: Optional[datetime.datetime] = None, + **kwargs: Any ) -> None: """Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 00:00:00 GMT". @@ -859,19 +1078,26 @@ async def param_datetime_rfc1123( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_datetime_rfc1123_request( scenario=scenario, value=value, - template_url=self.param_datetime_rfc1123.metadata["url"], + template_url=self.param_datetime_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -882,10 +1108,15 @@ async def param_datetime_rfc1123( if cls: return cls(pipeline_response, None, {}) - param_datetime_rfc1123.metadata = {"url": "/header/param/prim/datetimerfc1123"} # type: ignore + param_datetime_rfc1123.metadata = {'url': '/header/param/prim/datetimerfc1123'} # type: ignore + @distributed_trace_async - async def response_datetime_rfc1123(self, scenario: str, **kwargs: Any) -> None: + async def response_datetime_rfc1123( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT". @@ -896,18 +1127,25 @@ async def response_datetime_rfc1123(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_datetime_rfc1123_request( scenario=scenario, - template_url=self.response_datetime_rfc1123.metadata["url"], + template_url=self.response_datetime_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -916,15 +1154,22 @@ async def response_datetime_rfc1123(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + response_headers['value']=self._deserialize('rfc-1123', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_datetime_rfc1123.metadata = {"url": "/header/response/prim/datetimerfc1123"} # type: ignore + response_datetime_rfc1123.metadata = {'url': '/header/response/prim/datetimerfc1123'} # type: ignore + @distributed_trace_async - async def param_duration(self, scenario: str, value: datetime.timedelta, **kwargs: Any) -> None: + async def param_duration( + self, + scenario: str, + value: datetime.timedelta, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S". :param scenario: Send a post request with header values "scenario": "valid". @@ -936,19 +1181,26 @@ async def param_duration(self, scenario: str, value: datetime.timedelta, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_duration_request( scenario=scenario, value=value, - template_url=self.param_duration.metadata["url"], + template_url=self.param_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -959,10 +1211,15 @@ async def param_duration(self, scenario: str, value: datetime.timedelta, **kwarg if cls: return cls(pipeline_response, None, {}) - param_duration.metadata = {"url": "/header/param/prim/duration"} # type: ignore + param_duration.metadata = {'url': '/header/param/prim/duration'} # type: ignore + @distributed_trace_async - async def response_duration(self, scenario: str, **kwargs: Any) -> None: + async def response_duration( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "P123DT22H14M12.011S". :param scenario: Send a post request with header values "scenario": "valid". @@ -972,18 +1229,25 @@ async def response_duration(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_duration_request( scenario=scenario, - template_url=self.response_duration.metadata["url"], + template_url=self.response_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -992,15 +1256,22 @@ async def response_duration(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("duration", response.headers.get("value")) + response_headers['value']=self._deserialize('duration', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_duration.metadata = {"url": "/header/response/prim/duration"} # type: ignore + response_duration.metadata = {'url': '/header/response/prim/duration'} # type: ignore + @distributed_trace_async - async def param_byte(self, scenario: str, value: bytearray, **kwargs: Any) -> None: + async def param_byte( + self, + scenario: str, + value: bytearray, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩". :param scenario: Send a post request with header values "scenario": "valid". @@ -1012,19 +1283,26 @@ async def param_byte(self, scenario: str, value: bytearray, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_byte_request( scenario=scenario, value=value, - template_url=self.param_byte.metadata["url"], + template_url=self.param_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1035,10 +1313,15 @@ async def param_byte(self, scenario: str, value: bytearray, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - param_byte.metadata = {"url": "/header/param/prim/byte"} # type: ignore + param_byte.metadata = {'url': '/header/param/prim/byte'} # type: ignore + @distributed_trace_async - async def response_byte(self, scenario: str, **kwargs: Any) -> None: + async def response_byte( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "啊齄丂狛狜隣郎隣兀﨩". :param scenario: Send a post request with header values "scenario": "valid". @@ -1048,18 +1331,25 @@ async def response_byte(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_byte_request( scenario=scenario, - template_url=self.response_byte.metadata["url"], + template_url=self.response_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1068,16 +1358,21 @@ async def response_byte(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("bytearray", response.headers.get("value")) + response_headers['value']=self._deserialize('bytearray', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_byte.metadata = {"url": "/header/response/prim/byte"} # type: ignore + response_byte.metadata = {'url': '/header/response/prim/byte'} # type: ignore + @distributed_trace_async async def param_enum( - self, scenario: str, value: Optional[Union[str, "_models.GreyscaleColors"]] = None, **kwargs: Any + self, + scenario: str, + value: Optional[Union[str, "_models.GreyscaleColors"]] = None, + **kwargs: Any ) -> None: """Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": "null", "value": null. @@ -1092,19 +1387,26 @@ async def param_enum( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_enum_request( scenario=scenario, value=value, - template_url=self.param_enum.metadata["url"], + template_url=self.param_enum.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1115,10 +1417,15 @@ async def param_enum( if cls: return cls(pipeline_response, None, {}) - param_enum.metadata = {"url": "/header/param/prim/enum"} # type: ignore + param_enum.metadata = {'url': '/header/param/prim/enum'} # type: ignore + @distributed_trace_async - async def response_enum(self, scenario: str, **kwargs: Any) -> None: + async def response_enum( + self, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "GREY" or null. :param scenario: Send a post request with header values "scenario": "valid" or "null" or @@ -1129,18 +1436,25 @@ async def response_enum(self, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_enum_request( scenario=scenario, - template_url=self.response_enum.metadata["url"], + template_url=self.response_enum.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1149,15 +1463,20 @@ async def response_enum(self, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_enum.metadata = {"url": "/header/response/prim/enum"} # type: ignore + response_enum.metadata = {'url': '/header/response/prim/enum'} # type: ignore + @distributed_trace_async - async def custom_request_id(self, **kwargs: Any) -> None: + async def custom_request_id( + self, + **kwargs: Any + ) -> None: """Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. @@ -1166,17 +1485,24 @@ async def custom_request_id(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_custom_request_id_request( - template_url=self.custom_request_id.metadata["url"], + template_url=self.custom_request_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1187,4 +1513,5 @@ async def custom_request_id(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - custom_request_id.metadata = {"url": "/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"} # type: ignore + custom_request_id.metadata = {'url': '/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py index 8b6b2affd5a..ca42ace3c95 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py @@ -16,6 +16,6 @@ ) __all__ = [ - "Error", - "GreyscaleColors", + 'Error', + 'GreyscaleColors', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/__init__.py index edb8b75dc2d..6201248980f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/__init__.py @@ -9,5 +9,5 @@ from ._header_operations import HeaderOperations __all__ = [ - "HeaderOperations", + 'HeaderOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py index 4368aeb99f8..bb8d20df943 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -722,7 +714,7 @@ def build_custom_request_id_request( ) # fmt: on -class HeaderOperations(object): +class HeaderOperations(object): # pylint: disable=too-many-public-methods """HeaderOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -760,18 +752,25 @@ def param_existing_key( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_existing_key_request( user_agent_parameter=user_agent_parameter, - template_url=self.param_existing_key.metadata["url"], + template_url=self.param_existing_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -782,11 +781,13 @@ def param_existing_key( if cls: return cls(pipeline_response, None, {}) - param_existing_key.metadata = {"url": "/header/param/existingkey"} # type: ignore + param_existing_key.metadata = {'url': '/header/param/existingkey'} # type: ignore + @distributed_trace def response_existing_key( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get a response with header value "User-Agent": "overwrite". @@ -796,17 +797,24 @@ def response_existing_key( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_existing_key_request( - template_url=self.response_existing_key.metadata["url"], + template_url=self.response_existing_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -815,16 +823,19 @@ def response_existing_key( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["User-Agent"] = self._deserialize("str", response.headers.get("User-Agent")) + response_headers['User-Agent']=self._deserialize('str', response.headers.get('User-Agent')) + if cls: return cls(pipeline_response, None, response_headers) - response_existing_key.metadata = {"url": "/header/response/existingkey"} # type: ignore + response_existing_key.metadata = {'url': '/header/response/existingkey'} # type: ignore + @distributed_trace def param_protected_key( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a post request with header value "Content-Type": "text/html". @@ -834,20 +845,27 @@ def param_protected_key( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type") # type: str + content_type = kwargs.pop('content_type') # type: str + request = build_param_protected_key_request( content_type=content_type, - template_url=self.param_protected_key.metadata["url"], + template_url=self.param_protected_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -858,11 +876,13 @@ def param_protected_key( if cls: return cls(pipeline_response, None, {}) - param_protected_key.metadata = {"url": "/header/param/protectedkey"} # type: ignore + param_protected_key.metadata = {'url': '/header/param/protectedkey'} # type: ignore + @distributed_trace def response_protected_key( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get a response with header value "Content-Type": "text/html". @@ -872,17 +892,24 @@ def response_protected_key( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_protected_key_request( - template_url=self.response_protected_key.metadata["url"], + template_url=self.response_protected_key.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -891,12 +918,14 @@ def response_protected_key( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + if cls: return cls(pipeline_response, None, response_headers) - response_protected_key.metadata = {"url": "/header/response/protectedkey"} # type: ignore + response_protected_key.metadata = {'url': '/header/response/protectedkey'} # type: ignore + @distributed_trace def param_integer( @@ -918,19 +947,26 @@ def param_integer( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_integer_request( scenario=scenario, value=value, - template_url=self.param_integer.metadata["url"], + template_url=self.param_integer.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -941,7 +977,8 @@ def param_integer( if cls: return cls(pipeline_response, None, {}) - param_integer.metadata = {"url": "/header/param/prim/integer"} # type: ignore + param_integer.metadata = {'url': '/header/param/prim/integer'} # type: ignore + @distributed_trace def response_integer( @@ -959,18 +996,25 @@ def response_integer( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_integer_request( scenario=scenario, - template_url=self.response_integer.metadata["url"], + template_url=self.response_integer.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -979,12 +1023,14 @@ def response_integer( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("int", response.headers.get("value")) + response_headers['value']=self._deserialize('int', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_integer.metadata = {"url": "/header/response/prim/integer"} # type: ignore + response_integer.metadata = {'url': '/header/response/prim/integer'} # type: ignore + @distributed_trace def param_long( @@ -1006,19 +1052,26 @@ def param_long( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_long_request( scenario=scenario, value=value, - template_url=self.param_long.metadata["url"], + template_url=self.param_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1029,7 +1082,8 @@ def param_long( if cls: return cls(pipeline_response, None, {}) - param_long.metadata = {"url": "/header/param/prim/long"} # type: ignore + param_long.metadata = {'url': '/header/param/prim/long'} # type: ignore + @distributed_trace def response_long( @@ -1047,18 +1101,25 @@ def response_long( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_long_request( scenario=scenario, - template_url=self.response_long.metadata["url"], + template_url=self.response_long.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1067,12 +1128,14 @@ def response_long( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("long", response.headers.get("value")) + response_headers['value']=self._deserialize('long', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_long.metadata = {"url": "/header/response/prim/long"} # type: ignore + response_long.metadata = {'url': '/header/response/prim/long'} # type: ignore + @distributed_trace def param_float( @@ -1094,19 +1157,26 @@ def param_float( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_float_request( scenario=scenario, value=value, - template_url=self.param_float.metadata["url"], + template_url=self.param_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1117,7 +1187,8 @@ def param_float( if cls: return cls(pipeline_response, None, {}) - param_float.metadata = {"url": "/header/param/prim/float"} # type: ignore + param_float.metadata = {'url': '/header/param/prim/float'} # type: ignore + @distributed_trace def response_float( @@ -1135,18 +1206,25 @@ def response_float( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_float_request( scenario=scenario, - template_url=self.response_float.metadata["url"], + template_url=self.response_float.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1155,12 +1233,14 @@ def response_float( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_float.metadata = {"url": "/header/response/prim/float"} # type: ignore + response_float.metadata = {'url': '/header/response/prim/float'} # type: ignore + @distributed_trace def param_double( @@ -1182,19 +1262,26 @@ def param_double( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_double_request( scenario=scenario, value=value, - template_url=self.param_double.metadata["url"], + template_url=self.param_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1205,7 +1292,8 @@ def param_double( if cls: return cls(pipeline_response, None, {}) - param_double.metadata = {"url": "/header/param/prim/double"} # type: ignore + param_double.metadata = {'url': '/header/param/prim/double'} # type: ignore + @distributed_trace def response_double( @@ -1223,18 +1311,25 @@ def response_double( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_double_request( scenario=scenario, - template_url=self.response_double.metadata["url"], + template_url=self.response_double.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1243,12 +1338,14 @@ def response_double( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_double.metadata = {"url": "/header/response/prim/double"} # type: ignore + response_double.metadata = {'url': '/header/response/prim/double'} # type: ignore + @distributed_trace def param_bool( @@ -1270,19 +1367,26 @@ def param_bool( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_bool_request( scenario=scenario, value=value, - template_url=self.param_bool.metadata["url"], + template_url=self.param_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1293,7 +1397,8 @@ def param_bool( if cls: return cls(pipeline_response, None, {}) - param_bool.metadata = {"url": "/header/param/prim/bool"} # type: ignore + param_bool.metadata = {'url': '/header/param/prim/bool'} # type: ignore + @distributed_trace def response_bool( @@ -1311,18 +1416,25 @@ def response_bool( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_bool_request( scenario=scenario, - template_url=self.response_bool.metadata["url"], + template_url=self.response_bool.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1331,12 +1443,14 @@ def response_bool( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("bool", response.headers.get("value")) + response_headers['value']=self._deserialize('bool', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_bool.metadata = {"url": "/header/response/prim/bool"} # type: ignore + response_bool.metadata = {'url': '/header/response/prim/bool'} # type: ignore + @distributed_trace def param_string( @@ -1360,19 +1474,26 @@ def param_string( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_string_request( scenario=scenario, value=value, - template_url=self.param_string.metadata["url"], + template_url=self.param_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1383,7 +1504,8 @@ def param_string( if cls: return cls(pipeline_response, None, {}) - param_string.metadata = {"url": "/header/param/prim/string"} # type: ignore + param_string.metadata = {'url': '/header/param/prim/string'} # type: ignore + @distributed_trace def response_string( @@ -1402,18 +1524,25 @@ def response_string( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_string_request( scenario=scenario, - template_url=self.response_string.metadata["url"], + template_url=self.response_string.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1422,12 +1551,14 @@ def response_string( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_string.metadata = {"url": "/header/response/prim/string"} # type: ignore + response_string.metadata = {'url': '/header/response/prim/string'} # type: ignore + @distributed_trace def param_date( @@ -1449,19 +1580,26 @@ def param_date( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_date_request( scenario=scenario, value=value, - template_url=self.param_date.metadata["url"], + template_url=self.param_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1472,7 +1610,8 @@ def param_date( if cls: return cls(pipeline_response, None, {}) - param_date.metadata = {"url": "/header/param/prim/date"} # type: ignore + param_date.metadata = {'url': '/header/param/prim/date'} # type: ignore + @distributed_trace def response_date( @@ -1490,18 +1629,25 @@ def response_date( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_date_request( scenario=scenario, - template_url=self.response_date.metadata["url"], + template_url=self.response_date.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1510,12 +1656,14 @@ def response_date( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("date", response.headers.get("value")) + response_headers['value']=self._deserialize('date', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_date.metadata = {"url": "/header/response/prim/date"} # type: ignore + response_date.metadata = {'url': '/header/response/prim/date'} # type: ignore + @distributed_trace def param_datetime( @@ -1538,19 +1686,26 @@ def param_datetime( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_datetime_request( scenario=scenario, value=value, - template_url=self.param_datetime.metadata["url"], + template_url=self.param_datetime.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1561,7 +1716,8 @@ def param_datetime( if cls: return cls(pipeline_response, None, {}) - param_datetime.metadata = {"url": "/header/param/prim/datetime"} # type: ignore + param_datetime.metadata = {'url': '/header/param/prim/datetime'} # type: ignore + @distributed_trace def response_datetime( @@ -1579,18 +1735,25 @@ def response_datetime( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_datetime_request( scenario=scenario, - template_url=self.response_datetime.metadata["url"], + template_url=self.response_datetime.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1599,12 +1762,14 @@ def response_datetime( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) + response_headers['value']=self._deserialize('iso-8601', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_datetime.metadata = {"url": "/header/response/prim/datetime"} # type: ignore + response_datetime.metadata = {'url': '/header/response/prim/datetime'} # type: ignore + @distributed_trace def param_datetime_rfc1123( @@ -1627,19 +1792,26 @@ def param_datetime_rfc1123( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_datetime_rfc1123_request( scenario=scenario, value=value, - template_url=self.param_datetime_rfc1123.metadata["url"], + template_url=self.param_datetime_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1650,7 +1822,8 @@ def param_datetime_rfc1123( if cls: return cls(pipeline_response, None, {}) - param_datetime_rfc1123.metadata = {"url": "/header/param/prim/datetimerfc1123"} # type: ignore + param_datetime_rfc1123.metadata = {'url': '/header/param/prim/datetimerfc1123'} # type: ignore + @distributed_trace def response_datetime_rfc1123( @@ -1669,18 +1842,25 @@ def response_datetime_rfc1123( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_datetime_rfc1123_request( scenario=scenario, - template_url=self.response_datetime_rfc1123.metadata["url"], + template_url=self.response_datetime_rfc1123.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1689,12 +1869,14 @@ def response_datetime_rfc1123( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + response_headers['value']=self._deserialize('rfc-1123', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_datetime_rfc1123.metadata = {"url": "/header/response/prim/datetimerfc1123"} # type: ignore + response_datetime_rfc1123.metadata = {'url': '/header/response/prim/datetimerfc1123'} # type: ignore + @distributed_trace def param_duration( @@ -1715,19 +1897,26 @@ def param_duration( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_duration_request( scenario=scenario, value=value, - template_url=self.param_duration.metadata["url"], + template_url=self.param_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1738,7 +1927,8 @@ def param_duration( if cls: return cls(pipeline_response, None, {}) - param_duration.metadata = {"url": "/header/param/prim/duration"} # type: ignore + param_duration.metadata = {'url': '/header/param/prim/duration'} # type: ignore + @distributed_trace def response_duration( @@ -1756,18 +1946,25 @@ def response_duration( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_duration_request( scenario=scenario, - template_url=self.response_duration.metadata["url"], + template_url=self.response_duration.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1776,12 +1973,14 @@ def response_duration( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("duration", response.headers.get("value")) + response_headers['value']=self._deserialize('duration', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_duration.metadata = {"url": "/header/response/prim/duration"} # type: ignore + response_duration.metadata = {'url': '/header/response/prim/duration'} # type: ignore + @distributed_trace def param_byte( @@ -1802,19 +2001,26 @@ def param_byte( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_byte_request( scenario=scenario, value=value, - template_url=self.param_byte.metadata["url"], + template_url=self.param_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1825,7 +2031,8 @@ def param_byte( if cls: return cls(pipeline_response, None, {}) - param_byte.metadata = {"url": "/header/param/prim/byte"} # type: ignore + param_byte.metadata = {'url': '/header/param/prim/byte'} # type: ignore + @distributed_trace def response_byte( @@ -1843,18 +2050,25 @@ def response_byte( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_byte_request( scenario=scenario, - template_url=self.response_byte.metadata["url"], + template_url=self.response_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1863,12 +2077,14 @@ def response_byte( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("bytearray", response.headers.get("value")) + response_headers['value']=self._deserialize('bytearray', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_byte.metadata = {"url": "/header/response/prim/byte"} # type: ignore + response_byte.metadata = {'url': '/header/response/prim/byte'} # type: ignore + @distributed_trace def param_enum( @@ -1891,19 +2107,26 @@ def param_enum( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_param_enum_request( scenario=scenario, value=value, - template_url=self.param_enum.metadata["url"], + template_url=self.param_enum.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1914,7 +2137,8 @@ def param_enum( if cls: return cls(pipeline_response, None, {}) - param_enum.metadata = {"url": "/header/param/prim/enum"} # type: ignore + param_enum.metadata = {'url': '/header/param/prim/enum'} # type: ignore + @distributed_trace def response_enum( @@ -1933,18 +2157,25 @@ def response_enum( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_response_enum_request( scenario=scenario, - template_url=self.response_enum.metadata["url"], + template_url=self.response_enum.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1953,16 +2184,19 @@ def response_enum( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) - response_enum.metadata = {"url": "/header/response/prim/enum"} # type: ignore + response_enum.metadata = {'url': '/header/response/prim/enum'} # type: ignore + @distributed_trace def custom_request_id( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the @@ -1973,17 +2207,24 @@ def custom_request_id( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_custom_request_id_request( - template_url=self.custom_request_id.metadata["url"], + template_url=self.custom_request_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1994,4 +2235,5 @@ def custom_request_id( if cls: return cls(pipeline_response, None, {}) - custom_request_id.metadata = {"url": "/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0"} # type: ignore + custom_request_id.metadata = {'url': '/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py index 8749e54d402..ecf57c0041c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/__init__.py index 59e83504622..2272153c560 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHttpInfrastructureTestService"] +__all__ = ['AutoRestHttpInfrastructureTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py index 9bc17237bb9..d96b4ae2a88 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py @@ -14,24 +14,15 @@ from . import models from ._configuration import AutoRestHttpInfrastructureTestServiceConfiguration -from .operations import ( - HttpClientFailureOperations, - HttpFailureOperations, - HttpRedirectsOperations, - HttpRetryOperations, - HttpServerFailureOperations, - HttpSuccessOperations, - MultipleResponsesOperations, -) +from .operations import HttpClientFailureOperations, HttpFailureOperations, HttpRedirectsOperations, HttpRetryOperations, HttpServerFailureOperations, HttpSuccessOperations, MultipleResponsesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - -class AutoRestHttpInfrastructureTestService(object): +class AutoRestHttpInfrastructureTestService(object): # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar http_failure: HttpFailureOperations operations @@ -68,16 +59,11 @@ def __init__( self.http_failure = HttpFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) self.http_redirects = HttpRedirectsOperations(self._client, self._config, self._serialize, self._deserialize) - self.http_client_failure = HttpClientFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.http_server_failure = HttpServerFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.http_client_failure = HttpClientFailureOperations(self._client, self._config, self._serialize, self._deserialize) + self.http_server_failure = HttpServerFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_retry = HttpRetryOperations(self._client, self._config, self._serialize, self._deserialize) - self.multiple_responses = MultipleResponsesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.multiple_responses = MultipleResponsesOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_configuration.py index 4ec368ae08d..d4d56213e91 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): +class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHttpInfrastructureTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestHttpInfrastructureTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresthttpinfrastructuretestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresthttpinfrastructuretestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/__init__.py index b4c36fdfe1f..c0fbcc39764 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_http_infrastructure_test_service import AutoRestHttpInfrastructureTestService - -__all__ = ["AutoRestHttpInfrastructureTestService"] +__all__ = ['AutoRestHttpInfrastructureTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py index 68d44ebfbc3..e3670523ef7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -15,18 +15,9 @@ from .. import models from ._configuration import AutoRestHttpInfrastructureTestServiceConfiguration -from .operations import ( - HttpClientFailureOperations, - HttpFailureOperations, - HttpRedirectsOperations, - HttpRetryOperations, - HttpServerFailureOperations, - HttpSuccessOperations, - MultipleResponsesOperations, -) - - -class AutoRestHttpInfrastructureTestService: +from .operations import HttpClientFailureOperations, HttpFailureOperations, HttpRedirectsOperations, HttpRetryOperations, HttpServerFailureOperations, HttpSuccessOperations, MultipleResponsesOperations + +class AutoRestHttpInfrastructureTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar http_failure: HttpFailureOperations operations @@ -47,7 +38,11 @@ class AutoRestHttpInfrastructureTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestHttpInfrastructureTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -58,18 +53,17 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self.http_failure = HttpFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) self.http_redirects = HttpRedirectsOperations(self._client, self._config, self._serialize, self._deserialize) - self.http_client_failure = HttpClientFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.http_server_failure = HttpServerFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.http_client_failure = HttpClientFailureOperations(self._client, self._config, self._serialize, self._deserialize) + self.http_server_failure = HttpServerFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_retry = HttpRetryOperations(self._client, self._config, self._serialize, self._deserialize) - self.multiple_responses = MultipleResponsesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.multiple_responses = MultipleResponsesOperations(self._client, self._config, self._serialize, self._deserialize) + - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_configuration.py index 3e8df985edb..8751fa8fcae 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): +class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHttpInfrastructureTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestHttpInfrastructureTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresthttpinfrastructuretestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresthttpinfrastructuretestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/__init__.py index b4b2498bd1a..1f97bc70675 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/__init__.py @@ -15,11 +15,11 @@ from ._multiple_responses_operations import MultipleResponsesOperations __all__ = [ - "HttpFailureOperations", - "HttpSuccessOperations", - "HttpRedirectsOperations", - "HttpClientFailureOperations", - "HttpServerFailureOperations", - "HttpRetryOperations", - "MultipleResponsesOperations", + 'HttpFailureOperations', + 'HttpSuccessOperations', + 'HttpRedirectsOperations', + 'HttpClientFailureOperations', + 'HttpServerFailureOperations', + 'HttpRetryOperations', + 'MultipleResponsesOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py index f47851278e0..279ddb41ce9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,40 +16,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._http_client_failure_operations import ( - build_delete400_request, - build_delete407_request, - build_delete417_request, - build_get400_request, - build_get402_request, - build_get403_request, - build_get411_request, - build_get412_request, - build_get416_request, - build_head400_request, - build_head401_request, - build_head410_request, - build_head429_request, - build_options400_request, - build_options403_request, - build_options412_request, - build_patch400_request, - build_patch405_request, - build_patch414_request, - build_post400_request, - build_post406_request, - build_post415_request, - build_put400_request, - build_put404_request, - build_put409_request, - build_put413_request, -) - -T = TypeVar("T") +from ...operations._http_client_failure_operations import build_delete400_request, build_delete407_request, build_delete417_request, build_get400_request, build_get402_request, build_get403_request, build_get411_request, build_get412_request, build_get416_request, build_head400_request, build_head401_request, build_head410_request, build_head429_request, build_options400_request, build_options403_request, build_options412_request, build_patch400_request, build_patch405_request, build_patch414_request, build_post400_request, build_post406_request, build_post415_request, build_put400_request, build_put404_request, build_put409_request, build_put413_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class HttpClientFailureOperations: +class HttpClientFailureOperations: # pylint: disable=too-many-public-methods """HttpClientFailureOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -79,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head400(self, **kwargs: Any) -> None: + async def head400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -87,17 +54,24 @@ async def head400(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head400_request( - template_url=self.head400.metadata["url"], + template_url=self.head400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -108,10 +82,14 @@ async def head400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head400.metadata = {"url": "/http/failure/client/400"} # type: ignore + head400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace_async - async def get400(self, **kwargs: Any) -> None: + async def get400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -119,17 +97,24 @@ async def get400(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get400_request( - template_url=self.get400.metadata["url"], + template_url=self.get400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -140,10 +125,14 @@ async def get400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get400.metadata = {"url": "/http/failure/client/400"} # type: ignore + get400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace_async - async def options400(self, **kwargs: Any) -> None: + async def options400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -151,17 +140,24 @@ async def options400(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options400_request( - template_url=self.options400.metadata["url"], + template_url=self.options400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -172,10 +168,15 @@ async def options400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - options400.metadata = {"url": "/http/failure/client/400"} # type: ignore + options400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace_async - async def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -185,26 +186,32 @@ async def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put400_request( content_type=content_type, json=_json, - template_url=self.put400.metadata["url"], + template_url=self.put400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -215,10 +222,15 @@ async def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put400.metadata = {"url": "/http/failure/client/400"} # type: ignore + put400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace_async - async def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -228,26 +240,32 @@ async def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch400_request( content_type=content_type, json=_json, - template_url=self.patch400.metadata["url"], + template_url=self.patch400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -258,10 +276,15 @@ async def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch400.metadata = {"url": "/http/failure/client/400"} # type: ignore + patch400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace_async - async def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -271,26 +294,32 @@ async def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post400_request( content_type=content_type, json=_json, - template_url=self.post400.metadata["url"], + template_url=self.post400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -301,10 +330,15 @@ async def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post400.metadata = {"url": "/http/failure/client/400"} # type: ignore + post400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace_async - async def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -314,26 +348,32 @@ async def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete400_request( content_type=content_type, json=_json, - template_url=self.delete400.metadata["url"], + template_url=self.delete400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -344,10 +384,14 @@ async def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete400.metadata = {"url": "/http/failure/client/400"} # type: ignore + delete400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace_async - async def head401(self, **kwargs: Any) -> None: + async def head401( + self, + **kwargs: Any + ) -> None: """Return 401 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -355,17 +399,24 @@ async def head401(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head401_request( - template_url=self.head401.metadata["url"], + template_url=self.head401.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -376,10 +427,14 @@ async def head401(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head401.metadata = {"url": "/http/failure/client/401"} # type: ignore + head401.metadata = {'url': '/http/failure/client/401'} # type: ignore + @distributed_trace_async - async def get402(self, **kwargs: Any) -> None: + async def get402( + self, + **kwargs: Any + ) -> None: """Return 402 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -387,17 +442,24 @@ async def get402(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get402_request( - template_url=self.get402.metadata["url"], + template_url=self.get402.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -408,10 +470,14 @@ async def get402(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get402.metadata = {"url": "/http/failure/client/402"} # type: ignore + get402.metadata = {'url': '/http/failure/client/402'} # type: ignore + @distributed_trace_async - async def options403(self, **kwargs: Any) -> None: + async def options403( + self, + **kwargs: Any + ) -> None: """Return 403 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -419,17 +485,24 @@ async def options403(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options403_request( - template_url=self.options403.metadata["url"], + template_url=self.options403.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -440,10 +513,14 @@ async def options403(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - options403.metadata = {"url": "/http/failure/client/403"} # type: ignore + options403.metadata = {'url': '/http/failure/client/403'} # type: ignore + @distributed_trace_async - async def get403(self, **kwargs: Any) -> None: + async def get403( + self, + **kwargs: Any + ) -> None: """Return 403 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -451,17 +528,24 @@ async def get403(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get403_request( - template_url=self.get403.metadata["url"], + template_url=self.get403.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -472,10 +556,15 @@ async def get403(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get403.metadata = {"url": "/http/failure/client/403"} # type: ignore + get403.metadata = {'url': '/http/failure/client/403'} # type: ignore + @distributed_trace_async - async def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put404( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 404 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -485,26 +574,32 @@ async def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put404_request( content_type=content_type, json=_json, - template_url=self.put404.metadata["url"], + template_url=self.put404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -515,10 +610,15 @@ async def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put404.metadata = {"url": "/http/failure/client/404"} # type: ignore + put404.metadata = {'url': '/http/failure/client/404'} # type: ignore + @distributed_trace_async - async def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch405( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 405 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -528,26 +628,32 @@ async def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch405_request( content_type=content_type, json=_json, - template_url=self.patch405.metadata["url"], + template_url=self.patch405.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -558,10 +664,15 @@ async def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch405.metadata = {"url": "/http/failure/client/405"} # type: ignore + patch405.metadata = {'url': '/http/failure/client/405'} # type: ignore + @distributed_trace_async - async def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post406( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 406 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -571,26 +682,32 @@ async def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post406_request( content_type=content_type, json=_json, - template_url=self.post406.metadata["url"], + template_url=self.post406.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -601,10 +718,15 @@ async def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post406.metadata = {"url": "/http/failure/client/406"} # type: ignore + post406.metadata = {'url': '/http/failure/client/406'} # type: ignore + @distributed_trace_async - async def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete407( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 407 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -614,26 +736,32 @@ async def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete407_request( content_type=content_type, json=_json, - template_url=self.delete407.metadata["url"], + template_url=self.delete407.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -644,10 +772,15 @@ async def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete407.metadata = {"url": "/http/failure/client/407"} # type: ignore + delete407.metadata = {'url': '/http/failure/client/407'} # type: ignore + @distributed_trace_async - async def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put409( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 409 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -657,26 +790,32 @@ async def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put409_request( content_type=content_type, json=_json, - template_url=self.put409.metadata["url"], + template_url=self.put409.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -687,10 +826,14 @@ async def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put409.metadata = {"url": "/http/failure/client/409"} # type: ignore + put409.metadata = {'url': '/http/failure/client/409'} # type: ignore + @distributed_trace_async - async def head410(self, **kwargs: Any) -> None: + async def head410( + self, + **kwargs: Any + ) -> None: """Return 410 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -698,17 +841,24 @@ async def head410(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head410_request( - template_url=self.head410.metadata["url"], + template_url=self.head410.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -719,10 +869,14 @@ async def head410(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head410.metadata = {"url": "/http/failure/client/410"} # type: ignore + head410.metadata = {'url': '/http/failure/client/410'} # type: ignore + @distributed_trace_async - async def get411(self, **kwargs: Any) -> None: + async def get411( + self, + **kwargs: Any + ) -> None: """Return 411 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -730,17 +884,24 @@ async def get411(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get411_request( - template_url=self.get411.metadata["url"], + template_url=self.get411.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -751,10 +912,14 @@ async def get411(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get411.metadata = {"url": "/http/failure/client/411"} # type: ignore + get411.metadata = {'url': '/http/failure/client/411'} # type: ignore + @distributed_trace_async - async def options412(self, **kwargs: Any) -> None: + async def options412( + self, + **kwargs: Any + ) -> None: """Return 412 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -762,17 +927,24 @@ async def options412(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options412_request( - template_url=self.options412.metadata["url"], + template_url=self.options412.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -783,10 +955,14 @@ async def options412(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - options412.metadata = {"url": "/http/failure/client/412"} # type: ignore + options412.metadata = {'url': '/http/failure/client/412'} # type: ignore + @distributed_trace_async - async def get412(self, **kwargs: Any) -> None: + async def get412( + self, + **kwargs: Any + ) -> None: """Return 412 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -794,17 +970,24 @@ async def get412(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get412_request( - template_url=self.get412.metadata["url"], + template_url=self.get412.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -815,10 +998,15 @@ async def get412(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get412.metadata = {"url": "/http/failure/client/412"} # type: ignore + get412.metadata = {'url': '/http/failure/client/412'} # type: ignore + @distributed_trace_async - async def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put413( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 413 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -828,26 +1016,32 @@ async def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put413_request( content_type=content_type, json=_json, - template_url=self.put413.metadata["url"], + template_url=self.put413.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -858,10 +1052,15 @@ async def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put413.metadata = {"url": "/http/failure/client/413"} # type: ignore + put413.metadata = {'url': '/http/failure/client/413'} # type: ignore + @distributed_trace_async - async def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch414( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 414 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -871,26 +1070,32 @@ async def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch414_request( content_type=content_type, json=_json, - template_url=self.patch414.metadata["url"], + template_url=self.patch414.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -901,10 +1106,15 @@ async def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch414.metadata = {"url": "/http/failure/client/414"} # type: ignore + patch414.metadata = {'url': '/http/failure/client/414'} # type: ignore + @distributed_trace_async - async def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post415( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 415 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -914,26 +1124,32 @@ async def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post415_request( content_type=content_type, json=_json, - template_url=self.post415.metadata["url"], + template_url=self.post415.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -944,10 +1160,14 @@ async def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post415.metadata = {"url": "/http/failure/client/415"} # type: ignore + post415.metadata = {'url': '/http/failure/client/415'} # type: ignore + @distributed_trace_async - async def get416(self, **kwargs: Any) -> None: + async def get416( + self, + **kwargs: Any + ) -> None: """Return 416 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -955,17 +1175,24 @@ async def get416(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get416_request( - template_url=self.get416.metadata["url"], + template_url=self.get416.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -976,10 +1203,15 @@ async def get416(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get416.metadata = {"url": "/http/failure/client/416"} # type: ignore + get416.metadata = {'url': '/http/failure/client/416'} # type: ignore + @distributed_trace_async - async def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete417( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 417 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -989,26 +1221,32 @@ async def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete417_request( content_type=content_type, json=_json, - template_url=self.delete417.metadata["url"], + template_url=self.delete417.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1019,10 +1257,14 @@ async def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete417.metadata = {"url": "/http/failure/client/417"} # type: ignore + delete417.metadata = {'url': '/http/failure/client/417'} # type: ignore + @distributed_trace_async - async def head429(self, **kwargs: Any) -> None: + async def head429( + self, + **kwargs: Any + ) -> None: """Return 429 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1030,17 +1272,24 @@ async def head429(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head429_request( - template_url=self.head429.metadata["url"], + template_url=self.head429.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1051,4 +1300,5 @@ async def head429(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head429.metadata = {"url": "/http/failure/client/429"} # type: ignore + head429.metadata = {'url': '/http/failure/client/429'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py index 937f80fea77..196298823b8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,16 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._http_failure_operations import ( - build_get_empty_error_request, - build_get_no_model_empty_request, - build_get_no_model_error_request, -) - -T = TypeVar("T") +from ...operations._http_failure_operations import build_get_empty_error_request, build_get_no_model_empty_request, build_get_no_model_error_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpFailureOperations: """HttpFailureOperations async operations. @@ -56,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_empty_error(self, **kwargs: Any) -> bool: + async def get_empty_error( + self, + **kwargs: Any + ) -> bool: """Get empty error form server. :keyword callable cls: A custom type or function that will be passed the direct response @@ -64,17 +54,24 @@ async def get_empty_error(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_error_request( - template_url=self.get_empty_error.metadata["url"], + template_url=self.get_empty_error.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -82,17 +79,21 @@ async def get_empty_error(self, **kwargs: Any) -> bool: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_error.metadata = {"url": "/http/failure/emptybody/error"} # type: ignore + get_empty_error.metadata = {'url': '/http/failure/emptybody/error'} # type: ignore + @distributed_trace_async - async def get_no_model_error(self, **kwargs: Any) -> bool: + async def get_no_model_error( + self, + **kwargs: Any + ) -> bool: """Get empty error form server. :keyword callable cls: A custom type or function that will be passed the direct response @@ -100,34 +101,45 @@ async def get_no_model_error(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_no_model_error_request( - template_url=self.get_no_model_error.metadata["url"], + template_url=self.get_no_model_error.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_no_model_error.metadata = {"url": "/http/failure/nomodel/error"} # type: ignore + get_no_model_error.metadata = {'url': '/http/failure/nomodel/error'} # type: ignore + @distributed_trace_async - async def get_no_model_empty(self, **kwargs: Any) -> bool: + async def get_no_model_empty( + self, + **kwargs: Any + ) -> bool: """Get empty response from server. :keyword callable cls: A custom type or function that will be passed the direct response @@ -135,28 +147,36 @@ async def get_no_model_empty(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_no_model_empty_request( - template_url=self.get_no_model_empty.metadata["url"], + template_url=self.get_no_model_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_no_model_empty.metadata = {"url": "/http/failure/nomodel/empty"} # type: ignore + get_no_model_empty.metadata = {'url': '/http/failure/nomodel/empty'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py index 8adf15637b3..937f47d8ff8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,29 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._http_redirects_operations import ( - build_delete307_request, - build_get300_request, - build_get301_request, - build_get302_request, - build_get307_request, - build_head300_request, - build_head301_request, - build_head302_request, - build_head307_request, - build_options307_request, - build_patch302_request, - build_patch307_request, - build_post303_request, - build_post307_request, - build_put301_request, - build_put307_request, -) - -T = TypeVar("T") +from ...operations._http_redirects_operations import build_delete307_request, build_get300_request, build_get301_request, build_get302_request, build_get307_request, build_head300_request, build_head301_request, build_head302_request, build_head307_request, build_options307_request, build_patch302_request, build_patch307_request, build_post303_request, build_post307_request, build_put301_request, build_put307_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpRedirectsOperations: """HttpRedirectsOperations async operations. @@ -69,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head300(self, **kwargs: Any) -> None: + async def head300( + self, + **kwargs: Any + ) -> None: """Return 300 status code and redirect to /http/success/200. :keyword callable cls: A custom type or function that will be passed the direct response @@ -77,17 +54,24 @@ async def head300(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head300_request( - template_url=self.head300.metadata["url"], + template_url=self.head300.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 300]: @@ -97,15 +81,20 @@ async def head300(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head300.metadata = {"url": "/http/redirect/300"} # type: ignore + head300.metadata = {'url': '/http/redirect/300'} # type: ignore + @distributed_trace_async - async def get300(self, **kwargs: Any) -> Optional[List[str]]: + async def get300( + self, + **kwargs: Any + ) -> Optional[List[str]]: """Return 300 status code and redirect to /http/success/200. :keyword callable cls: A custom type or function that will be passed the direct response @@ -113,17 +102,24 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: :rtype: list[str] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get300_request( - template_url=self.get300.metadata["url"], + template_url=self.get300.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 300]: @@ -134,19 +130,23 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: deserialized = None response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("[str]", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get300.metadata = {"url": "/http/redirect/300"} # type: ignore + get300.metadata = {'url': '/http/redirect/300'} # type: ignore + @distributed_trace_async - async def head301(self, **kwargs: Any) -> None: + async def head301( + self, + **kwargs: Any + ) -> None: """Return 301 status code and redirect to /http/success/200. :keyword callable cls: A custom type or function that will be passed the direct response @@ -154,17 +154,24 @@ async def head301(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head301_request( - template_url=self.head301.metadata["url"], + template_url=self.head301.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 301]: @@ -174,15 +181,20 @@ async def head301(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head301.metadata = {"url": "/http/redirect/301"} # type: ignore + head301.metadata = {'url': '/http/redirect/301'} # type: ignore + @distributed_trace_async - async def get301(self, **kwargs: Any) -> None: + async def get301( + self, + **kwargs: Any + ) -> None: """Return 301 status code and redirect to /http/success/200. :keyword callable cls: A custom type or function that will be passed the direct response @@ -190,17 +202,24 @@ async def get301(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get301_request( - template_url=self.get301.metadata["url"], + template_url=self.get301.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 301]: @@ -210,15 +229,21 @@ async def get301(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - get301.metadata = {"url": "/http/redirect/301"} # type: ignore + get301.metadata = {'url': '/http/redirect/301'} # type: ignore + @distributed_trace_async - async def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put301( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 to the caller for evaluation. @@ -229,26 +254,32 @@ async def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put301_request( content_type=content_type, json=_json, - template_url=self.put301.metadata["url"], + template_url=self.put301.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [301]: @@ -257,15 +288,20 @@ async def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - put301.metadata = {"url": "/http/redirect/301"} # type: ignore + put301.metadata = {'url': '/http/redirect/301'} # type: ignore + @distributed_trace_async - async def head302(self, **kwargs: Any) -> None: + async def head302( + self, + **kwargs: Any + ) -> None: """Return 302 status code and redirect to /http/success/200. :keyword callable cls: A custom type or function that will be passed the direct response @@ -273,17 +309,24 @@ async def head302(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head302_request( - template_url=self.head302.metadata["url"], + template_url=self.head302.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 302]: @@ -293,15 +336,20 @@ async def head302(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head302.metadata = {"url": "/http/redirect/302"} # type: ignore + head302.metadata = {'url': '/http/redirect/302'} # type: ignore + @distributed_trace_async - async def get302(self, **kwargs: Any) -> None: + async def get302( + self, + **kwargs: Any + ) -> None: """Return 302 status code and redirect to /http/success/200. :keyword callable cls: A custom type or function that will be passed the direct response @@ -309,17 +357,24 @@ async def get302(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get302_request( - template_url=self.get302.metadata["url"], + template_url=self.get302.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 302]: @@ -329,15 +384,21 @@ async def get302(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - get302.metadata = {"url": "/http/redirect/302"} # type: ignore + get302.metadata = {'url': '/http/redirect/302'} # type: ignore + @distributed_trace_async - async def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch302( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation. @@ -348,26 +409,32 @@ async def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch302_request( content_type=content_type, json=_json, - template_url=self.patch302.metadata["url"], + template_url=self.patch302.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [302]: @@ -376,15 +443,21 @@ async def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - patch302.metadata = {"url": "/http/redirect/302"} # type: ignore + patch302.metadata = {'url': '/http/redirect/302'} # type: ignore + @distributed_trace_async - async def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post303( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code. @@ -395,26 +468,32 @@ async def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post303_request( content_type=content_type, json=_json, - template_url=self.post303.metadata["url"], + template_url=self.post303.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 303]: @@ -424,15 +503,20 @@ async def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> response_headers = {} if response.status_code == 303: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - post303.metadata = {"url": "/http/redirect/303"} # type: ignore + post303.metadata = {'url': '/http/redirect/303'} # type: ignore + @distributed_trace_async - async def head307(self, **kwargs: Any) -> None: + async def head307( + self, + **kwargs: Any + ) -> None: """Redirect with 307, resulting in a 200 success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -440,17 +524,24 @@ async def head307(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head307_request( - template_url=self.head307.metadata["url"], + template_url=self.head307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -460,15 +551,20 @@ async def head307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head307.metadata = {"url": "/http/redirect/307"} # type: ignore + head307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace_async - async def get307(self, **kwargs: Any) -> None: + async def get307( + self, + **kwargs: Any + ) -> None: """Redirect get with 307, resulting in a 200 success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -476,17 +572,24 @@ async def get307(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get307_request( - template_url=self.get307.metadata["url"], + template_url=self.get307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -496,15 +599,20 @@ async def get307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - get307.metadata = {"url": "/http/redirect/307"} # type: ignore + get307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace_async - async def options307(self, **kwargs: Any) -> None: + async def options307( + self, + **kwargs: Any + ) -> None: """options redirected with 307, resulting in a 200 after redirect. :keyword callable cls: A custom type or function that will be passed the direct response @@ -512,17 +620,24 @@ async def options307(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options307_request( - template_url=self.options307.metadata["url"], + template_url=self.options307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -532,15 +647,21 @@ async def options307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - options307.metadata = {"url": "/http/redirect/307"} # type: ignore + options307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace_async - async def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -550,26 +671,32 @@ async def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put307_request( content_type=content_type, json=_json, - template_url=self.put307.metadata["url"], + template_url=self.put307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -579,15 +706,21 @@ async def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - put307.metadata = {"url": "/http/redirect/307"} # type: ignore + put307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace_async - async def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -597,26 +730,32 @@ async def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch307_request( content_type=content_type, json=_json, - template_url=self.patch307.metadata["url"], + template_url=self.patch307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -626,15 +765,21 @@ async def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - patch307.metadata = {"url": "/http/redirect/307"} # type: ignore + patch307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace_async - async def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -644,26 +789,32 @@ async def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post307_request( content_type=content_type, json=_json, - template_url=self.post307.metadata["url"], + template_url=self.post307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -673,15 +824,21 @@ async def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - post307.metadata = {"url": "/http/redirect/307"} # type: ignore + post307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace_async - async def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -691,26 +848,32 @@ async def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete307_request( content_type=content_type, json=_json, - template_url=self.delete307.metadata["url"], + template_url=self.delete307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -720,9 +883,11 @@ async def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) - response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - delete307.metadata = {"url": "/http/redirect/307"} # type: ignore + delete307.metadata = {'url': '/http/redirect/307'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py index 8c890e4d548..3a3803782b1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,22 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._http_retry_operations import ( - build_delete503_request, - build_get502_request, - build_head408_request, - build_options502_request, - build_patch500_request, - build_patch504_request, - build_post503_request, - build_put500_request, - build_put504_request, -) - -T = TypeVar("T") +from ...operations._http_retry_operations import build_delete503_request, build_get502_request, build_head408_request, build_options502_request, build_patch500_request, build_patch504_request, build_post503_request, build_put500_request, build_put504_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpRetryOperations: """HttpRetryOperations async operations. @@ -62,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head408(self, **kwargs: Any) -> None: + async def head408( + self, + **kwargs: Any + ) -> None: """Return 408 status code, then 200 after retry. :keyword callable cls: A custom type or function that will be passed the direct response @@ -70,17 +54,24 @@ async def head408(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head408_request( - template_url=self.head408.metadata["url"], + template_url=self.head408.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -91,10 +82,15 @@ async def head408(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head408.metadata = {"url": "/http/retry/408"} # type: ignore + head408.metadata = {'url': '/http/retry/408'} # type: ignore + @distributed_trace_async - async def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put500( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 500 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -104,26 +100,32 @@ async def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put500_request( content_type=content_type, json=_json, - template_url=self.put500.metadata["url"], + template_url=self.put500.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -134,10 +136,15 @@ async def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put500.metadata = {"url": "/http/retry/500"} # type: ignore + put500.metadata = {'url': '/http/retry/500'} # type: ignore + @distributed_trace_async - async def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch500( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 500 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -147,26 +154,32 @@ async def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch500_request( content_type=content_type, json=_json, - template_url=self.patch500.metadata["url"], + template_url=self.patch500.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,10 +190,14 @@ async def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch500.metadata = {"url": "/http/retry/500"} # type: ignore + patch500.metadata = {'url': '/http/retry/500'} # type: ignore + @distributed_trace_async - async def get502(self, **kwargs: Any) -> None: + async def get502( + self, + **kwargs: Any + ) -> None: """Return 502 status code, then 200 after retry. :keyword callable cls: A custom type or function that will be passed the direct response @@ -188,17 +205,24 @@ async def get502(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get502_request( - template_url=self.get502.metadata["url"], + template_url=self.get502.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,10 +233,14 @@ async def get502(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get502.metadata = {"url": "/http/retry/502"} # type: ignore + get502.metadata = {'url': '/http/retry/502'} # type: ignore + @distributed_trace_async - async def options502(self, **kwargs: Any) -> bool: + async def options502( + self, + **kwargs: Any + ) -> bool: """Return 502 status code, then 200 after retry. :keyword callable cls: A custom type or function that will be passed the direct response @@ -220,17 +248,24 @@ async def options502(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options502_request( - template_url=self.options502.metadata["url"], + template_url=self.options502.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -238,17 +273,22 @@ async def options502(self, **kwargs: Any) -> bool: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - options502.metadata = {"url": "/http/retry/502"} # type: ignore + options502.metadata = {'url': '/http/retry/502'} # type: ignore + @distributed_trace_async - async def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post503( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 503 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -258,26 +298,32 @@ async def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post503_request( content_type=content_type, json=_json, - template_url=self.post503.metadata["url"], + template_url=self.post503.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -288,10 +334,15 @@ async def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post503.metadata = {"url": "/http/retry/503"} # type: ignore + post503.metadata = {'url': '/http/retry/503'} # type: ignore + @distributed_trace_async - async def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete503( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 503 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -301,26 +352,32 @@ async def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete503_request( content_type=content_type, json=_json, - template_url=self.delete503.metadata["url"], + template_url=self.delete503.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -331,10 +388,15 @@ async def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete503.metadata = {"url": "/http/retry/503"} # type: ignore + delete503.metadata = {'url': '/http/retry/503'} # type: ignore + @distributed_trace_async - async def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put504( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 504 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -344,26 +406,32 @@ async def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put504_request( content_type=content_type, json=_json, - template_url=self.put504.metadata["url"], + template_url=self.put504.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -374,10 +442,15 @@ async def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put504.metadata = {"url": "/http/retry/504"} # type: ignore + put504.metadata = {'url': '/http/retry/504'} # type: ignore + @distributed_trace_async - async def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch504( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 504 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -387,26 +460,32 @@ async def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch504_request( content_type=content_type, json=_json, - template_url=self.patch504.metadata["url"], + template_url=self.patch504.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -417,4 +496,5 @@ async def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch504.metadata = {"url": "/http/retry/504"} # type: ignore + patch504.metadata = {'url': '/http/retry/504'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py index 8a1ce204cc3..b9711c6bd88 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,17 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._http_server_failure_operations import ( - build_delete505_request, - build_get501_request, - build_head501_request, - build_post505_request, -) - -T = TypeVar("T") +from ...operations._http_server_failure_operations import build_delete505_request, build_get501_request, build_head501_request, build_post505_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpServerFailureOperations: """HttpServerFailureOperations async operations. @@ -57,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head501(self, **kwargs: Any) -> None: + async def head501( + self, + **kwargs: Any + ) -> None: """Return 501 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -65,17 +54,24 @@ async def head501(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head501_request( - template_url=self.head501.metadata["url"], + template_url=self.head501.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -86,10 +82,14 @@ async def head501(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head501.metadata = {"url": "/http/failure/server/501"} # type: ignore + head501.metadata = {'url': '/http/failure/server/501'} # type: ignore + @distributed_trace_async - async def get501(self, **kwargs: Any) -> None: + async def get501( + self, + **kwargs: Any + ) -> None: """Return 501 status code - should be represented in the client as an error. :keyword callable cls: A custom type or function that will be passed the direct response @@ -97,17 +97,24 @@ async def get501(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get501_request( - template_url=self.get501.metadata["url"], + template_url=self.get501.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -118,10 +125,15 @@ async def get501(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get501.metadata = {"url": "/http/failure/server/501"} # type: ignore + get501.metadata = {'url': '/http/failure/server/501'} # type: ignore + @distributed_trace_async - async def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post505( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 505 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -131,26 +143,32 @@ async def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post505_request( content_type=content_type, json=_json, - template_url=self.post505.metadata["url"], + template_url=self.post505.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -161,10 +179,15 @@ async def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post505.metadata = {"url": "/http/failure/server/505"} # type: ignore + post505.metadata = {'url': '/http/failure/server/505'} # type: ignore + @distributed_trace_async - async def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete505( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 505 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -174,26 +197,32 @@ async def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete505_request( content_type=content_type, json=_json, - template_url=self.delete505.metadata["url"], + template_url=self.delete505.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -204,4 +233,5 @@ async def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete505.metadata = {"url": "/http/failure/server/505"} # type: ignore + delete505.metadata = {'url': '/http/failure/server/505'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py index b0642ca8e5e..ed204115463 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,32 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._http_success_operations import ( - build_delete200_request, - build_delete202_request, - build_delete204_request, - build_get200_request, - build_head200_request, - build_head204_request, - build_head404_request, - build_options200_request, - build_patch200_request, - build_patch202_request, - build_patch204_request, - build_post200_request, - build_post201_request, - build_post202_request, - build_post204_request, - build_put200_request, - build_put201_request, - build_put202_request, - build_put204_request, -) - -T = TypeVar("T") +from ...operations._http_success_operations import build_delete200_request, build_delete202_request, build_delete204_request, build_get200_request, build_head200_request, build_head204_request, build_head404_request, build_options200_request, build_patch200_request, build_patch202_request, build_patch204_request, build_post200_request, build_post201_request, build_post202_request, build_post204_request, build_put200_request, build_put201_request, build_put202_request, build_put204_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpSuccessOperations: """HttpSuccessOperations async operations. @@ -72,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head200(self, **kwargs: Any) -> None: + async def head200( + self, + **kwargs: Any + ) -> None: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -80,17 +54,24 @@ async def head200(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,10 +82,14 @@ async def head200(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def get200(self, **kwargs: Any) -> bool: + async def get200( + self, + **kwargs: Any + ) -> bool: """Get 200 success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -112,17 +97,24 @@ async def get200(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_request( - template_url=self.get200.metadata["url"], + template_url=self.get200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,17 +122,21 @@ async def get200(self, **kwargs: Any) -> bool: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200.metadata = {"url": "/http/success/200"} # type: ignore + get200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def options200(self, **kwargs: Any) -> bool: + async def options200( + self, + **kwargs: Any + ) -> bool: """Options 200 success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -148,17 +144,24 @@ async def options200(self, **kwargs: Any) -> bool: :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options200_request( - template_url=self.options200.metadata["url"], + template_url=self.options200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -166,17 +169,22 @@ async def options200(self, **kwargs: Any) -> bool: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - options200.metadata = {"url": "/http/success/200"} # type: ignore + options200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put boolean value true returning 200 success. :param boolean_value: Simple boolean value true. The default value is True. @@ -186,26 +194,32 @@ async def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put200_request( content_type=content_type, json=_json, - template_url=self.put200.metadata["url"], + template_url=self.put200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -216,10 +230,15 @@ async def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put200.metadata = {"url": "/http/success/200"} # type: ignore + put200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returning 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -229,26 +248,32 @@ async def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch200_request( content_type=content_type, json=_json, - template_url=self.patch200.metadata["url"], + template_url=self.patch200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -259,10 +284,15 @@ async def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch200.metadata = {"url": "/http/success/200"} # type: ignore + patch200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post bollean value true in request that returns a 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -272,26 +302,32 @@ async def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post200_request( content_type=content_type, json=_json, - template_url=self.post200.metadata["url"], + template_url=self.post200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -302,10 +338,15 @@ async def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post200.metadata = {"url": "/http/success/200"} # type: ignore + post200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete simple boolean value true returns 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -315,26 +356,32 @@ async def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete200_request( content_type=content_type, json=_json, - template_url=self.delete200.metadata["url"], + template_url=self.delete200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -345,10 +392,15 @@ async def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete200.metadata = {"url": "/http/success/200"} # type: ignore + delete200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace_async - async def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put201( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 201. :param boolean_value: Simple boolean value true. The default value is True. @@ -358,26 +410,32 @@ async def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put201_request( content_type=content_type, json=_json, - template_url=self.put201.metadata["url"], + template_url=self.put201.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -388,10 +446,15 @@ async def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put201.metadata = {"url": "/http/success/201"} # type: ignore + put201.metadata = {'url': '/http/success/201'} # type: ignore + @distributed_trace_async - async def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post201( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 201 (Created). :param boolean_value: Simple boolean value true. The default value is True. @@ -401,26 +464,32 @@ async def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post201_request( content_type=content_type, json=_json, - template_url=self.post201.metadata["url"], + template_url=self.post201.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -431,10 +500,15 @@ async def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post201.metadata = {"url": "/http/success/201"} # type: ignore + post201.metadata = {'url': '/http/success/201'} # type: ignore + @distributed_trace_async - async def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 202 (Accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -444,26 +518,32 @@ async def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put202_request( content_type=content_type, json=_json, - template_url=self.put202.metadata["url"], + template_url=self.put202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -474,10 +554,15 @@ async def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put202.metadata = {"url": "/http/success/202"} # type: ignore + put202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace_async - async def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 202. :param boolean_value: Simple boolean value true. The default value is True. @@ -487,26 +572,32 @@ async def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch202_request( content_type=content_type, json=_json, - template_url=self.patch202.metadata["url"], + template_url=self.patch202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -517,10 +608,15 @@ async def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch202.metadata = {"url": "/http/success/202"} # type: ignore + patch202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace_async - async def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 202 (Accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -530,26 +626,32 @@ async def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post202_request( content_type=content_type, json=_json, - template_url=self.post202.metadata["url"], + template_url=self.post202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -560,10 +662,15 @@ async def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post202.metadata = {"url": "/http/success/202"} # type: ignore + post202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace_async - async def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete true Boolean value in request returns 202 (accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -573,26 +680,32 @@ async def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete202_request( content_type=content_type, json=_json, - template_url=self.delete202.metadata["url"], + template_url=self.delete202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -603,10 +716,14 @@ async def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete202.metadata = {"url": "/http/success/202"} # type: ignore + delete202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace_async - async def head204(self, **kwargs: Any) -> None: + async def head204( + self, + **kwargs: Any + ) -> None: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -614,17 +731,24 @@ async def head204(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -635,10 +759,15 @@ async def head204(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -648,26 +777,32 @@ async def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put204_request( content_type=content_type, json=_json, - template_url=self.put204.metadata["url"], + template_url=self.put204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -678,10 +813,15 @@ async def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put204.metadata = {"url": "/http/success/204"} # type: ignore + put204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -691,26 +831,32 @@ async def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch204_request( content_type=content_type, json=_json, - template_url=self.patch204.metadata["url"], + template_url=self.patch204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -721,10 +867,15 @@ async def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - patch204.metadata = {"url": "/http/success/204"} # type: ignore + patch204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -734,26 +885,32 @@ async def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post204_request( content_type=content_type, json=_json, - template_url=self.post204.metadata["url"], + template_url=self.post204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -764,10 +921,15 @@ async def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post204.metadata = {"url": "/http/success/204"} # type: ignore + post204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -777,26 +939,32 @@ async def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete204_request( content_type=content_type, json=_json, - template_url=self.delete204.metadata["url"], + template_url=self.delete204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -807,10 +975,14 @@ async def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - delete204.metadata = {"url": "/http/success/204"} # type: ignore + delete204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace_async - async def head404(self, **kwargs: Any) -> None: + async def head404( + self, + **kwargs: Any + ) -> None: """Return 404 status code. :keyword callable cls: A custom type or function that will be passed the direct response @@ -818,17 +990,24 @@ async def head404(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -839,4 +1018,5 @@ async def head404(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py index ba3194b5c4b..6cc5bcb653f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,48 +16,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._multiple_responses_operations import ( - build_get200_model201_model_default_error200_valid_request, - build_get200_model201_model_default_error201_valid_request, - build_get200_model201_model_default_error400_valid_request, - build_get200_model204_no_model_default_error200_valid_request, - build_get200_model204_no_model_default_error201_invalid_request, - build_get200_model204_no_model_default_error202_none_request, - build_get200_model204_no_model_default_error204_valid_request, - build_get200_model204_no_model_default_error400_valid_request, - build_get200_model_a200_invalid_request, - build_get200_model_a200_none_request, - build_get200_model_a200_valid_request, - build_get200_model_a201_model_c404_model_d_default_error200_valid_request, - build_get200_model_a201_model_c404_model_d_default_error201_valid_request, - build_get200_model_a201_model_c404_model_d_default_error400_valid_request, - build_get200_model_a201_model_c404_model_d_default_error404_valid_request, - build_get200_model_a202_valid_request, - build_get200_model_a400_invalid_request, - build_get200_model_a400_none_request, - build_get200_model_a400_valid_request, - build_get202_none204_none_default_error202_none_request, - build_get202_none204_none_default_error204_none_request, - build_get202_none204_none_default_error400_valid_request, - build_get202_none204_none_default_none202_invalid_request, - build_get202_none204_none_default_none204_none_request, - build_get202_none204_none_default_none400_invalid_request, - build_get202_none204_none_default_none400_none_request, - build_get_default_model_a200_none_request, - build_get_default_model_a200_valid_request, - build_get_default_model_a400_none_request, - build_get_default_model_a400_valid_request, - build_get_default_none200_invalid_request, - build_get_default_none200_none_request, - build_get_default_none400_invalid_request, - build_get_default_none400_none_request, -) - -T = TypeVar("T") +from ...operations._multiple_responses_operations import build_get200_model201_model_default_error200_valid_request, build_get200_model201_model_default_error201_valid_request, build_get200_model201_model_default_error400_valid_request, build_get200_model204_no_model_default_error200_valid_request, build_get200_model204_no_model_default_error201_invalid_request, build_get200_model204_no_model_default_error202_none_request, build_get200_model204_no_model_default_error204_valid_request, build_get200_model204_no_model_default_error400_valid_request, build_get200_model_a200_invalid_request, build_get200_model_a200_none_request, build_get200_model_a200_valid_request, build_get200_model_a201_model_c404_model_d_default_error200_valid_request, build_get200_model_a201_model_c404_model_d_default_error201_valid_request, build_get200_model_a201_model_c404_model_d_default_error400_valid_request, build_get200_model_a201_model_c404_model_d_default_error404_valid_request, build_get200_model_a202_valid_request, build_get200_model_a400_invalid_request, build_get200_model_a400_none_request, build_get200_model_a400_valid_request, build_get202_none204_none_default_error202_none_request, build_get202_none204_none_default_error204_none_request, build_get202_none204_none_default_error400_valid_request, build_get202_none204_none_default_none202_invalid_request, build_get202_none204_none_default_none204_none_request, build_get202_none204_none_default_none400_invalid_request, build_get202_none204_none_default_none400_none_request, build_get_default_model_a200_none_request, build_get_default_model_a200_valid_request, build_get_default_model_a400_none_request, build_get_default_model_a400_valid_request, build_get_default_none200_invalid_request, build_get_default_none200_none_request, build_get_default_none400_invalid_request, build_get_default_none400_none_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MultipleResponsesOperations: +class MultipleResponsesOperations: # pylint: disable=too-many-public-methods """MultipleResponsesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -87,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) -> Optional["_models.MyException"]: + async def get200_model204_no_model_default_error200_valid( + self, + **kwargs: Any + ) -> Optional["_models.MyException"]: """Send a 200 response with valid payload: {'statusCode': '200'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -95,17 +54,24 @@ async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) - :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error200_valid_request( - template_url=self.get200_model204_no_model_default_error200_valid.metadata["url"], + template_url=self.get200_model204_no_model_default_error200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -115,17 +81,21 @@ async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error200_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/200/valid"} # type: ignore + get200_model204_no_model_default_error200_valid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/200/valid'} # type: ignore + @distributed_trace_async - async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) -> Optional["_models.MyException"]: + async def get200_model204_no_model_default_error204_valid( + self, + **kwargs: Any + ) -> Optional["_models.MyException"]: """Send a 204 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -133,17 +103,24 @@ async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) - :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error204_valid_request( - template_url=self.get200_model204_no_model_default_error204_valid.metadata["url"], + template_url=self.get200_model204_no_model_default_error204_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -153,17 +130,21 @@ async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error204_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/204/none"} # type: ignore + get200_model204_no_model_default_error204_valid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/204/none'} # type: ignore + @distributed_trace_async - async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) -> Optional["_models.MyException"]: + async def get200_model204_no_model_default_error201_invalid( + self, + **kwargs: Any + ) -> Optional["_models.MyException"]: """Send a 201 response with valid payload: {'statusCode': '201'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -171,17 +152,24 @@ async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error201_invalid_request( - template_url=self.get200_model204_no_model_default_error201_invalid.metadata["url"], + template_url=self.get200_model204_no_model_default_error201_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -191,17 +179,21 @@ async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error201_invalid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/201/valid"} # type: ignore + get200_model204_no_model_default_error201_invalid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/201/valid'} # type: ignore + @distributed_trace_async - async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> Optional["_models.MyException"]: + async def get200_model204_no_model_default_error202_none( + self, + **kwargs: Any + ) -> Optional["_models.MyException"]: """Send a 202 response with no payload:. :keyword callable cls: A custom type or function that will be passed the direct response @@ -209,17 +201,24 @@ async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error202_none_request( - template_url=self.get200_model204_no_model_default_error202_none.metadata["url"], + template_url=self.get200_model204_no_model_default_error202_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -229,17 +228,21 @@ async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error202_none.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/202/none"} # type: ignore + get200_model204_no_model_default_error202_none.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/202/none'} # type: ignore + @distributed_trace_async - async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) -> Optional["_models.MyException"]: + async def get200_model204_no_model_default_error400_valid( + self, + **kwargs: Any + ) -> Optional["_models.MyException"]: """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -247,17 +250,24 @@ async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) - :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error400_valid_request( - template_url=self.get200_model204_no_model_default_error400_valid.metadata["url"], + template_url=self.get200_model204_no_model_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -267,18 +277,20 @@ async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error400_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/400/valid"} # type: ignore + get200_model204_no_model_default_error400_valid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/400/valid'} # type: ignore + @distributed_trace_async async def get200_model201_model_default_error200_valid( - self, **kwargs: Any + self, + **kwargs: Any ) -> Union["_models.MyException", "_models.B"]: """Send a 200 response with valid payload: {'statusCode': '200'}. @@ -287,17 +299,24 @@ async def get200_model201_model_default_error200_valid( :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.B"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.B"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model201_model_default_error200_valid_request( - template_url=self.get200_model201_model_default_error200_valid.metadata["url"], + template_url=self.get200_model201_model_default_error200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -306,21 +325,23 @@ async def get200_model201_model_default_error200_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("B", pipeline_response) + deserialized = self._deserialize('B', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model201_model_default_error200_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/200/valid"} # type: ignore + get200_model201_model_default_error200_valid.metadata = {'url': '/http/payloads/200/A/201/B/default/Error/response/200/valid'} # type: ignore + @distributed_trace_async async def get200_model201_model_default_error201_valid( - self, **kwargs: Any + self, + **kwargs: Any ) -> Union["_models.MyException", "_models.B"]: """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. @@ -329,17 +350,24 @@ async def get200_model201_model_default_error201_valid( :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.B"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.B"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model201_model_default_error201_valid_request( - template_url=self.get200_model201_model_default_error201_valid.metadata["url"], + template_url=self.get200_model201_model_default_error201_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -348,21 +376,23 @@ async def get200_model201_model_default_error201_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("B", pipeline_response) + deserialized = self._deserialize('B', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model201_model_default_error201_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/201/valid"} # type: ignore + get200_model201_model_default_error201_valid.metadata = {'url': '/http/payloads/200/A/201/B/default/Error/response/201/valid'} # type: ignore + @distributed_trace_async async def get200_model201_model_default_error400_valid( - self, **kwargs: Any + self, + **kwargs: Any ) -> Union["_models.MyException", "_models.B"]: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. @@ -371,17 +401,24 @@ async def get200_model201_model_default_error400_valid( :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.B"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.B"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model201_model_default_error400_valid_request( - template_url=self.get200_model201_model_default_error400_valid.metadata["url"], + template_url=self.get200_model201_model_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -390,21 +427,23 @@ async def get200_model201_model_default_error400_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("B", pipeline_response) + deserialized = self._deserialize('B', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model201_model_default_error400_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/400/valid"} # type: ignore + get200_model201_model_default_error400_valid.metadata = {'url': '/http/payloads/200/A/201/B/default/Error/response/400/valid'} # type: ignore + @distributed_trace_async async def get200_model_a201_model_c404_model_d_default_error200_valid( - self, **kwargs: Any + self, + **kwargs: Any ) -> Union["_models.MyException", "_models.C", "_models.D"]: """Send a 200 response with valid payload: {'statusCode': '200'}. @@ -414,17 +453,24 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error200_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error200_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -433,24 +479,26 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error200_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error200_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid'} # type: ignore + @distributed_trace_async async def get200_model_a201_model_c404_model_d_default_error201_valid( - self, **kwargs: Any + self, + **kwargs: Any ) -> Union["_models.MyException", "_models.C", "_models.D"]: """Send a 200 response with valid payload: {'httpCode': '201'}. @@ -460,17 +508,24 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error201_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error201_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error201_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -479,24 +534,26 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error201_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error201_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid'} # type: ignore + @distributed_trace_async async def get200_model_a201_model_c404_model_d_default_error404_valid( - self, **kwargs: Any + self, + **kwargs: Any ) -> Union["_models.MyException", "_models.C", "_models.D"]: """Send a 200 response with valid payload: {'httpStatusCode': '404'}. @@ -506,17 +563,24 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error404_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error404_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error404_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -525,24 +589,26 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error404_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error404_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid'} # type: ignore + @distributed_trace_async async def get200_model_a201_model_c404_model_d_default_error400_valid( - self, **kwargs: Any + self, + **kwargs: Any ) -> Union["_models.MyException", "_models.C", "_models.D"]: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. @@ -552,17 +618,24 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error400_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error400_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -571,23 +644,27 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error400_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error400_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid'} # type: ignore + @distributed_trace_async - async def get202_none204_none_default_error202_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_error202_none( + self, + **kwargs: Any + ) -> None: """Send a 202 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -595,17 +672,24 @@ async def get202_none204_none_default_error202_none(self, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_error202_none_request( - template_url=self.get202_none204_none_default_error202_none.metadata["url"], + template_url=self.get202_none204_none_default_error202_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -616,10 +700,14 @@ async def get202_none204_none_default_error202_none(self, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_error202_none.metadata = {"url": "/http/payloads/202/none/204/none/default/Error/response/202/none"} # type: ignore + get202_none204_none_default_error202_none.metadata = {'url': '/http/payloads/202/none/204/none/default/Error/response/202/none'} # type: ignore + @distributed_trace_async - async def get202_none204_none_default_error204_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_error204_none( + self, + **kwargs: Any + ) -> None: """Send a 204 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -627,17 +715,24 @@ async def get202_none204_none_default_error204_none(self, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_error204_none_request( - template_url=self.get202_none204_none_default_error204_none.metadata["url"], + template_url=self.get202_none204_none_default_error204_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -648,10 +743,14 @@ async def get202_none204_none_default_error204_none(self, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_error204_none.metadata = {"url": "/http/payloads/202/none/204/none/default/Error/response/204/none"} # type: ignore + get202_none204_none_default_error204_none.metadata = {'url': '/http/payloads/202/none/204/none/default/Error/response/204/none'} # type: ignore + @distributed_trace_async - async def get202_none204_none_default_error400_valid(self, **kwargs: Any) -> None: + async def get202_none204_none_default_error400_valid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -659,17 +758,24 @@ async def get202_none204_none_default_error400_valid(self, **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_error400_valid_request( - template_url=self.get202_none204_none_default_error400_valid.metadata["url"], + template_url=self.get202_none204_none_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -680,10 +786,14 @@ async def get202_none204_none_default_error400_valid(self, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_error400_valid.metadata = {"url": "/http/payloads/202/none/204/none/default/Error/response/400/valid"} # type: ignore + get202_none204_none_default_error400_valid.metadata = {'url': '/http/payloads/202/none/204/none/default/Error/response/400/valid'} # type: ignore + @distributed_trace_async - async def get202_none204_none_default_none202_invalid(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none202_invalid( + self, + **kwargs: Any + ) -> None: """Send a 202 response with an unexpected payload {'property': 'value'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -691,17 +801,24 @@ async def get202_none204_none_default_none202_invalid(self, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none202_invalid_request( - template_url=self.get202_none204_none_default_none202_invalid.metadata["url"], + template_url=self.get202_none204_none_default_none202_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -711,10 +828,14 @@ async def get202_none204_none_default_none202_invalid(self, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none202_invalid.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/202/invalid"} # type: ignore + get202_none204_none_default_none202_invalid.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/202/invalid'} # type: ignore + @distributed_trace_async - async def get202_none204_none_default_none204_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none204_none( + self, + **kwargs: Any + ) -> None: """Send a 204 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -722,17 +843,24 @@ async def get202_none204_none_default_none204_none(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none204_none_request( - template_url=self.get202_none204_none_default_none204_none.metadata["url"], + template_url=self.get202_none204_none_default_none204_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -742,10 +870,14 @@ async def get202_none204_none_default_none204_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none204_none.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/204/none"} # type: ignore + get202_none204_none_default_none204_none.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/204/none'} # type: ignore + @distributed_trace_async - async def get202_none204_none_default_none400_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -753,17 +885,24 @@ async def get202_none204_none_default_none400_none(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none400_none_request( - template_url=self.get202_none204_none_default_none400_none.metadata["url"], + template_url=self.get202_none204_none_default_none400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -773,10 +912,14 @@ async def get202_none204_none_default_none400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none400_none.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/400/none"} # type: ignore + get202_none204_none_default_none400_none.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/400/none'} # type: ignore + @distributed_trace_async - async def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none400_invalid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with an unexpected payload {'property': 'value'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -784,17 +927,24 @@ async def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none400_invalid_request( - template_url=self.get202_none204_none_default_none400_invalid.metadata["url"], + template_url=self.get202_none204_none_default_none400_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -804,10 +954,14 @@ async def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none400_invalid.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/400/invalid"} # type: ignore + get202_none204_none_default_none400_invalid.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/400/invalid'} # type: ignore + @distributed_trace_async - async def get_default_model_a200_valid(self, **kwargs: Any) -> "_models.MyException": + async def get_default_model_a200_valid( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 200 response with valid payload: {'statusCode': '200'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -815,34 +969,45 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> "_models.MyExcept :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a200_valid_request( - template_url=self.get_default_model_a200_valid.metadata["url"], + template_url=self.get_default_model_a200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_default_model_a200_valid.metadata = {"url": "/http/payloads/default/A/response/200/valid"} # type: ignore + get_default_model_a200_valid.metadata = {'url': '/http/payloads/default/A/response/200/valid'} # type: ignore + @distributed_trace_async - async def get_default_model_a200_none(self, **kwargs: Any) -> "_models.MyException": + async def get_default_model_a200_none( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 200 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -850,34 +1015,45 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> "_models.MyExcepti :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a200_none_request( - template_url=self.get_default_model_a200_none.metadata["url"], + template_url=self.get_default_model_a200_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_default_model_a200_none.metadata = {"url": "/http/payloads/default/A/response/200/none"} # type: ignore + get_default_model_a200_none.metadata = {'url': '/http/payloads/default/A/response/200/none'} # type: ignore + @distributed_trace_async - async def get_default_model_a400_valid(self, **kwargs: Any) -> None: + async def get_default_model_a400_valid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'statusCode': '400'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -885,17 +1061,24 @@ async def get_default_model_a400_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a400_valid_request( - template_url=self.get_default_model_a400_valid.metadata["url"], + template_url=self.get_default_model_a400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -906,10 +1089,14 @@ async def get_default_model_a400_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_default_model_a400_valid.metadata = {"url": "/http/payloads/default/A/response/400/valid"} # type: ignore + get_default_model_a400_valid.metadata = {'url': '/http/payloads/default/A/response/400/valid'} # type: ignore + @distributed_trace_async - async def get_default_model_a400_none(self, **kwargs: Any) -> None: + async def get_default_model_a400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -917,17 +1104,24 @@ async def get_default_model_a400_none(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a400_none_request( - template_url=self.get_default_model_a400_none.metadata["url"], + template_url=self.get_default_model_a400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -938,10 +1132,14 @@ async def get_default_model_a400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_default_model_a400_none.metadata = {"url": "/http/payloads/default/A/response/400/none"} # type: ignore + get_default_model_a400_none.metadata = {'url': '/http/payloads/default/A/response/400/none'} # type: ignore + @distributed_trace_async - async def get_default_none200_invalid(self, **kwargs: Any) -> None: + async def get_default_none200_invalid( + self, + **kwargs: Any + ) -> None: """Send a 200 response with invalid payload: {'statusCode': '200'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -949,17 +1147,24 @@ async def get_default_none200_invalid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none200_invalid_request( - template_url=self.get_default_none200_invalid.metadata["url"], + template_url=self.get_default_none200_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -969,10 +1174,14 @@ async def get_default_none200_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_default_none200_invalid.metadata = {"url": "/http/payloads/default/none/response/200/invalid"} # type: ignore + get_default_none200_invalid.metadata = {'url': '/http/payloads/default/none/response/200/invalid'} # type: ignore + @distributed_trace_async - async def get_default_none200_none(self, **kwargs: Any) -> None: + async def get_default_none200_none( + self, + **kwargs: Any + ) -> None: """Send a 200 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -980,17 +1189,24 @@ async def get_default_none200_none(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none200_none_request( - template_url=self.get_default_none200_none.metadata["url"], + template_url=self.get_default_none200_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1000,10 +1216,14 @@ async def get_default_none200_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_default_none200_none.metadata = {"url": "/http/payloads/default/none/response/200/none"} # type: ignore + get_default_none200_none.metadata = {'url': '/http/payloads/default/none/response/200/none'} # type: ignore + @distributed_trace_async - async def get_default_none400_invalid(self, **kwargs: Any) -> None: + async def get_default_none400_invalid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'statusCode': '400'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1011,17 +1231,24 @@ async def get_default_none400_invalid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none400_invalid_request( - template_url=self.get_default_none400_invalid.metadata["url"], + template_url=self.get_default_none400_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1031,10 +1258,14 @@ async def get_default_none400_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_default_none400_invalid.metadata = {"url": "/http/payloads/default/none/response/400/invalid"} # type: ignore + get_default_none400_invalid.metadata = {'url': '/http/payloads/default/none/response/400/invalid'} # type: ignore + @distributed_trace_async - async def get_default_none400_none(self, **kwargs: Any) -> None: + async def get_default_none400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1042,17 +1273,24 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none400_none_request( - template_url=self.get_default_none400_none.metadata["url"], + template_url=self.get_default_none400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1062,10 +1300,14 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_default_none400_none.metadata = {"url": "/http/payloads/default/none/response/400/none"} # type: ignore + get_default_none400_none.metadata = {'url': '/http/payloads/default/none/response/400/none'} # type: ignore + @distributed_trace_async - async def get200_model_a200_none(self, **kwargs: Any) -> "_models.MyException": + async def get200_model_a200_none( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A. @@ -1074,34 +1316,45 @@ async def get200_model_a200_none(self, **kwargs: Any) -> "_models.MyException": :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a200_none_request( - template_url=self.get200_model_a200_none.metadata["url"], + template_url=self.get200_model_a200_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a200_none.metadata = {"url": "/http/payloads/200/A/response/200/none"} # type: ignore + get200_model_a200_none.metadata = {'url': '/http/payloads/200/A/response/200/none'} # type: ignore + @distributed_trace_async - async def get200_model_a200_valid(self, **kwargs: Any) -> "_models.MyException": + async def get200_model_a200_valid( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 200 response with payload {'statusCode': '200'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1109,34 +1362,45 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> "_models.MyException": :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a200_valid_request( - template_url=self.get200_model_a200_valid.metadata["url"], + template_url=self.get200_model_a200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a200_valid.metadata = {"url": "/http/payloads/200/A/response/200/valid"} # type: ignore + get200_model_a200_valid.metadata = {'url': '/http/payloads/200/A/response/200/valid'} # type: ignore + @distributed_trace_async - async def get200_model_a200_invalid(self, **kwargs: Any) -> "_models.MyException": + async def get200_model_a200_invalid( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1144,34 +1408,45 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> "_models.MyException :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a200_invalid_request( - template_url=self.get200_model_a200_invalid.metadata["url"], + template_url=self.get200_model_a200_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a200_invalid.metadata = {"url": "/http/payloads/200/A/response/200/invalid"} # type: ignore + get200_model_a200_invalid.metadata = {'url': '/http/payloads/200/A/response/200/invalid'} # type: ignore + @distributed_trace_async - async def get200_model_a400_none(self, **kwargs: Any) -> "_models.MyException": + async def get200_model_a400_none( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 400 response with no payload client should treat as an http error with no error model. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1179,34 +1454,45 @@ async def get200_model_a400_none(self, **kwargs: Any) -> "_models.MyException": :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a400_none_request( - template_url=self.get200_model_a400_none.metadata["url"], + template_url=self.get200_model_a400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a400_none.metadata = {"url": "/http/payloads/200/A/response/400/none"} # type: ignore + get200_model_a400_none.metadata = {'url': '/http/payloads/200/A/response/400/none'} # type: ignore + @distributed_trace_async - async def get200_model_a400_valid(self, **kwargs: Any) -> "_models.MyException": + async def get200_model_a400_valid( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 200 response with payload {'statusCode': '400'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1214,34 +1500,45 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> "_models.MyException": :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a400_valid_request( - template_url=self.get200_model_a400_valid.metadata["url"], + template_url=self.get200_model_a400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a400_valid.metadata = {"url": "/http/payloads/200/A/response/400/valid"} # type: ignore + get200_model_a400_valid.metadata = {'url': '/http/payloads/200/A/response/400/valid'} # type: ignore + @distributed_trace_async - async def get200_model_a400_invalid(self, **kwargs: Any) -> "_models.MyException": + async def get200_model_a400_invalid( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1249,34 +1546,45 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> "_models.MyException :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a400_invalid_request( - template_url=self.get200_model_a400_invalid.metadata["url"], + template_url=self.get200_model_a400_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a400_invalid.metadata = {"url": "/http/payloads/200/A/response/400/invalid"} # type: ignore + get200_model_a400_invalid.metadata = {'url': '/http/payloads/200/A/response/400/invalid'} # type: ignore + @distributed_trace_async - async def get200_model_a202_valid(self, **kwargs: Any) -> "_models.MyException": + async def get200_model_a202_valid( + self, + **kwargs: Any + ) -> "_models.MyException": """Send a 202 response with payload {'statusCode': '202'}. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1284,28 +1592,36 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> "_models.MyException": :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a202_valid_request( - template_url=self.get200_model_a202_valid.metadata["url"], + template_url=self.get200_model_a202_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a202_valid.metadata = {"url": "/http/payloads/200/A/response/202/valid"} # type: ignore + get200_model_a202_valid.metadata = {'url': '/http/payloads/200/A/response/202/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py index d4216da935f..43762ef650a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py @@ -20,9 +20,9 @@ from ._models import MyException # type: ignore __all__ = [ - "B", - "C", - "D", - "Error", - "MyException", + 'B', + 'C', + 'D', + 'Error', + 'MyException', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models.py index 93919aeb659..5d3b45777dc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models.py @@ -18,16 +18,19 @@ class MyException(msrest.serialization.Model): """ _attribute_map = { - "status_code": {"key": "statusCode", "type": "str"}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status_code: :paramtype status_code: str """ super(MyException, self).__init__(**kwargs) - self.status_code = kwargs.get("status_code", None) + self.status_code = kwargs.get('status_code', None) class B(MyException): @@ -40,11 +43,14 @@ class B(MyException): """ _attribute_map = { - "status_code": {"key": "statusCode", "type": "str"}, - "text_status_code": {"key": "textStatusCode", "type": "str"}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'text_status_code': {'key': 'textStatusCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status_code: :paramtype status_code: str @@ -52,7 +58,7 @@ def __init__(self, **kwargs): :paramtype text_status_code: str """ super(B, self).__init__(**kwargs) - self.text_status_code = kwargs.get("text_status_code", None) + self.text_status_code = kwargs.get('text_status_code', None) class C(msrest.serialization.Model): @@ -63,16 +69,19 @@ class C(msrest.serialization.Model): """ _attribute_map = { - "http_code": {"key": "httpCode", "type": "str"}, + 'http_code': {'key': 'httpCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword http_code: :paramtype http_code: str """ super(C, self).__init__(**kwargs) - self.http_code = kwargs.get("http_code", None) + self.http_code = kwargs.get('http_code', None) class D(msrest.serialization.Model): @@ -83,16 +92,19 @@ class D(msrest.serialization.Model): """ _attribute_map = { - "http_status_code": {"key": "httpStatusCode", "type": "str"}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword http_status_code: :paramtype http_status_code: str """ super(D, self).__init__(**kwargs) - self.http_status_code = kwargs.get("http_status_code", None) + self.http_status_code = kwargs.get('http_status_code', None) class Error(msrest.serialization.Model): @@ -105,11 +117,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -117,5 +132,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models_py3.py index b71459d2581..185518d3fb8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_models_py3.py @@ -20,10 +20,15 @@ class MyException(msrest.serialization.Model): """ _attribute_map = { - "status_code": {"key": "statusCode", "type": "str"}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, } - def __init__(self, *, status_code: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status_code: Optional[str] = None, + **kwargs + ): """ :keyword status_code: :paramtype status_code: str @@ -42,11 +47,17 @@ class B(MyException): """ _attribute_map = { - "status_code": {"key": "statusCode", "type": "str"}, - "text_status_code": {"key": "textStatusCode", "type": "str"}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'text_status_code': {'key': 'textStatusCode', 'type': 'str'}, } - def __init__(self, *, status_code: Optional[str] = None, text_status_code: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status_code: Optional[str] = None, + text_status_code: Optional[str] = None, + **kwargs + ): """ :keyword status_code: :paramtype status_code: str @@ -65,10 +76,15 @@ class C(msrest.serialization.Model): """ _attribute_map = { - "http_code": {"key": "httpCode", "type": "str"}, + 'http_code': {'key': 'httpCode', 'type': 'str'}, } - def __init__(self, *, http_code: Optional[str] = None, **kwargs): + def __init__( + self, + *, + http_code: Optional[str] = None, + **kwargs + ): """ :keyword http_code: :paramtype http_code: str @@ -85,10 +101,15 @@ class D(msrest.serialization.Model): """ _attribute_map = { - "http_status_code": {"key": "httpStatusCode", "type": "str"}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, } - def __init__(self, *, http_status_code: Optional[str] = None, **kwargs): + def __init__( + self, + *, + http_status_code: Optional[str] = None, + **kwargs + ): """ :keyword http_status_code: :paramtype http_status_code: str @@ -107,11 +128,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/__init__.py index b4b2498bd1a..1f97bc70675 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/__init__.py @@ -15,11 +15,11 @@ from ._multiple_responses_operations import MultipleResponsesOperations __all__ = [ - "HttpFailureOperations", - "HttpSuccessOperations", - "HttpRedirectsOperations", - "HttpClientFailureOperations", - "HttpServerFailureOperations", - "HttpRetryOperations", - "MultipleResponsesOperations", + 'HttpFailureOperations', + 'HttpSuccessOperations', + 'HttpRedirectsOperations', + 'HttpClientFailureOperations', + 'HttpServerFailureOperations', + 'HttpRetryOperations', + 'MultipleResponsesOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py index 17cb27169a8..4584c134b06 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -608,7 +600,7 @@ def build_head429_request( ) # fmt: on -class HttpClientFailureOperations(object): +class HttpClientFailureOperations(object): # pylint: disable=too-many-public-methods """HttpClientFailureOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -632,7 +624,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head400( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 400 status code - should be represented in the client as an error. @@ -642,17 +635,24 @@ def head400( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head400_request( - template_url=self.head400.metadata["url"], + template_url=self.head400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -663,11 +663,13 @@ def head400( if cls: return cls(pipeline_response, None, {}) - head400.metadata = {"url": "/http/failure/client/400"} # type: ignore + head400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace def get400( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 400 status code - should be represented in the client as an error. @@ -677,17 +679,24 @@ def get400( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get400_request( - template_url=self.get400.metadata["url"], + template_url=self.get400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -698,11 +707,13 @@ def get400( if cls: return cls(pipeline_response, None, {}) - get400.metadata = {"url": "/http/failure/client/400"} # type: ignore + get400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace def options400( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 400 status code - should be represented in the client as an error. @@ -712,17 +723,24 @@ def options400( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options400_request( - template_url=self.options400.metadata["url"], + template_url=self.options400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -733,7 +751,8 @@ def options400( if cls: return cls(pipeline_response, None, {}) - options400.metadata = {"url": "/http/failure/client/400"} # type: ignore + options400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace def put400( @@ -751,26 +770,32 @@ def put400( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put400_request( content_type=content_type, json=_json, - template_url=self.put400.metadata["url"], + template_url=self.put400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -781,7 +806,8 @@ def put400( if cls: return cls(pipeline_response, None, {}) - put400.metadata = {"url": "/http/failure/client/400"} # type: ignore + put400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace def patch400( @@ -799,26 +825,32 @@ def patch400( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch400_request( content_type=content_type, json=_json, - template_url=self.patch400.metadata["url"], + template_url=self.patch400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -829,7 +861,8 @@ def patch400( if cls: return cls(pipeline_response, None, {}) - patch400.metadata = {"url": "/http/failure/client/400"} # type: ignore + patch400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace def post400( @@ -847,26 +880,32 @@ def post400( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post400_request( content_type=content_type, json=_json, - template_url=self.post400.metadata["url"], + template_url=self.post400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -877,7 +916,8 @@ def post400( if cls: return cls(pipeline_response, None, {}) - post400.metadata = {"url": "/http/failure/client/400"} # type: ignore + post400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace def delete400( @@ -895,26 +935,32 @@ def delete400( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete400_request( content_type=content_type, json=_json, - template_url=self.delete400.metadata["url"], + template_url=self.delete400.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -925,11 +971,13 @@ def delete400( if cls: return cls(pipeline_response, None, {}) - delete400.metadata = {"url": "/http/failure/client/400"} # type: ignore + delete400.metadata = {'url': '/http/failure/client/400'} # type: ignore + @distributed_trace def head401( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 401 status code - should be represented in the client as an error. @@ -939,17 +987,24 @@ def head401( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head401_request( - template_url=self.head401.metadata["url"], + template_url=self.head401.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -960,11 +1015,13 @@ def head401( if cls: return cls(pipeline_response, None, {}) - head401.metadata = {"url": "/http/failure/client/401"} # type: ignore + head401.metadata = {'url': '/http/failure/client/401'} # type: ignore + @distributed_trace def get402( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 402 status code - should be represented in the client as an error. @@ -974,17 +1031,24 @@ def get402( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get402_request( - template_url=self.get402.metadata["url"], + template_url=self.get402.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -995,11 +1059,13 @@ def get402( if cls: return cls(pipeline_response, None, {}) - get402.metadata = {"url": "/http/failure/client/402"} # type: ignore + get402.metadata = {'url': '/http/failure/client/402'} # type: ignore + @distributed_trace def options403( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 403 status code - should be represented in the client as an error. @@ -1009,17 +1075,24 @@ def options403( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options403_request( - template_url=self.options403.metadata["url"], + template_url=self.options403.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1030,11 +1103,13 @@ def options403( if cls: return cls(pipeline_response, None, {}) - options403.metadata = {"url": "/http/failure/client/403"} # type: ignore + options403.metadata = {'url': '/http/failure/client/403'} # type: ignore + @distributed_trace def get403( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 403 status code - should be represented in the client as an error. @@ -1044,17 +1119,24 @@ def get403( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get403_request( - template_url=self.get403.metadata["url"], + template_url=self.get403.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1065,7 +1147,8 @@ def get403( if cls: return cls(pipeline_response, None, {}) - get403.metadata = {"url": "/http/failure/client/403"} # type: ignore + get403.metadata = {'url': '/http/failure/client/403'} # type: ignore + @distributed_trace def put404( @@ -1083,26 +1166,32 @@ def put404( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put404_request( content_type=content_type, json=_json, - template_url=self.put404.metadata["url"], + template_url=self.put404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1113,7 +1202,8 @@ def put404( if cls: return cls(pipeline_response, None, {}) - put404.metadata = {"url": "/http/failure/client/404"} # type: ignore + put404.metadata = {'url': '/http/failure/client/404'} # type: ignore + @distributed_trace def patch405( @@ -1131,26 +1221,32 @@ def patch405( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch405_request( content_type=content_type, json=_json, - template_url=self.patch405.metadata["url"], + template_url=self.patch405.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1161,7 +1257,8 @@ def patch405( if cls: return cls(pipeline_response, None, {}) - patch405.metadata = {"url": "/http/failure/client/405"} # type: ignore + patch405.metadata = {'url': '/http/failure/client/405'} # type: ignore + @distributed_trace def post406( @@ -1179,26 +1276,32 @@ def post406( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post406_request( content_type=content_type, json=_json, - template_url=self.post406.metadata["url"], + template_url=self.post406.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1209,7 +1312,8 @@ def post406( if cls: return cls(pipeline_response, None, {}) - post406.metadata = {"url": "/http/failure/client/406"} # type: ignore + post406.metadata = {'url': '/http/failure/client/406'} # type: ignore + @distributed_trace def delete407( @@ -1227,26 +1331,32 @@ def delete407( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete407_request( content_type=content_type, json=_json, - template_url=self.delete407.metadata["url"], + template_url=self.delete407.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1257,7 +1367,8 @@ def delete407( if cls: return cls(pipeline_response, None, {}) - delete407.metadata = {"url": "/http/failure/client/407"} # type: ignore + delete407.metadata = {'url': '/http/failure/client/407'} # type: ignore + @distributed_trace def put409( @@ -1275,26 +1386,32 @@ def put409( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put409_request( content_type=content_type, json=_json, - template_url=self.put409.metadata["url"], + template_url=self.put409.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1305,11 +1422,13 @@ def put409( if cls: return cls(pipeline_response, None, {}) - put409.metadata = {"url": "/http/failure/client/409"} # type: ignore + put409.metadata = {'url': '/http/failure/client/409'} # type: ignore + @distributed_trace def head410( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 410 status code - should be represented in the client as an error. @@ -1319,17 +1438,24 @@ def head410( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head410_request( - template_url=self.head410.metadata["url"], + template_url=self.head410.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1340,11 +1466,13 @@ def head410( if cls: return cls(pipeline_response, None, {}) - head410.metadata = {"url": "/http/failure/client/410"} # type: ignore + head410.metadata = {'url': '/http/failure/client/410'} # type: ignore + @distributed_trace def get411( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 411 status code - should be represented in the client as an error. @@ -1354,17 +1482,24 @@ def get411( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get411_request( - template_url=self.get411.metadata["url"], + template_url=self.get411.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1375,11 +1510,13 @@ def get411( if cls: return cls(pipeline_response, None, {}) - get411.metadata = {"url": "/http/failure/client/411"} # type: ignore + get411.metadata = {'url': '/http/failure/client/411'} # type: ignore + @distributed_trace def options412( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 412 status code - should be represented in the client as an error. @@ -1389,17 +1526,24 @@ def options412( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options412_request( - template_url=self.options412.metadata["url"], + template_url=self.options412.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1410,11 +1554,13 @@ def options412( if cls: return cls(pipeline_response, None, {}) - options412.metadata = {"url": "/http/failure/client/412"} # type: ignore + options412.metadata = {'url': '/http/failure/client/412'} # type: ignore + @distributed_trace def get412( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 412 status code - should be represented in the client as an error. @@ -1424,17 +1570,24 @@ def get412( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get412_request( - template_url=self.get412.metadata["url"], + template_url=self.get412.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1445,7 +1598,8 @@ def get412( if cls: return cls(pipeline_response, None, {}) - get412.metadata = {"url": "/http/failure/client/412"} # type: ignore + get412.metadata = {'url': '/http/failure/client/412'} # type: ignore + @distributed_trace def put413( @@ -1463,26 +1617,32 @@ def put413( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put413_request( content_type=content_type, json=_json, - template_url=self.put413.metadata["url"], + template_url=self.put413.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1493,7 +1653,8 @@ def put413( if cls: return cls(pipeline_response, None, {}) - put413.metadata = {"url": "/http/failure/client/413"} # type: ignore + put413.metadata = {'url': '/http/failure/client/413'} # type: ignore + @distributed_trace def patch414( @@ -1511,26 +1672,32 @@ def patch414( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch414_request( content_type=content_type, json=_json, - template_url=self.patch414.metadata["url"], + template_url=self.patch414.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1541,7 +1708,8 @@ def patch414( if cls: return cls(pipeline_response, None, {}) - patch414.metadata = {"url": "/http/failure/client/414"} # type: ignore + patch414.metadata = {'url': '/http/failure/client/414'} # type: ignore + @distributed_trace def post415( @@ -1559,26 +1727,32 @@ def post415( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post415_request( content_type=content_type, json=_json, - template_url=self.post415.metadata["url"], + template_url=self.post415.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1589,11 +1763,13 @@ def post415( if cls: return cls(pipeline_response, None, {}) - post415.metadata = {"url": "/http/failure/client/415"} # type: ignore + post415.metadata = {'url': '/http/failure/client/415'} # type: ignore + @distributed_trace def get416( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 416 status code - should be represented in the client as an error. @@ -1603,17 +1779,24 @@ def get416( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get416_request( - template_url=self.get416.metadata["url"], + template_url=self.get416.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1624,7 +1807,8 @@ def get416( if cls: return cls(pipeline_response, None, {}) - get416.metadata = {"url": "/http/failure/client/416"} # type: ignore + get416.metadata = {'url': '/http/failure/client/416'} # type: ignore + @distributed_trace def delete417( @@ -1642,26 +1826,32 @@ def delete417( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete417_request( content_type=content_type, json=_json, - template_url=self.delete417.metadata["url"], + template_url=self.delete417.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1672,11 +1862,13 @@ def delete417( if cls: return cls(pipeline_response, None, {}) - delete417.metadata = {"url": "/http/failure/client/417"} # type: ignore + delete417.metadata = {'url': '/http/failure/client/417'} # type: ignore + @distributed_trace def head429( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 429 status code - should be represented in the client as an error. @@ -1686,17 +1878,24 @@ def head429( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head429_request( - template_url=self.head429.metadata["url"], + template_url=self.head429.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -1707,4 +1906,5 @@ def head429( if cls: return cls(pipeline_response, None, {}) - head429.metadata = {"url": "/http/failure/client/429"} # type: ignore + head429.metadata = {'url': '/http/failure/client/429'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py index 4b8bbdf8682..b89b2134ce5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -120,7 +112,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_empty_error( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Get empty error form server. @@ -130,17 +123,24 @@ def get_empty_error( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_error_request( - template_url=self.get_empty_error.metadata["url"], + template_url=self.get_empty_error.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -148,18 +148,20 @@ def get_empty_error( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_error.metadata = {"url": "/http/failure/emptybody/error"} # type: ignore + get_empty_error.metadata = {'url': '/http/failure/emptybody/error'} # type: ignore + @distributed_trace def get_no_model_error( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Get empty error form server. @@ -169,35 +171,44 @@ def get_no_model_error( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_no_model_error_request( - template_url=self.get_no_model_error.metadata["url"], + template_url=self.get_no_model_error.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_no_model_error.metadata = {"url": "/http/failure/nomodel/error"} # type: ignore + get_no_model_error.metadata = {'url': '/http/failure/nomodel/error'} # type: ignore + @distributed_trace def get_no_model_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Get empty response from server. @@ -207,28 +218,36 @@ def get_no_model_empty( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_no_model_empty_request( - template_url=self.get_no_model_empty.metadata["url"], + template_url=self.get_no_model_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_no_model_empty.metadata = {"url": "/http/failure/nomodel/empty"} # type: ignore + get_no_model_empty.metadata = {'url': '/http/failure/nomodel/empty'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py index 1592d39efe4..79a301a1cd8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -408,7 +400,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head300( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 300 status code and redirect to /http/success/200. @@ -418,17 +411,24 @@ def head300( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head300_request( - template_url=self.head300.metadata["url"], + template_url=self.head300.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 300]: @@ -438,16 +438,19 @@ def head300( response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head300.metadata = {"url": "/http/redirect/300"} # type: ignore + head300.metadata = {'url': '/http/redirect/300'} # type: ignore + @distributed_trace def get300( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional[List[str]] """Return 300 status code and redirect to /http/success/200. @@ -457,17 +460,24 @@ def get300( :rtype: list[str] or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get300_request( - template_url=self.get300.metadata["url"], + template_url=self.get300.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 300]: @@ -478,20 +488,22 @@ def get300( deserialized = None response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = self._deserialize("[str]", pipeline_response) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('[str]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get300.metadata = {"url": "/http/redirect/300"} # type: ignore + get300.metadata = {'url': '/http/redirect/300'} # type: ignore + @distributed_trace def head301( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 301 status code and redirect to /http/success/200. @@ -501,17 +513,24 @@ def head301( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head301_request( - template_url=self.head301.metadata["url"], + template_url=self.head301.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 301]: @@ -521,16 +540,19 @@ def head301( response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head301.metadata = {"url": "/http/redirect/301"} # type: ignore + head301.metadata = {'url': '/http/redirect/301'} # type: ignore + @distributed_trace def get301( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 301 status code and redirect to /http/success/200. @@ -540,17 +562,24 @@ def get301( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get301_request( - template_url=self.get301.metadata["url"], + template_url=self.get301.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 301]: @@ -560,12 +589,14 @@ def get301( response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - get301.metadata = {"url": "/http/redirect/301"} # type: ignore + get301.metadata = {'url': '/http/redirect/301'} # type: ignore + @distributed_trace def put301( @@ -584,26 +615,32 @@ def put301( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put301_request( content_type=content_type, json=_json, - template_url=self.put301.metadata["url"], + template_url=self.put301.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [301]: @@ -612,16 +649,19 @@ def put301( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - put301.metadata = {"url": "/http/redirect/301"} # type: ignore + put301.metadata = {'url': '/http/redirect/301'} # type: ignore + @distributed_trace def head302( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 302 status code and redirect to /http/success/200. @@ -631,17 +671,24 @@ def head302( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head302_request( - template_url=self.head302.metadata["url"], + template_url=self.head302.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 302]: @@ -651,16 +698,19 @@ def head302( response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head302.metadata = {"url": "/http/redirect/302"} # type: ignore + head302.metadata = {'url': '/http/redirect/302'} # type: ignore + @distributed_trace def get302( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 302 status code and redirect to /http/success/200. @@ -670,17 +720,24 @@ def get302( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get302_request( - template_url=self.get302.metadata["url"], + template_url=self.get302.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 302]: @@ -690,12 +747,14 @@ def get302( response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - get302.metadata = {"url": "/http/redirect/302"} # type: ignore + get302.metadata = {'url': '/http/redirect/302'} # type: ignore + @distributed_trace def patch302( @@ -714,26 +773,32 @@ def patch302( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch302_request( content_type=content_type, json=_json, - template_url=self.patch302.metadata["url"], + template_url=self.patch302.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [302]: @@ -742,12 +807,14 @@ def patch302( raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - patch302.metadata = {"url": "/http/redirect/302"} # type: ignore + patch302.metadata = {'url': '/http/redirect/302'} # type: ignore + @distributed_trace def post303( @@ -766,26 +833,32 @@ def post303( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post303_request( content_type=content_type, json=_json, - template_url=self.post303.metadata["url"], + template_url=self.post303.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 303]: @@ -795,16 +868,19 @@ def post303( response_headers = {} if response.status_code == 303: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - post303.metadata = {"url": "/http/redirect/303"} # type: ignore + post303.metadata = {'url': '/http/redirect/303'} # type: ignore + @distributed_trace def head307( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Redirect with 307, resulting in a 200 success. @@ -814,17 +890,24 @@ def head307( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head307_request( - template_url=self.head307.metadata["url"], + template_url=self.head307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -834,16 +917,19 @@ def head307( response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - head307.metadata = {"url": "/http/redirect/307"} # type: ignore + head307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace def get307( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Redirect get with 307, resulting in a 200 success. @@ -853,17 +939,24 @@ def get307( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get307_request( - template_url=self.get307.metadata["url"], + template_url=self.get307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -873,16 +966,19 @@ def get307( response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - get307.metadata = {"url": "/http/redirect/307"} # type: ignore + get307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace def options307( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """options redirected with 307, resulting in a 200 after redirect. @@ -892,17 +988,24 @@ def options307( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options307_request( - template_url=self.options307.metadata["url"], + template_url=self.options307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -912,12 +1015,14 @@ def options307( response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - options307.metadata = {"url": "/http/redirect/307"} # type: ignore + options307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace def put307( @@ -935,26 +1040,32 @@ def put307( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put307_request( content_type=content_type, json=_json, - template_url=self.put307.metadata["url"], + template_url=self.put307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -964,12 +1075,14 @@ def put307( response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - put307.metadata = {"url": "/http/redirect/307"} # type: ignore + put307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace def patch307( @@ -987,26 +1100,32 @@ def patch307( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch307_request( content_type=content_type, json=_json, - template_url=self.patch307.metadata["url"], + template_url=self.patch307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -1016,12 +1135,14 @@ def patch307( response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - patch307.metadata = {"url": "/http/redirect/307"} # type: ignore + patch307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace def post307( @@ -1039,26 +1160,32 @@ def post307( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post307_request( content_type=content_type, json=_json, - template_url=self.post307.metadata["url"], + template_url=self.post307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -1068,12 +1195,14 @@ def post307( response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - post307.metadata = {"url": "/http/redirect/307"} # type: ignore + post307.metadata = {'url': '/http/redirect/307'} # type: ignore + @distributed_trace def delete307( @@ -1091,26 +1220,32 @@ def delete307( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete307_request( content_type=content_type, json=_json, - template_url=self.delete307.metadata["url"], + template_url=self.delete307.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 307]: @@ -1120,9 +1255,11 @@ def delete307( response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) - delete307.metadata = {"url": "/http/redirect/307"} # type: ignore + delete307.metadata = {'url': '/http/redirect/307'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py index 2d053de625f..591a3055af9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -264,7 +256,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head408( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 408 status code, then 200 after retry. @@ -274,17 +267,24 @@ def head408( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head408_request( - template_url=self.head408.metadata["url"], + template_url=self.head408.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -295,7 +295,8 @@ def head408( if cls: return cls(pipeline_response, None, {}) - head408.metadata = {"url": "/http/retry/408"} # type: ignore + head408.metadata = {'url': '/http/retry/408'} # type: ignore + @distributed_trace def put500( @@ -313,26 +314,32 @@ def put500( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put500_request( content_type=content_type, json=_json, - template_url=self.put500.metadata["url"], + template_url=self.put500.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -343,7 +350,8 @@ def put500( if cls: return cls(pipeline_response, None, {}) - put500.metadata = {"url": "/http/retry/500"} # type: ignore + put500.metadata = {'url': '/http/retry/500'} # type: ignore + @distributed_trace def patch500( @@ -361,26 +369,32 @@ def patch500( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch500_request( content_type=content_type, json=_json, - template_url=self.patch500.metadata["url"], + template_url=self.patch500.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -391,11 +405,13 @@ def patch500( if cls: return cls(pipeline_response, None, {}) - patch500.metadata = {"url": "/http/retry/500"} # type: ignore + patch500.metadata = {'url': '/http/retry/500'} # type: ignore + @distributed_trace def get502( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 502 status code, then 200 after retry. @@ -405,17 +421,24 @@ def get502( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get502_request( - template_url=self.get502.metadata["url"], + template_url=self.get502.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -426,11 +449,13 @@ def get502( if cls: return cls(pipeline_response, None, {}) - get502.metadata = {"url": "/http/retry/502"} # type: ignore + get502.metadata = {'url': '/http/retry/502'} # type: ignore + @distributed_trace def options502( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Return 502 status code, then 200 after retry. @@ -440,17 +465,24 @@ def options502( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options502_request( - template_url=self.options502.metadata["url"], + template_url=self.options502.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,14 +490,15 @@ def options502( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - options502.metadata = {"url": "/http/retry/502"} # type: ignore + options502.metadata = {'url': '/http/retry/502'} # type: ignore + @distributed_trace def post503( @@ -483,26 +516,32 @@ def post503( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post503_request( content_type=content_type, json=_json, - template_url=self.post503.metadata["url"], + template_url=self.post503.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,7 +552,8 @@ def post503( if cls: return cls(pipeline_response, None, {}) - post503.metadata = {"url": "/http/retry/503"} # type: ignore + post503.metadata = {'url': '/http/retry/503'} # type: ignore + @distributed_trace def delete503( @@ -531,26 +571,32 @@ def delete503( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete503_request( content_type=content_type, json=_json, - template_url=self.delete503.metadata["url"], + template_url=self.delete503.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -561,7 +607,8 @@ def delete503( if cls: return cls(pipeline_response, None, {}) - delete503.metadata = {"url": "/http/retry/503"} # type: ignore + delete503.metadata = {'url': '/http/retry/503'} # type: ignore + @distributed_trace def put504( @@ -579,26 +626,32 @@ def put504( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put504_request( content_type=content_type, json=_json, - template_url=self.put504.metadata["url"], + template_url=self.put504.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -609,7 +662,8 @@ def put504( if cls: return cls(pipeline_response, None, {}) - put504.metadata = {"url": "/http/retry/504"} # type: ignore + put504.metadata = {'url': '/http/retry/504'} # type: ignore + @distributed_trace def patch504( @@ -627,26 +681,32 @@ def patch504( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch504_request( content_type=content_type, json=_json, - template_url=self.patch504.metadata["url"], + template_url=self.patch504.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -657,4 +717,5 @@ def patch504( if cls: return cls(pipeline_response, None, {}) - patch504.metadata = {"url": "/http/retry/504"} # type: ignore + patch504.metadata = {'url': '/http/retry/504'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py index e51005cbd40..0e0d5dbab53 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -148,7 +140,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head501( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 501 status code - should be represented in the client as an error. @@ -158,17 +151,24 @@ def head501( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head501_request( - template_url=self.head501.metadata["url"], + template_url=self.head501.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -179,11 +179,13 @@ def head501( if cls: return cls(pipeline_response, None, {}) - head501.metadata = {"url": "/http/failure/server/501"} # type: ignore + head501.metadata = {'url': '/http/failure/server/501'} # type: ignore + @distributed_trace def get501( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 501 status code - should be represented in the client as an error. @@ -193,17 +195,24 @@ def get501( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get501_request( - template_url=self.get501.metadata["url"], + template_url=self.get501.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -214,7 +223,8 @@ def get501( if cls: return cls(pipeline_response, None, {}) - get501.metadata = {"url": "/http/failure/server/501"} # type: ignore + get501.metadata = {'url': '/http/failure/server/501'} # type: ignore + @distributed_trace def post505( @@ -232,26 +242,32 @@ def post505( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post505_request( content_type=content_type, json=_json, - template_url=self.post505.metadata["url"], + template_url=self.post505.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -262,7 +278,8 @@ def post505( if cls: return cls(pipeline_response, None, {}) - post505.metadata = {"url": "/http/failure/server/505"} # type: ignore + post505.metadata = {'url': '/http/failure/server/505'} # type: ignore + @distributed_trace def delete505( @@ -280,26 +297,32 @@ def delete505( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete505_request( content_type=content_type, json=_json, - template_url=self.delete505.metadata["url"], + template_url=self.delete505.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in []: @@ -310,4 +333,5 @@ def delete505( if cls: return cls(pipeline_response, None, {}) - delete505.metadata = {"url": "/http/failure/server/505"} # type: ignore + delete505.metadata = {'url': '/http/failure/server/505'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py index 90a4c3688ab..176e9b6e122 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -496,7 +488,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def head200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 200 status code if successful. @@ -506,17 +499,24 @@ def head200( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head200_request( - template_url=self.head200.metadata["url"], + template_url=self.head200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -527,11 +527,13 @@ def head200( if cls: return cls(pipeline_response, None, {}) - head200.metadata = {"url": "/http/success/200"} # type: ignore + head200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def get200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Get 200 success. @@ -541,17 +543,24 @@ def get200( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_request( - template_url=self.get200.metadata["url"], + template_url=self.get200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -559,18 +568,20 @@ def get200( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200.metadata = {"url": "/http/success/200"} # type: ignore + get200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def options200( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> bool """Options 200 success. @@ -580,17 +591,24 @@ def options200( :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_options200_request( - template_url=self.options200.metadata["url"], + template_url=self.options200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -598,14 +616,15 @@ def options200( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("bool", pipeline_response) + deserialized = self._deserialize('bool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - options200.metadata = {"url": "/http/success/200"} # type: ignore + options200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def put200( @@ -623,26 +642,32 @@ def put200( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put200_request( content_type=content_type, json=_json, - template_url=self.put200.metadata["url"], + template_url=self.put200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -653,7 +678,8 @@ def put200( if cls: return cls(pipeline_response, None, {}) - put200.metadata = {"url": "/http/success/200"} # type: ignore + put200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def patch200( @@ -671,26 +697,32 @@ def patch200( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch200_request( content_type=content_type, json=_json, - template_url=self.patch200.metadata["url"], + template_url=self.patch200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -701,7 +733,8 @@ def patch200( if cls: return cls(pipeline_response, None, {}) - patch200.metadata = {"url": "/http/success/200"} # type: ignore + patch200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def post200( @@ -719,26 +752,32 @@ def post200( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post200_request( content_type=content_type, json=_json, - template_url=self.post200.metadata["url"], + template_url=self.post200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -749,7 +788,8 @@ def post200( if cls: return cls(pipeline_response, None, {}) - post200.metadata = {"url": "/http/success/200"} # type: ignore + post200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def delete200( @@ -767,26 +807,32 @@ def delete200( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete200_request( content_type=content_type, json=_json, - template_url=self.delete200.metadata["url"], + template_url=self.delete200.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -797,7 +843,8 @@ def delete200( if cls: return cls(pipeline_response, None, {}) - delete200.metadata = {"url": "/http/success/200"} # type: ignore + delete200.metadata = {'url': '/http/success/200'} # type: ignore + @distributed_trace def put201( @@ -815,26 +862,32 @@ def put201( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put201_request( content_type=content_type, json=_json, - template_url=self.put201.metadata["url"], + template_url=self.put201.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -845,7 +898,8 @@ def put201( if cls: return cls(pipeline_response, None, {}) - put201.metadata = {"url": "/http/success/201"} # type: ignore + put201.metadata = {'url': '/http/success/201'} # type: ignore + @distributed_trace def post201( @@ -863,26 +917,32 @@ def post201( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post201_request( content_type=content_type, json=_json, - template_url=self.post201.metadata["url"], + template_url=self.post201.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -893,7 +953,8 @@ def post201( if cls: return cls(pipeline_response, None, {}) - post201.metadata = {"url": "/http/success/201"} # type: ignore + post201.metadata = {'url': '/http/success/201'} # type: ignore + @distributed_trace def put202( @@ -911,26 +972,32 @@ def put202( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put202_request( content_type=content_type, json=_json, - template_url=self.put202.metadata["url"], + template_url=self.put202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -941,7 +1008,8 @@ def put202( if cls: return cls(pipeline_response, None, {}) - put202.metadata = {"url": "/http/success/202"} # type: ignore + put202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace def patch202( @@ -959,26 +1027,32 @@ def patch202( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch202_request( content_type=content_type, json=_json, - template_url=self.patch202.metadata["url"], + template_url=self.patch202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -989,7 +1063,8 @@ def patch202( if cls: return cls(pipeline_response, None, {}) - patch202.metadata = {"url": "/http/success/202"} # type: ignore + patch202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace def post202( @@ -1007,26 +1082,32 @@ def post202( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post202_request( content_type=content_type, json=_json, - template_url=self.post202.metadata["url"], + template_url=self.post202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1037,7 +1118,8 @@ def post202( if cls: return cls(pipeline_response, None, {}) - post202.metadata = {"url": "/http/success/202"} # type: ignore + post202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace def delete202( @@ -1055,26 +1137,32 @@ def delete202( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete202_request( content_type=content_type, json=_json, - template_url=self.delete202.metadata["url"], + template_url=self.delete202.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1085,11 +1173,13 @@ def delete202( if cls: return cls(pipeline_response, None, {}) - delete202.metadata = {"url": "/http/success/202"} # type: ignore + delete202.metadata = {'url': '/http/success/202'} # type: ignore + @distributed_trace def head204( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 204 status code if successful. @@ -1099,17 +1189,24 @@ def head204( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head204_request( - template_url=self.head204.metadata["url"], + template_url=self.head204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1120,7 +1217,8 @@ def head204( if cls: return cls(pipeline_response, None, {}) - head204.metadata = {"url": "/http/success/204"} # type: ignore + head204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def put204( @@ -1138,26 +1236,32 @@ def put204( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_put204_request( content_type=content_type, json=_json, - template_url=self.put204.metadata["url"], + template_url=self.put204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1168,7 +1272,8 @@ def put204( if cls: return cls(pipeline_response, None, {}) - put204.metadata = {"url": "/http/success/204"} # type: ignore + put204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def patch204( @@ -1186,26 +1291,32 @@ def patch204( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_patch204_request( content_type=content_type, json=_json, - template_url=self.patch204.metadata["url"], + template_url=self.patch204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1216,7 +1327,8 @@ def patch204( if cls: return cls(pipeline_response, None, {}) - patch204.metadata = {"url": "/http/success/204"} # type: ignore + patch204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def post204( @@ -1234,26 +1346,32 @@ def post204( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_post204_request( content_type=content_type, json=_json, - template_url=self.post204.metadata["url"], + template_url=self.post204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1264,7 +1382,8 @@ def post204( if cls: return cls(pipeline_response, None, {}) - post204.metadata = {"url": "/http/success/204"} # type: ignore + post204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def delete204( @@ -1282,26 +1401,32 @@ def delete204( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: - _json = self._serialize.body(boolean_value, "bool") + _json = self._serialize.body(boolean_value, 'bool') else: _json = None request = build_delete204_request( content_type=content_type, json=_json, - template_url=self.delete204.metadata["url"], + template_url=self.delete204.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -1312,11 +1437,13 @@ def delete204( if cls: return cls(pipeline_response, None, {}) - delete204.metadata = {"url": "/http/success/204"} # type: ignore + delete204.metadata = {'url': '/http/success/204'} # type: ignore + @distributed_trace def head404( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Return 404 status code. @@ -1326,17 +1453,24 @@ def head404( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_head404_request( - template_url=self.head404.metadata["url"], + template_url=self.head404.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204, 404]: @@ -1347,4 +1481,5 @@ def head404( if cls: return cls(pipeline_response, None, {}) - head404.metadata = {"url": "/http/success/404"} # type: ignore + head404.metadata = {'url': '/http/success/404'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py index f7e61d56f22..d4ae6801c9b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -668,7 +660,7 @@ def build_get200_model_a202_valid_request( ) # fmt: on -class MultipleResponsesOperations(object): +class MultipleResponsesOperations(object): # pylint: disable=too-many-public-methods """MultipleResponsesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -692,7 +684,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get200_model204_no_model_default_error200_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional["_models.MyException"] """Send a 200 response with valid payload: {'statusCode': '200'}. @@ -702,17 +695,24 @@ def get200_model204_no_model_default_error200_valid( :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error200_valid_request( - template_url=self.get200_model204_no_model_default_error200_valid.metadata["url"], + template_url=self.get200_model204_no_model_default_error200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -722,18 +722,20 @@ def get200_model204_no_model_default_error200_valid( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error200_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/200/valid"} # type: ignore + get200_model204_no_model_default_error200_valid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/200/valid'} # type: ignore + @distributed_trace def get200_model204_no_model_default_error204_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional["_models.MyException"] """Send a 204 response with no payload. @@ -743,17 +745,24 @@ def get200_model204_no_model_default_error204_valid( :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error204_valid_request( - template_url=self.get200_model204_no_model_default_error204_valid.metadata["url"], + template_url=self.get200_model204_no_model_default_error204_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -763,18 +772,20 @@ def get200_model204_no_model_default_error204_valid( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error204_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/204/none"} # type: ignore + get200_model204_no_model_default_error204_valid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/204/none'} # type: ignore + @distributed_trace def get200_model204_no_model_default_error201_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional["_models.MyException"] """Send a 201 response with valid payload: {'statusCode': '201'}. @@ -784,17 +795,24 @@ def get200_model204_no_model_default_error201_invalid( :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error201_invalid_request( - template_url=self.get200_model204_no_model_default_error201_invalid.metadata["url"], + template_url=self.get200_model204_no_model_default_error201_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -804,18 +822,20 @@ def get200_model204_no_model_default_error201_invalid( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error201_invalid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/201/valid"} # type: ignore + get200_model204_no_model_default_error201_invalid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/201/valid'} # type: ignore + @distributed_trace def get200_model204_no_model_default_error202_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional["_models.MyException"] """Send a 202 response with no payload:. @@ -825,17 +845,24 @@ def get200_model204_no_model_default_error202_none( :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error202_none_request( - template_url=self.get200_model204_no_model_default_error202_none.metadata["url"], + template_url=self.get200_model204_no_model_default_error202_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -845,18 +872,20 @@ def get200_model204_no_model_default_error202_none( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error202_none.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/202/none"} # type: ignore + get200_model204_no_model_default_error202_none.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/202/none'} # type: ignore + @distributed_trace def get200_model204_no_model_default_error400_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Optional["_models.MyException"] """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. @@ -866,17 +895,24 @@ def get200_model204_no_model_default_error400_valid( :rtype: ~httpinfrastructure.models.MyException or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.MyException"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MyException"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model204_no_model_default_error400_valid_request( - template_url=self.get200_model204_no_model_default_error400_valid.metadata["url"], + template_url=self.get200_model204_no_model_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -886,18 +922,20 @@ def get200_model204_no_model_default_error400_valid( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model204_no_model_default_error400_valid.metadata = {"url": "/http/payloads/200/A/204/none/default/Error/response/400/valid"} # type: ignore + get200_model204_no_model_default_error400_valid.metadata = {'url': '/http/payloads/200/A/204/none/default/Error/response/400/valid'} # type: ignore + @distributed_trace def get200_model201_model_default_error200_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union["_models.MyException", "_models.B"] """Send a 200 response with valid payload: {'statusCode': '200'}. @@ -907,17 +945,24 @@ def get200_model201_model_default_error200_valid( :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.B"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.B"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model201_model_default_error200_valid_request( - template_url=self.get200_model201_model_default_error200_valid.metadata["url"], + template_url=self.get200_model201_model_default_error200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -926,21 +971,23 @@ def get200_model201_model_default_error200_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("B", pipeline_response) + deserialized = self._deserialize('B', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model201_model_default_error200_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/200/valid"} # type: ignore + get200_model201_model_default_error200_valid.metadata = {'url': '/http/payloads/200/A/201/B/default/Error/response/200/valid'} # type: ignore + @distributed_trace def get200_model201_model_default_error201_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union["_models.MyException", "_models.B"] """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. @@ -950,17 +997,24 @@ def get200_model201_model_default_error201_valid( :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.B"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.B"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model201_model_default_error201_valid_request( - template_url=self.get200_model201_model_default_error201_valid.metadata["url"], + template_url=self.get200_model201_model_default_error201_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -969,21 +1023,23 @@ def get200_model201_model_default_error201_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("B", pipeline_response) + deserialized = self._deserialize('B', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model201_model_default_error201_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/201/valid"} # type: ignore + get200_model201_model_default_error201_valid.metadata = {'url': '/http/payloads/200/A/201/B/default/Error/response/201/valid'} # type: ignore + @distributed_trace def get200_model201_model_default_error400_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union["_models.MyException", "_models.B"] """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. @@ -993,17 +1049,24 @@ def get200_model201_model_default_error400_valid( :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.B"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.B"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model201_model_default_error400_valid_request( - template_url=self.get200_model201_model_default_error400_valid.metadata["url"], + template_url=self.get200_model201_model_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -1012,21 +1075,23 @@ def get200_model201_model_default_error400_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("B", pipeline_response) + deserialized = self._deserialize('B', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model201_model_default_error400_valid.metadata = {"url": "/http/payloads/200/A/201/B/default/Error/response/400/valid"} # type: ignore + get200_model201_model_default_error400_valid.metadata = {'url': '/http/payloads/200/A/201/B/default/Error/response/400/valid'} # type: ignore + @distributed_trace def get200_model_a201_model_c404_model_d_default_error200_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union["_models.MyException", "_models.C", "_models.D"] """Send a 200 response with valid payload: {'statusCode': '200'}. @@ -1037,17 +1102,24 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error200_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error200_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -1056,24 +1128,26 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error200_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error200_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid'} # type: ignore + @distributed_trace def get200_model_a201_model_c404_model_d_default_error201_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union["_models.MyException", "_models.C", "_models.D"] """Send a 200 response with valid payload: {'httpCode': '201'}. @@ -1084,17 +1158,24 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error201_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error201_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error201_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -1103,24 +1184,26 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error201_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error201_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid'} # type: ignore + @distributed_trace def get200_model_a201_model_c404_model_d_default_error404_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union["_models.MyException", "_models.C", "_models.D"] """Send a 200 response with valid payload: {'httpStatusCode': '404'}. @@ -1131,17 +1214,24 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error404_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error404_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error404_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -1150,24 +1240,26 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error404_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error404_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid'} # type: ignore + @distributed_trace def get200_model_a201_model_c404_model_d_default_error400_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union["_models.MyException", "_models.C", "_models.D"] """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. @@ -1178,17 +1270,24 @@ def get200_model_a201_model_c404_model_d_default_error400_valid( ~httpinfrastructure.models.D :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.MyException", "_models.C", "_models.D"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a201_model_c404_model_d_default_error400_valid_request( - template_url=self.get200_model_a201_model_c404_model_d_default_error400_valid.metadata["url"], + template_url=self.get200_model_a201_model_c404_model_d_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 404]: @@ -1197,24 +1296,26 @@ def get200_model_a201_model_c404_model_d_default_error400_valid( raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("C", pipeline_response) + deserialized = self._deserialize('C', pipeline_response) if response.status_code == 404: - deserialized = self._deserialize("D", pipeline_response) + deserialized = self._deserialize('D', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a201_model_c404_model_d_default_error400_valid.metadata = {"url": "/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid"} # type: ignore + get200_model_a201_model_c404_model_d_default_error400_valid.metadata = {'url': '/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid'} # type: ignore + @distributed_trace def get202_none204_none_default_error202_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 202 response with no payload. @@ -1224,17 +1325,24 @@ def get202_none204_none_default_error202_none( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_error202_none_request( - template_url=self.get202_none204_none_default_error202_none.metadata["url"], + template_url=self.get202_none204_none_default_error202_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1245,11 +1353,13 @@ def get202_none204_none_default_error202_none( if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_error202_none.metadata = {"url": "/http/payloads/202/none/204/none/default/Error/response/202/none"} # type: ignore + get202_none204_none_default_error202_none.metadata = {'url': '/http/payloads/202/none/204/none/default/Error/response/202/none'} # type: ignore + @distributed_trace def get202_none204_none_default_error204_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 204 response with no payload. @@ -1259,17 +1369,24 @@ def get202_none204_none_default_error204_none( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_error204_none_request( - template_url=self.get202_none204_none_default_error204_none.metadata["url"], + template_url=self.get202_none204_none_default_error204_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1280,11 +1397,13 @@ def get202_none204_none_default_error204_none( if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_error204_none.metadata = {"url": "/http/payloads/202/none/204/none/default/Error/response/204/none"} # type: ignore + get202_none204_none_default_error204_none.metadata = {'url': '/http/payloads/202/none/204/none/default/Error/response/204/none'} # type: ignore + @distributed_trace def get202_none204_none_default_error400_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. @@ -1294,17 +1413,24 @@ def get202_none204_none_default_error400_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_error400_valid_request( - template_url=self.get202_none204_none_default_error400_valid.metadata["url"], + template_url=self.get202_none204_none_default_error400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1315,11 +1441,13 @@ def get202_none204_none_default_error400_valid( if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_error400_valid.metadata = {"url": "/http/payloads/202/none/204/none/default/Error/response/400/valid"} # type: ignore + get202_none204_none_default_error400_valid.metadata = {'url': '/http/payloads/202/none/204/none/default/Error/response/400/valid'} # type: ignore + @distributed_trace def get202_none204_none_default_none202_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 202 response with an unexpected payload {'property': 'value'}. @@ -1329,17 +1457,24 @@ def get202_none204_none_default_none202_invalid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none202_invalid_request( - template_url=self.get202_none204_none_default_none202_invalid.metadata["url"], + template_url=self.get202_none204_none_default_none202_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1349,11 +1484,13 @@ def get202_none204_none_default_none202_invalid( if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none202_invalid.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/202/invalid"} # type: ignore + get202_none204_none_default_none202_invalid.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/202/invalid'} # type: ignore + @distributed_trace def get202_none204_none_default_none204_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 204 response with no payload. @@ -1363,17 +1500,24 @@ def get202_none204_none_default_none204_none( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none204_none_request( - template_url=self.get202_none204_none_default_none204_none.metadata["url"], + template_url=self.get202_none204_none_default_none204_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1383,11 +1527,13 @@ def get202_none204_none_default_none204_none( if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none204_none.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/204/none"} # type: ignore + get202_none204_none_default_none204_none.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/204/none'} # type: ignore + @distributed_trace def get202_none204_none_default_none400_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 400 response with no payload. @@ -1397,17 +1543,24 @@ def get202_none204_none_default_none400_none( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none400_none_request( - template_url=self.get202_none204_none_default_none400_none.metadata["url"], + template_url=self.get202_none204_none_default_none400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1417,11 +1570,13 @@ def get202_none204_none_default_none400_none( if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none400_none.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/400/none"} # type: ignore + get202_none204_none_default_none400_none.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/400/none'} # type: ignore + @distributed_trace def get202_none204_none_default_none400_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 400 response with an unexpected payload {'property': 'value'}. @@ -1431,17 +1586,24 @@ def get202_none204_none_default_none400_invalid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get202_none204_none_default_none400_invalid_request( - template_url=self.get202_none204_none_default_none400_invalid.metadata["url"], + template_url=self.get202_none204_none_default_none400_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -1451,11 +1613,13 @@ def get202_none204_none_default_none400_invalid( if cls: return cls(pipeline_response, None, {}) - get202_none204_none_default_none400_invalid.metadata = {"url": "/http/payloads/202/none/204/none/default/none/response/400/invalid"} # type: ignore + get202_none204_none_default_none400_invalid.metadata = {'url': '/http/payloads/202/none/204/none/default/none/response/400/invalid'} # type: ignore + @distributed_trace def get_default_model_a200_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 200 response with valid payload: {'statusCode': '200'}. @@ -1465,35 +1629,44 @@ def get_default_model_a200_valid( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a200_valid_request( - template_url=self.get_default_model_a200_valid.metadata["url"], + template_url=self.get_default_model_a200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_default_model_a200_valid.metadata = {"url": "/http/payloads/default/A/response/200/valid"} # type: ignore + get_default_model_a200_valid.metadata = {'url': '/http/payloads/default/A/response/200/valid'} # type: ignore + @distributed_trace def get_default_model_a200_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 200 response with no payload. @@ -1503,35 +1676,44 @@ def get_default_model_a200_none( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a200_none_request( - template_url=self.get_default_model_a200_none.metadata["url"], + template_url=self.get_default_model_a200_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_default_model_a200_none.metadata = {"url": "/http/payloads/default/A/response/200/none"} # type: ignore + get_default_model_a200_none.metadata = {'url': '/http/payloads/default/A/response/200/none'} # type: ignore + @distributed_trace def get_default_model_a400_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 400 response with valid payload: {'statusCode': '400'}. @@ -1541,17 +1723,24 @@ def get_default_model_a400_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a400_valid_request( - template_url=self.get_default_model_a400_valid.metadata["url"], + template_url=self.get_default_model_a400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1562,11 +1751,13 @@ def get_default_model_a400_valid( if cls: return cls(pipeline_response, None, {}) - get_default_model_a400_valid.metadata = {"url": "/http/payloads/default/A/response/400/valid"} # type: ignore + get_default_model_a400_valid.metadata = {'url': '/http/payloads/default/A/response/400/valid'} # type: ignore + @distributed_trace def get_default_model_a400_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 400 response with no payload. @@ -1576,17 +1767,24 @@ def get_default_model_a400_none( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_model_a400_none_request( - template_url=self.get_default_model_a400_none.metadata["url"], + template_url=self.get_default_model_a400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1597,11 +1795,13 @@ def get_default_model_a400_none( if cls: return cls(pipeline_response, None, {}) - get_default_model_a400_none.metadata = {"url": "/http/payloads/default/A/response/400/none"} # type: ignore + get_default_model_a400_none.metadata = {'url': '/http/payloads/default/A/response/400/none'} # type: ignore + @distributed_trace def get_default_none200_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 200 response with invalid payload: {'statusCode': '200'}. @@ -1611,17 +1811,24 @@ def get_default_none200_invalid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none200_invalid_request( - template_url=self.get_default_none200_invalid.metadata["url"], + template_url=self.get_default_none200_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1631,11 +1838,13 @@ def get_default_none200_invalid( if cls: return cls(pipeline_response, None, {}) - get_default_none200_invalid.metadata = {"url": "/http/payloads/default/none/response/200/invalid"} # type: ignore + get_default_none200_invalid.metadata = {'url': '/http/payloads/default/none/response/200/invalid'} # type: ignore + @distributed_trace def get_default_none200_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 200 response with no payload. @@ -1645,17 +1854,24 @@ def get_default_none200_none( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none200_none_request( - template_url=self.get_default_none200_none.metadata["url"], + template_url=self.get_default_none200_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1665,11 +1881,13 @@ def get_default_none200_none( if cls: return cls(pipeline_response, None, {}) - get_default_none200_none.metadata = {"url": "/http/payloads/default/none/response/200/none"} # type: ignore + get_default_none200_none.metadata = {'url': '/http/payloads/default/none/response/200/none'} # type: ignore + @distributed_trace def get_default_none400_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 400 response with valid payload: {'statusCode': '400'}. @@ -1679,17 +1897,24 @@ def get_default_none400_invalid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none400_invalid_request( - template_url=self.get_default_none400_invalid.metadata["url"], + template_url=self.get_default_none400_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1699,11 +1924,13 @@ def get_default_none400_invalid( if cls: return cls(pipeline_response, None, {}) - get_default_none400_invalid.metadata = {"url": "/http/payloads/default/none/response/400/invalid"} # type: ignore + get_default_none400_invalid.metadata = {'url': '/http/payloads/default/none/response/400/invalid'} # type: ignore + @distributed_trace def get_default_none400_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Send a 400 response with no payload. @@ -1713,17 +1940,24 @@ def get_default_none400_none( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_default_none400_none_request( - template_url=self.get_default_none400_none.metadata["url"], + template_url=self.get_default_none400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1733,11 +1967,13 @@ def get_default_none400_none( if cls: return cls(pipeline_response, None, {}) - get_default_none400_none.metadata = {"url": "/http/payloads/default/none/response/400/none"} # type: ignore + get_default_none400_none.metadata = {'url': '/http/payloads/default/none/response/400/none'} # type: ignore + @distributed_trace def get200_model_a200_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 200 response with no payload, when a payload is expected - client should return a null @@ -1748,35 +1984,44 @@ def get200_model_a200_none( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a200_none_request( - template_url=self.get200_model_a200_none.metadata["url"], + template_url=self.get200_model_a200_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a200_none.metadata = {"url": "/http/payloads/200/A/response/200/none"} # type: ignore + get200_model_a200_none.metadata = {'url': '/http/payloads/200/A/response/200/none'} # type: ignore + @distributed_trace def get200_model_a200_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 200 response with payload {'statusCode': '200'}. @@ -1786,35 +2031,44 @@ def get200_model_a200_valid( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a200_valid_request( - template_url=self.get200_model_a200_valid.metadata["url"], + template_url=self.get200_model_a200_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a200_valid.metadata = {"url": "/http/payloads/200/A/response/200/valid"} # type: ignore + get200_model_a200_valid.metadata = {'url': '/http/payloads/200/A/response/200/valid'} # type: ignore + @distributed_trace def get200_model_a200_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. @@ -1824,35 +2078,44 @@ def get200_model_a200_invalid( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a200_invalid_request( - template_url=self.get200_model_a200_invalid.metadata["url"], + template_url=self.get200_model_a200_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a200_invalid.metadata = {"url": "/http/payloads/200/A/response/200/invalid"} # type: ignore + get200_model_a200_invalid.metadata = {'url': '/http/payloads/200/A/response/200/invalid'} # type: ignore + @distributed_trace def get200_model_a400_none( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 400 response with no payload client should treat as an http error with no error model. @@ -1862,35 +2125,44 @@ def get200_model_a400_none( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a400_none_request( - template_url=self.get200_model_a400_none.metadata["url"], + template_url=self.get200_model_a400_none.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a400_none.metadata = {"url": "/http/payloads/200/A/response/400/none"} # type: ignore + get200_model_a400_none.metadata = {'url': '/http/payloads/200/A/response/400/none'} # type: ignore + @distributed_trace def get200_model_a400_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 200 response with payload {'statusCode': '400'}. @@ -1900,35 +2172,44 @@ def get200_model_a400_valid( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a400_valid_request( - template_url=self.get200_model_a400_valid.metadata["url"], + template_url=self.get200_model_a400_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a400_valid.metadata = {"url": "/http/payloads/200/A/response/400/valid"} # type: ignore + get200_model_a400_valid.metadata = {'url': '/http/payloads/200/A/response/400/valid'} # type: ignore + @distributed_trace def get200_model_a400_invalid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. @@ -1938,35 +2219,44 @@ def get200_model_a400_invalid( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a400_invalid_request( - template_url=self.get200_model_a400_invalid.metadata["url"], + template_url=self.get200_model_a400_invalid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a400_invalid.metadata = {"url": "/http/payloads/200/A/response/400/invalid"} # type: ignore + get200_model_a400_invalid.metadata = {'url': '/http/payloads/200/A/response/400/invalid'} # type: ignore + @distributed_trace def get200_model_a202_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.MyException" """Send a 202 response with payload {'statusCode': '202'}. @@ -1976,28 +2266,36 @@ def get200_model_a202_valid( :rtype: ~httpinfrastructure.models.MyException :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.MyException"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.MyException"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get200_model_a202_valid_request( - template_url=self.get200_model_a202_valid.metadata["url"], + template_url=self.get200_model_a202_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("MyException", pipeline_response) + deserialized = self._deserialize('MyException', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get200_model_a202_valid.metadata = {"url": "/http/payloads/200/A/response/202/valid"} # type: ignore + get200_model_a202_valid.metadata = {'url': '/http/payloads/200/A/response/202/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py index 69f380ec95e..af804916116 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/__init__.py index f4cc0652a6a..327d291fc6e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["IncorrectReturnedErrorModel"] +__all__ = ['IncorrectReturnedErrorModel'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_configuration.py index a5f2e613aa7..32337034315 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class IncorrectReturnedErrorModelConfiguration(Configuration): +class IncorrectReturnedErrorModelConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IncorrectReturnedErrorModel. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class IncorrectReturnedErrorModelConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(IncorrectReturnedErrorModelConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "incorrectreturnederrormodel/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'incorrectreturnederrormodel/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py index b38258faa9d..dacf20e4cac 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py @@ -18,13 +18,13 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class IncorrectReturnedErrorModel(IncorrectReturnedErrorModelOperationsMixin): - """Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. + """Test to see when throwing an HttpResponseError whether we swallow error model deserialization + errors. :param base_url: Service URL. Default value is 'http://localhost:3000'. :type base_url: str @@ -44,6 +44,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/__init__.py index 2a4a1d94e74..13d865896d6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._incorrect_returned_error_model import IncorrectReturnedErrorModel - -__all__ = ["IncorrectReturnedErrorModel"] +__all__ = ['IncorrectReturnedErrorModel'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_configuration.py index 556842de3fd..f1b3366ed98 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class IncorrectReturnedErrorModelConfiguration(Configuration): +class IncorrectReturnedErrorModelConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IncorrectReturnedErrorModel. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(IncorrectReturnedErrorModelConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "incorrectreturnederrormodel/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'incorrectreturnederrormodel/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py index e67f162cfba..8d98890247a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,15 +17,19 @@ from ._configuration import IncorrectReturnedErrorModelConfiguration from .operations import IncorrectReturnedErrorModelOperationsMixin - class IncorrectReturnedErrorModel(IncorrectReturnedErrorModelOperationsMixin): - """Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. + """Test to see when throwing an HttpResponseError whether we swallow error model deserialization + errors. :param base_url: Service URL. Default value is 'http://localhost:3000'. :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = IncorrectReturnedErrorModelConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -34,7 +38,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/__init__.py index 7587d755352..6a939a1cfcd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._incorrect_returned_error_model_operations import IncorrectReturnedErrorModelOperationsMixin __all__ = [ - "IncorrectReturnedErrorModelOperationsMixin", + 'IncorrectReturnedErrorModelOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py index 874139ff006..62f17be3d88 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,14 +17,16 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._incorrect_returned_error_model_operations import build_get_incorrect_error_from_server_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class IncorrectReturnedErrorModelOperationsMixin: + @distributed_trace_async - async def get_incorrect_error_from_server(self, **kwargs: Any) -> None: + async def get_incorrect_error_from_server( + self, + **kwargs: Any + ) -> None: """Get an error response from the server that is not as described in our Error object. Want to swallow the deserialization error and still return an HttpResponseError to the users. @@ -40,17 +35,24 @@ async def get_incorrect_error_from_server(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_incorrect_error_from_server_request( - template_url=self.get_incorrect_error_from_server.metadata["url"], + template_url=self.get_incorrect_error_from_server.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -60,4 +62,5 @@ async def get_incorrect_error_from_server(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_incorrect_error_from_server.metadata = {"url": "/incorrectError"} # type: ignore + get_incorrect_error_from_server.metadata = {'url': '/incorrectError'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models.py index 24f34f6486a..04624aa582b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models.py @@ -19,11 +19,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -31,5 +34,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models_py3.py index 193592d4755..2cbead8e4d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_models_py3.py @@ -21,11 +21,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/__init__.py index 7587d755352..6a939a1cfcd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/__init__.py @@ -9,5 +9,5 @@ from ._incorrect_returned_error_model_operations import IncorrectReturnedErrorModelOperationsMixin __all__ = [ - "IncorrectReturnedErrorModelOperationsMixin", + 'IncorrectReturnedErrorModelOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py index 3ccdf42787b..4956b69d55e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -51,9 +43,11 @@ def build_get_incorrect_error_from_server_request( # fmt: on class IncorrectReturnedErrorModelOperationsMixin(object): + @distributed_trace def get_incorrect_error_from_server( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get an error response from the server that is not as described in our Error object. Want to @@ -64,17 +58,24 @@ def get_incorrect_error_from_server( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_incorrect_error_from_server_request( - template_url=self.get_incorrect_error_from_server.metadata["url"], + template_url=self.get_incorrect_error_from_server.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,4 +85,5 @@ def get_incorrect_error_from_server( if cls: return cls(pipeline_response, None, {}) - get_incorrect_error_from_server.metadata = {"url": "/incorrectError"} # type: ignore + get_incorrect_error_from_server.metadata = {'url': '/incorrectError'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py index 883660291b0..c15c8094059 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/__init__.py index d92d78cce53..cf828cedf2d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MediaTypesClient"] +__all__ = ['MediaTypesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_configuration.py index 4fb0dd8a354..b234658e3e9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class MediaTypesClientConfiguration(Configuration): +class MediaTypesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MediaTypesClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class MediaTypesClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(MediaTypesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mediatypesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mediatypesclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py index 70be699931a..932fe777bb7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class MediaTypesClient(MediaTypesClientOperationsMixin): """Play with produces/consumes and media-types in general. @@ -44,6 +43,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/__init__.py index f0f38f71e24..647fe0041e3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._media_types_client import MediaTypesClient - -__all__ = ["MediaTypesClient"] +__all__ = ['MediaTypesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_configuration.py index 4048232998c..03eeae896ad 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class MediaTypesClientConfiguration(Configuration): +class MediaTypesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MediaTypesClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MediaTypesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mediatypesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mediatypesclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py index 14995d89b46..794a20c7382 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import MediaTypesClientConfiguration from .operations import MediaTypesClientOperationsMixin - class MediaTypesClient(MediaTypesClientOperationsMixin): """Play with produces/consumes and media-types in general. @@ -25,7 +24,11 @@ class MediaTypesClient(MediaTypesClientOperationsMixin): :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MediaTypesClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -34,7 +37,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/__init__.py index 54f416a6b45..d4e70d11ab3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._media_types_client_operations import MediaTypesClientOperationsMixin __all__ = [ - "MediaTypesClientOperationsMixin", + 'MediaTypesClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py index 9b71da223c6..f04009c1849 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,22 +16,18 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._media_types_client_operations import ( - build_analyze_body_no_accept_header_request, - build_analyze_body_request, - build_binary_body_with_three_content_types_request, - build_binary_body_with_two_content_types_request, - build_content_type_with_encoding_request, - build_put_text_and_json_body_request, -) - -T = TypeVar("T") +from ...operations._media_types_client_operations import build_analyze_body_no_accept_header_request, build_analyze_body_request, build_binary_body_with_three_content_types_request, build_binary_body_with_two_content_types_request, build_content_type_with_encoding_request, build_put_text_and_json_body_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class MediaTypesClientOperationsMixin: + @distributed_trace_async - async def analyze_body(self, input: Optional[Union[IO, "_models.SourcePath"]] = None, **kwargs: Any) -> str: + async def analyze_body( + self, + input: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs: Any + ) -> str: """Analyze body, that could be different media types. :param input: Input parameter. @@ -51,20 +40,20 @@ async def analyze_body(self, input: Optional[Union[IO, "_models.SourcePath"]] = :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop( - "content_type", "application/json" - ) # type: Optional[Union[str, "_models.ContentType"]] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[Union[str, "_models.ContentType"]] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: - _json = self._serialize.body(input, "SourcePath") - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + _json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -76,30 +65,37 @@ async def analyze_body(self, input: Optional[Union[IO, "_models.SourcePath"]] = content_type=content_type, json=_json, content=_content, - template_url=self.analyze_body.metadata["url"], + template_url=self.analyze_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - analyze_body.metadata = {"url": "/mediatypes/analyze"} # type: ignore + analyze_body.metadata = {'url': '/mediatypes/analyze'} # type: ignore + @distributed_trace_async async def analyze_body_no_accept_header( - self, input: Optional[Union[IO, "_models.SourcePath"]] = None, **kwargs: Any + self, + input: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs: Any ) -> None: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -114,20 +110,20 @@ async def analyze_body_no_accept_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop( - "content_type", "application/json" - ) # type: Optional[Union[str, "_models.ContentType"]] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[Union[str, "_models.ContentType"]] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: - _json = self._serialize.body(input, "SourcePath") - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + _json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -139,12 +135,16 @@ async def analyze_body_no_accept_header( content_type=content_type, json=_json, content=_content, - template_url=self.analyze_body_no_accept_header.metadata["url"], + template_url=self.analyze_body_no_accept_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -154,10 +154,15 @@ async def analyze_body_no_accept_header( if cls: return cls(pipeline_response, None, {}) - analyze_body_no_accept_header.metadata = {"url": "/mediatypes/analyzeNoAccept"} # type: ignore + analyze_body_no_accept_header.metadata = {'url': '/mediatypes/analyzeNoAccept'} # type: ignore + @distributed_trace_async - async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) -> str: + async def content_type_with_encoding( + self, + input: Optional[str] = None, + **kwargs: Any + ) -> str: """Pass in contentType 'text/plain; charset=UTF-8' to pass test. Value for input does not matter. :param input: Input parameter. @@ -167,40 +172,51 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "text/plain; charset=UTF-8") # type: Optional[str] + content_type = kwargs.pop('content_type', "text/plain; charset=UTF-8") # type: Optional[str] _content = input request = build_content_type_with_encoding_request( content_type=content_type, content=_content, - template_url=self.content_type_with_encoding.metadata["url"], + template_url=self.content_type_with_encoding.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore + content_type_with_encoding.metadata = {'url': '/mediatypes/contentTypeWithEncoding'} # type: ignore + @distributed_trace_async - async def binary_body_with_two_content_types(self, message: IO, **kwargs: Any) -> str: + async def binary_body_with_two_content_types( + self, + message: IO, + **kwargs: Any + ) -> str: """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream. @@ -211,40 +227,51 @@ async def binary_body_with_two_content_types(self, message: IO, **kwargs: Any) - :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[Union[str, "_models.ContentType1"]] + content_type = kwargs.pop('content_type', None) # type: Optional[Union[str, "_models.ContentType1"]] _content = message request = build_binary_body_with_two_content_types_request( content_type=content_type, content=_content, - template_url=self.binary_body_with_two_content_types.metadata["url"], + template_url=self.binary_body_with_two_content_types.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - binary_body_with_two_content_types.metadata = {"url": "/mediatypes/binaryBodyTwoContentTypes"} # type: ignore + binary_body_with_two_content_types.metadata = {'url': '/mediatypes/binaryBodyTwoContentTypes'} # type: ignore + @distributed_trace_async - async def binary_body_with_three_content_types(self, message: Union[IO, str], **kwargs: Any) -> str: + async def binary_body_with_three_content_types( + self, + message: Union[IO, str], + **kwargs: Any + ) -> str: """Binary body with three content types. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for 'application/octet-stream'. @@ -259,42 +286,51 @@ async def binary_body_with_three_content_types(self, message: Union[IO, str], ** :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop( - "content_type", "application/json" - ) # type: Optional[Union[str, "_models.ContentType1"]] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[Union[str, "_models.ContentType1"]] _content = message request = build_binary_body_with_three_content_types_request( content_type=content_type, content=_content, - template_url=self.binary_body_with_three_content_types.metadata["url"], + template_url=self.binary_body_with_three_content_types.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - binary_body_with_three_content_types.metadata = {"url": "/mediatypes/binaryBodyThreeContentTypes"} # type: ignore + binary_body_with_three_content_types.metadata = {'url': '/mediatypes/binaryBodyThreeContentTypes'} # type: ignore + @distributed_trace_async - async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str: + async def put_text_and_json_body( + self, + message: Union[str, str], + **kwargs: Any + ) -> str: """Body that's either text/plain or application/json. :param message: The payload body. @@ -306,17 +342,19 @@ async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["text/plain"]: + elif content_type.split(";")[0] in ['text/plain']: _content = message else: raise ValueError( @@ -328,23 +366,28 @@ async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) content_type=content_type, json=_json, content=_content, - template_url=self.put_text_and_json_body.metadata["url"], + template_url=self.put_text_and_json_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_text_and_json_body.metadata = {"url": "/mediatypes/textAndJson"} # type: ignore + put_text_and_json_body.metadata = {'url': '/mediatypes/textAndJson'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py index 79d9ce83bdc..28152bbb7bd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py @@ -17,7 +17,7 @@ ) __all__ = [ - "SourcePath", - "ContentType", - "ContentType1", + 'SourcePath', + 'ContentType', + 'ContentType1', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py index 36913f11d13..2c28ca1f0d8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_media_types_client_enums.py @@ -12,7 +12,8 @@ class ContentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Content type for upload""" + """Content type for upload + """ #: Content Type 'application/pdf'. APPLICATION_PDF = "application/pdf" @@ -25,9 +26,9 @@ class ContentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Content Type 'application/json'. APPLICATION_JSON = "application/json" - class ContentType1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Content type for upload""" + """Content type for upload + """ #: Content Type 'application/json'. APPLICATION_JSON = "application/json" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models.py index 20070e4fb3d..1ccd3682b33 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models.py @@ -17,17 +17,20 @@ class SourcePath(msrest.serialization.Model): """ _validation = { - "source": {"max_length": 2048, "min_length": 0}, + 'source': {'max_length': 2048, 'min_length': 0}, } _attribute_map = { - "source": {"key": "source", "type": "str"}, + 'source': {'key': 'source', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword source: File source path. :paramtype source: str """ super(SourcePath, self).__init__(**kwargs) - self.source = kwargs.get("source", None) + self.source = kwargs.get('source', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models_py3.py index 0d7c895baf8..3d5c143d915 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_models_py3.py @@ -19,14 +19,19 @@ class SourcePath(msrest.serialization.Model): """ _validation = { - "source": {"max_length": 2048, "min_length": 0}, + 'source': {'max_length': 2048, 'min_length': 0}, } _attribute_map = { - "source": {"key": "source", "type": "str"}, + 'source': {'key': 'source', 'type': 'str'}, } - def __init__(self, *, source: Optional[str] = None, **kwargs): + def __init__( + self, + *, + source: Optional[str] = None, + **kwargs + ): """ :keyword source: File source path. :paramtype source: str diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/__init__.py index 54f416a6b45..d4e70d11ab3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/__init__.py @@ -9,5 +9,5 @@ from ._media_types_client_operations import MediaTypesClientOperationsMixin __all__ = [ - "MediaTypesClientOperationsMixin", + 'MediaTypesClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py index f652b354a0c..d9830ccf0cf 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -179,6 +171,7 @@ def build_put_text_and_json_body_request( # fmt: on class MediaTypesClientOperationsMixin(object): + @distributed_trace def analyze_body( self, @@ -198,20 +191,20 @@ def analyze_body( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop( - "content_type", "application/json" - ) # type: Optional[Union[str, "_models.ContentType"]] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[Union[str, "_models.ContentType"]] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: - _json = self._serialize.body(input, "SourcePath") - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + _json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -223,26 +216,31 @@ def analyze_body( content_type=content_type, json=_json, content=_content, - template_url=self.analyze_body.metadata["url"], + template_url=self.analyze_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - analyze_body.metadata = {"url": "/mediatypes/analyze"} # type: ignore + analyze_body.metadata = {'url': '/mediatypes/analyze'} # type: ignore + @distributed_trace def analyze_body_no_accept_header( @@ -264,20 +262,20 @@ def analyze_body_no_accept_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop( - "content_type", "application/json" - ) # type: Optional[Union[str, "_models.ContentType"]] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[Union[str, "_models.ContentType"]] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: - _json = self._serialize.body(input, "SourcePath") - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + _json = self._serialize.body(input, 'SourcePath') + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -289,12 +287,16 @@ def analyze_body_no_accept_header( content_type=content_type, json=_json, content=_content, - template_url=self.analyze_body_no_accept_header.metadata["url"], + template_url=self.analyze_body_no_accept_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -304,7 +306,8 @@ def analyze_body_no_accept_header( if cls: return cls(pipeline_response, None, {}) - analyze_body_no_accept_header.metadata = {"url": "/mediatypes/analyzeNoAccept"} # type: ignore + analyze_body_no_accept_header.metadata = {'url': '/mediatypes/analyzeNoAccept'} # type: ignore + @distributed_trace def content_type_with_encoding( @@ -322,37 +325,44 @@ def content_type_with_encoding( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "text/plain; charset=UTF-8") # type: Optional[str] + content_type = kwargs.pop('content_type', "text/plain; charset=UTF-8") # type: Optional[str] _content = input request = build_content_type_with_encoding_request( content_type=content_type, content=_content, - template_url=self.content_type_with_encoding.metadata["url"], + template_url=self.content_type_with_encoding.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - content_type_with_encoding.metadata = {"url": "/mediatypes/contentTypeWithEncoding"} # type: ignore + content_type_with_encoding.metadata = {'url': '/mediatypes/contentTypeWithEncoding'} # type: ignore + @distributed_trace def binary_body_with_two_content_types( @@ -371,37 +381,44 @@ def binary_body_with_two_content_types( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[Union[str, "_models.ContentType1"]] + content_type = kwargs.pop('content_type', None) # type: Optional[Union[str, "_models.ContentType1"]] _content = message request = build_binary_body_with_two_content_types_request( content_type=content_type, content=_content, - template_url=self.binary_body_with_two_content_types.metadata["url"], + template_url=self.binary_body_with_two_content_types.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - binary_body_with_two_content_types.metadata = {"url": "/mediatypes/binaryBodyTwoContentTypes"} # type: ignore + binary_body_with_two_content_types.metadata = {'url': '/mediatypes/binaryBodyTwoContentTypes'} # type: ignore + @distributed_trace def binary_body_with_three_content_types( @@ -424,39 +441,44 @@ def binary_body_with_three_content_types( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop( - "content_type", "application/json" - ) # type: Optional[Union[str, "_models.ContentType1"]] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[Union[str, "_models.ContentType1"]] _content = message request = build_binary_body_with_three_content_types_request( content_type=content_type, content=_content, - template_url=self.binary_body_with_three_content_types.metadata["url"], + template_url=self.binary_body_with_three_content_types.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - binary_body_with_three_content_types.metadata = {"url": "/mediatypes/binaryBodyThreeContentTypes"} # type: ignore + binary_body_with_three_content_types.metadata = {'url': '/mediatypes/binaryBodyThreeContentTypes'} # type: ignore + @distributed_trace def put_text_and_json_body( @@ -476,17 +498,19 @@ def put_text_and_json_body( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["text/plain"]: + elif content_type.split(";")[0] in ['text/plain']: _content = message else: raise ValueError( @@ -498,23 +522,28 @@ def put_text_and_json_body( content_type=content_type, json=_json, content=_content, - template_url=self.put_text_and_json_body.metadata["url"], + template_url=self.put_text_and_json_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_text_and_json_body.metadata = {"url": "/mediatypes/textAndJson"} # type: ignore + put_text_and_json_body.metadata = {'url': '/mediatypes/textAndJson'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py index 5c8489e8153..ca942bf04fb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Play with produces/consumes and media-types in general. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/__init__.py index 3195481e948..abe8ddc2864 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MergePatchJsonClient"] +__all__ = ['MergePatchJsonClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_configuration.py index d380abbde51..fc0b6df46b2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class MergePatchJsonClientConfiguration(Configuration): +class MergePatchJsonClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MergePatchJsonClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class MergePatchJsonClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(MergePatchJsonClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mergepatchjsonclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mergepatchjsonclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py index c789629298e..17871d8fdba 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py @@ -17,11 +17,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.rest import HttpRequest, HttpResponse - class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): """Service client for testing merge patch json. @@ -43,6 +42,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_object_type_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_object_type_client.py deleted file mode 100644 index 3e86486fa6a..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_object_type_client.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import TYPE_CHECKING - -from azure.core import PipelineClient -from msrest import Deserializer, Serializer - -from ._configuration import ObjectTypeClientConfiguration -from .operations import ObjectTypeClientOperationsMixin - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional - - from azure.core.rest import HttpRequest, HttpResponse - - -class ObjectTypeClient(ObjectTypeClientOperationsMixin): - """Service client for testing basic type: object swaggers. - - :param base_url: Service URL. Default value is 'http://localhost:3000'. - :type base_url: str - """ - - def __init__( - self, - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None - self._config = ObjectTypeClientConfiguration(**kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {} # type: Dict[str, Any] - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> ObjectTypeClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/__init__.py index 350a9ddb952..bd5eb1ce33d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._merge_patch_json_client import MergePatchJsonClient - -__all__ = ["MergePatchJsonClient"] +__all__ = ['MergePatchJsonClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_configuration.py index 89b78fceea2..b163ea72dd7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class MergePatchJsonClientConfiguration(Configuration): +class MergePatchJsonClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MergePatchJsonClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MergePatchJsonClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mergepatchjsonclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mergepatchjsonclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py index 733f98c31a1..43902102aaa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): """Service client for testing merge patch json. @@ -28,7 +27,11 @@ class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MergePatchJsonClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_object_type_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_object_type_client.py deleted file mode 100644 index 7061faa0de3..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_object_type_client.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core import AsyncPipelineClient -from azure.core.rest import AsyncHttpResponse, HttpRequest -from msrest import Deserializer, Serializer - -from ._configuration import ObjectTypeClientConfiguration -from .operations import ObjectTypeClientOperationsMixin - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Dict - - -class ObjectTypeClient(ObjectTypeClientOperationsMixin): - """Service client for testing basic type: object swaggers. - - :param base_url: Service URL. Default value is 'http://localhost:3000'. - :type base_url: str - """ - - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = ObjectTypeClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {} # type: Dict[str, Any] - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ObjectTypeClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/__init__.py index fa058051ced..a5da122eff5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._merge_patch_json_client_operations import MergePatchJsonClientOperationsMixin __all__ = [ - "MergePatchJsonClientOperationsMixin", + 'MergePatchJsonClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py index 81659c08329..d3e3f2671de 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,14 +16,17 @@ from ..._vendor import _convert_request from ...operations._merge_patch_json_client_operations import build_patch_single_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class MergePatchJsonClientOperationsMixin: + @distributed_trace_async - async def patch_single(self, body: Any, **kwargs: Any) -> None: + async def patch_single( + self, + body: Any, + **kwargs: Any + ) -> None: """Basic patch with an object. :param body: Pass in {'foo': 'bar'} for a 200, anything else for an object error. @@ -40,31 +36,38 @@ async def patch_single(self, body: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/merge-patch+json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/merge-patch+json") # type: Optional[str] - _json = self._serialize.body(body, "object") + _json = self._serialize.body(body, 'object') request = build_patch_single_request( content_type=content_type, json=_json, - template_url=self.patch_single.metadata["url"], + template_url=self.patch_single.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) + error = self._deserialize.failsafe_deserialize('object', pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {}) - patch_single.metadata = {"url": "/mergePatchJson/single"} # type: ignore + patch_single.metadata = {'url': '/mergePatchJson/single'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_object_type_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_object_type_client_operations.py deleted file mode 100644 index f25d4fae8fb..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_object_type_client_operations.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async - -from ..._vendor import _convert_request -from ...operations._object_type_client_operations import build_patch_single_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ObjectTypeClientOperationsMixin: - @distributed_trace_async - async def patch_single(self, body: Any, **kwargs: Any) -> None: - """Basic patch with an object. - - :param body: Pass in {'foo': 'bar'} for a 200, anything else for an object error. - :type body: any - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - content_type = kwargs.pop("content_type", "application/merge-patch+json") # type: Optional[str] - - _json = self._serialize.body(body, "object") - - request = build_patch_single_request( - content_type=content_type, - json=_json, - template_url=self.patch_single.metadata["url"], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - patch_single.metadata = {"url": "/mergePatchJson/single"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/__init__.py index fa058051ced..a5da122eff5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/__init__.py @@ -9,5 +9,5 @@ from ._merge_patch_json_client_operations import MergePatchJsonClientOperationsMixin __all__ = [ - "MergePatchJsonClientOperationsMixin", + 'MergePatchJsonClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py index e84154add28..2941777875e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -26,9 +19,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -60,6 +52,7 @@ def build_patch_single_request( # fmt: on class MergePatchJsonClientOperationsMixin(object): + @distributed_trace def patch_single( self, @@ -76,31 +69,38 @@ def patch_single( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/merge-patch+json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/merge-patch+json") # type: Optional[str] - _json = self._serialize.body(body, "object") + _json = self._serialize.body(body, 'object') request = build_patch_single_request( content_type=content_type, json=_json, - template_url=self.patch_single.metadata["url"], + template_url=self.patch_single.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) + error = self._deserialize.failsafe_deserialize('object', pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {}) - patch_single.metadata = {"url": "/mergePatchJson/single"} # type: ignore + patch_single.metadata = {'url': '/mergePatchJson/single'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_object_type_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_object_type_client_operations.py deleted file mode 100644 index e56c9db154f..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_object_type_client_operations.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from msrest import Serializer - -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False -# fmt: off - -def build_patch_single_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/mergePatchJson/single') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - headers=header_parameters, - **kwargs - ) - -# fmt: on -class ObjectTypeClientOperationsMixin(object): - @distributed_trace - def patch_single( - self, - body, # type: Any - **kwargs # type: Any - ): - # type: (...) -> None - """Basic patch with an object. - - :param body: Pass in {'foo': 'bar'} for a 200, anything else for an object error. - :type body: any - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - content_type = kwargs.pop("content_type", "application/merge-patch+json") # type: Optional[str] - - _json = self._serialize.body(body, "object") - - request = build_patch_single_request( - content_type=content_type, - json=_json, - template_url=self.patch_single.metadata["url"], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - patch_single.metadata = {"url": "/mergePatchJson/single"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py index 4b34ab99a32..01a8c8d1749 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing merge patch json. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/__init__.py index 52cd05a592d..dd34ba75521 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestResourceFlatteningTestService"] +__all__ = ['AutoRestResourceFlatteningTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py index 34adc2fb177..7639df2a4ce 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestResourceFlatteningTestService(AutoRestResourceFlatteningTestServiceOperationsMixin): """Resource Flattening for AutoRest. @@ -44,6 +43,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_configuration.py index 70070e83c02..022b92db5bf 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): +class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestResourceFlatteningTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestResourceFlatteningTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestresourceflatteningtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestresourceflatteningtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/__init__.py index 0063e0ded58..86f206c8bec 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_resource_flattening_test_service import AutoRestResourceFlatteningTestService - -__all__ = ["AutoRestResourceFlatteningTestService"] +__all__ = ['AutoRestResourceFlatteningTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py index ec95e5765ad..41a47cdeac1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestResourceFlatteningTestServiceConfiguration from .operations import AutoRestResourceFlatteningTestServiceOperationsMixin - class AutoRestResourceFlatteningTestService(AutoRestResourceFlatteningTestServiceOperationsMixin): """Resource Flattening for AutoRest. @@ -25,7 +24,11 @@ class AutoRestResourceFlatteningTestService(AutoRestResourceFlatteningTestServic :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestResourceFlatteningTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -34,7 +37,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_configuration.py index c4cc1600aaf..dc0f961acfb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): +class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestResourceFlatteningTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestResourceFlatteningTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestresourceflatteningtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestresourceflatteningtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/__init__.py index 753b984bc23..97acfd337b3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_resource_flattening_test_service_operations import AutoRestResourceFlatteningTestServiceOperationsMixin __all__ = [ - "AutoRestResourceFlatteningTestServiceOperationsMixin", + 'AutoRestResourceFlatteningTestServiceOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py index 30ec8b9274a..df085f4000a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,27 +16,18 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._auto_rest_resource_flattening_test_service_operations import ( - build_get_array_request, - build_get_dictionary_request, - build_get_resource_collection_request, - build_get_wrapped_array_request, - build_post_flattened_simple_product_request, - build_put_array_request, - build_put_dictionary_request, - build_put_resource_collection_request, - build_put_simple_product_request, - build_put_simple_product_with_grouping_request, - build_put_wrapped_array_request, -) - -T = TypeVar("T") +from ...operations._auto_rest_resource_flattening_test_service_operations import build_get_array_request, build_get_dictionary_request, build_get_resource_collection_request, build_get_wrapped_array_request, build_post_flattened_simple_product_request, build_put_array_request, build_put_dictionary_request, build_put_resource_collection_request, build_put_simple_product_request, build_put_simple_product_with_grouping_request, build_put_wrapped_array_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestResourceFlatteningTestServiceOperationsMixin: + @distributed_trace_async - async def put_array(self, resource_array: Optional[List["_models.Resource"]] = None, **kwargs: Any) -> None: + async def put_array( + self, + resource_array: Optional[List["_models.Resource"]] = None, + **kwargs: Any + ) -> None: """Put External Resource as an Array. :param resource_array: External Resource as an Array to put. @@ -53,26 +37,32 @@ async def put_array(self, resource_array: Optional[List["_models.Resource"]] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: - _json = self._serialize.body(resource_array, "[Resource]") + _json = self._serialize.body(resource_array, '[Resource]') else: _json = None request = build_put_array_request( content_type=content_type, json=_json, - template_url=self.put_array.metadata["url"], + template_url=self.put_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -83,10 +73,14 @@ async def put_array(self, resource_array: Optional[List["_models.Resource"]] = N if cls: return cls(pipeline_response, None, {}) - put_array.metadata = {"url": "/model-flatten/array"} # type: ignore + put_array.metadata = {'url': '/model-flatten/array'} # type: ignore + @distributed_trace_async - async def get_array(self, **kwargs: Any) -> List["_models.FlattenedProduct"]: + async def get_array( + self, + **kwargs: Any + ) -> List["_models.FlattenedProduct"]: """Get External Resource as an Array. :keyword callable cls: A custom type or function that will be passed the direct response @@ -94,17 +88,24 @@ async def get_array(self, **kwargs: Any) -> List["_models.FlattenedProduct"]: :rtype: list[~modelflattening.models.FlattenedProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.FlattenedProduct"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.FlattenedProduct"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_request( - template_url=self.get_array.metadata["url"], + template_url=self.get_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,18 +113,21 @@ async def get_array(self, **kwargs: Any) -> List["_models.FlattenedProduct"]: error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[FlattenedProduct]", pipeline_response) + deserialized = self._deserialize('[FlattenedProduct]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array.metadata = {"url": "/model-flatten/array"} # type: ignore + get_array.metadata = {'url': '/model-flatten/array'} # type: ignore + @distributed_trace_async async def put_wrapped_array( - self, resource_array: Optional[List["_models.WrappedProduct"]] = None, **kwargs: Any + self, + resource_array: Optional[List["_models.WrappedProduct"]] = None, + **kwargs: Any ) -> None: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -135,26 +139,32 @@ async def put_wrapped_array( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: - _json = self._serialize.body(resource_array, "[WrappedProduct]") + _json = self._serialize.body(resource_array, '[WrappedProduct]') else: _json = None request = build_put_wrapped_array_request( content_type=content_type, json=_json, - template_url=self.put_wrapped_array.metadata["url"], + template_url=self.put_wrapped_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -165,10 +175,14 @@ async def put_wrapped_array( if cls: return cls(pipeline_response, None, {}) - put_wrapped_array.metadata = {"url": "/model-flatten/wrappedarray"} # type: ignore + put_wrapped_array.metadata = {'url': '/model-flatten/wrappedarray'} # type: ignore + @distributed_trace_async - async def get_wrapped_array(self, **kwargs: Any) -> List["_models.ProductWrapper"]: + async def get_wrapped_array( + self, + **kwargs: Any + ) -> List["_models.ProductWrapper"]: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -177,17 +191,24 @@ async def get_wrapped_array(self, **kwargs: Any) -> List["_models.ProductWrapper :rtype: list[~modelflattening.models.ProductWrapper] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.ProductWrapper"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ProductWrapper"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_wrapped_array_request( - template_url=self.get_wrapped_array.metadata["url"], + template_url=self.get_wrapped_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,18 +216,21 @@ async def get_wrapped_array(self, **kwargs: Any) -> List["_models.ProductWrapper error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[ProductWrapper]", pipeline_response) + deserialized = self._deserialize('[ProductWrapper]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_wrapped_array.metadata = {"url": "/model-flatten/wrappedarray"} # type: ignore + get_wrapped_array.metadata = {'url': '/model-flatten/wrappedarray'} # type: ignore + @distributed_trace_async async def put_dictionary( - self, resource_dictionary: Optional[Dict[str, "_models.FlattenedProduct"]] = None, **kwargs: Any + self, + resource_dictionary: Optional[Dict[str, "_models.FlattenedProduct"]] = None, + **kwargs: Any ) -> None: """Put External Resource as a Dictionary. @@ -217,26 +241,32 @@ async def put_dictionary( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_dictionary is not None: - _json = self._serialize.body(resource_dictionary, "{FlattenedProduct}") + _json = self._serialize.body(resource_dictionary, '{FlattenedProduct}') else: _json = None request = build_put_dictionary_request( content_type=content_type, json=_json, - template_url=self.put_dictionary.metadata["url"], + template_url=self.put_dictionary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -247,10 +277,14 @@ async def put_dictionary( if cls: return cls(pipeline_response, None, {}) - put_dictionary.metadata = {"url": "/model-flatten/dictionary"} # type: ignore + put_dictionary.metadata = {'url': '/model-flatten/dictionary'} # type: ignore + @distributed_trace_async - async def get_dictionary(self, **kwargs: Any) -> Dict[str, "_models.FlattenedProduct"]: + async def get_dictionary( + self, + **kwargs: Any + ) -> Dict[str, "_models.FlattenedProduct"]: """Get External Resource as a Dictionary. :keyword callable cls: A custom type or function that will be passed the direct response @@ -258,17 +292,24 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, "_models.FlattenedPro :rtype: dict[str, ~modelflattening.models.FlattenedProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.FlattenedProduct"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.FlattenedProduct"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_request( - template_url=self.get_dictionary.metadata["url"], + template_url=self.get_dictionary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -276,18 +317,21 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, "_models.FlattenedPro error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{FlattenedProduct}", pipeline_response) + deserialized = self._deserialize('{FlattenedProduct}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary.metadata = {"url": "/model-flatten/dictionary"} # type: ignore + get_dictionary.metadata = {'url': '/model-flatten/dictionary'} # type: ignore + @distributed_trace_async async def put_resource_collection( - self, resource_complex_object: Optional["_models.ResourceCollection"] = None, **kwargs: Any + self, + resource_complex_object: Optional["_models.ResourceCollection"] = None, + **kwargs: Any ) -> None: """Put External Resource as a ResourceCollection. @@ -298,26 +342,32 @@ async def put_resource_collection( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_complex_object is not None: - _json = self._serialize.body(resource_complex_object, "ResourceCollection") + _json = self._serialize.body(resource_complex_object, 'ResourceCollection') else: _json = None request = build_put_resource_collection_request( content_type=content_type, json=_json, - template_url=self.put_resource_collection.metadata["url"], + template_url=self.put_resource_collection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,10 +378,14 @@ async def put_resource_collection( if cls: return cls(pipeline_response, None, {}) - put_resource_collection.metadata = {"url": "/model-flatten/resourcecollection"} # type: ignore + put_resource_collection.metadata = {'url': '/model-flatten/resourcecollection'} # type: ignore + @distributed_trace_async - async def get_resource_collection(self, **kwargs: Any) -> "_models.ResourceCollection": + async def get_resource_collection( + self, + **kwargs: Any + ) -> "_models.ResourceCollection": """Get External Resource as a ResourceCollection. :keyword callable cls: A custom type or function that will be passed the direct response @@ -339,17 +393,24 @@ async def get_resource_collection(self, **kwargs: Any) -> "_models.ResourceColle :rtype: ~modelflattening.models.ResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ResourceCollection"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_resource_collection_request( - template_url=self.get_resource_collection.metadata["url"], + template_url=self.get_resource_collection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -357,18 +418,21 @@ async def get_resource_collection(self, **kwargs: Any) -> "_models.ResourceColle error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ResourceCollection", pipeline_response) + deserialized = self._deserialize('ResourceCollection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_collection.metadata = {"url": "/model-flatten/resourcecollection"} # type: ignore + get_resource_collection.metadata = {'url': '/model-flatten/resourcecollection'} # type: ignore + @distributed_trace_async async def put_simple_product( - self, simple_body_product: Optional["_models.SimpleProduct"] = None, **kwargs: Any + self, + simple_body_product: Optional["_models.SimpleProduct"] = None, + **kwargs: Any ) -> "_models.SimpleProduct": """Put Simple Product with client flattening true on the model. @@ -379,26 +443,32 @@ async def put_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SimpleProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SimpleProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: - _json = self._serialize.body(simple_body_product, "SimpleProduct") + _json = self._serialize.body(simple_body_product, 'SimpleProduct') else: _json = None request = build_put_simple_product_request( content_type=content_type, json=_json, - template_url=self.put_simple_product.metadata["url"], + template_url=self.put_simple_product.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -406,14 +476,15 @@ async def put_simple_product( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SimpleProduct", pipeline_response) + deserialized = self._deserialize('SimpleProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_simple_product.metadata = {"url": "/model-flatten/customFlattening"} # type: ignore + put_simple_product.metadata = {'url': '/model-flatten/customFlattening'} # type: ignore + @distributed_trace_async async def post_flattened_simple_product( @@ -447,34 +518,33 @@ async def post_flattened_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SimpleProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - - _simple_body_product = _models.SimpleProduct( - product_id=product_id, - description=description, - max_product_display_name=max_product_display_name, - capacity=capacity, - generic_value=generic_value, - odata_value=odata_value, - ) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SimpleProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _simple_body_product = _models.SimpleProduct(product_id=product_id, description=description, max_product_display_name=max_product_display_name, capacity=capacity, generic_value=generic_value, odata_value=odata_value) if _simple_body_product is not None: - _json = self._serialize.body(_simple_body_product, "SimpleProduct") + _json = self._serialize.body(_simple_body_product, 'SimpleProduct') else: _json = None request = build_post_flattened_simple_product_request( content_type=content_type, json=_json, - template_url=self.post_flattened_simple_product.metadata["url"], + template_url=self.post_flattened_simple_product.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -482,18 +552,21 @@ async def post_flattened_simple_product( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SimpleProduct", pipeline_response) + deserialized = self._deserialize('SimpleProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_flattened_simple_product.metadata = {"url": "/model-flatten/customFlattening"} # type: ignore + post_flattened_simple_product.metadata = {'url': '/model-flatten/customFlattening'} # type: ignore + @distributed_trace_async async def put_simple_product_with_grouping( - self, flatten_parameter_group: "_models.FlattenParameterGroup", **kwargs: Any + self, + flatten_parameter_group: "_models.FlattenParameterGroup", + **kwargs: Any ) -> "_models.SimpleProduct": """Put Simple Product with client flattening true on the model. @@ -504,11 +577,13 @@ async def put_simple_product_with_grouping( :rtype: ~modelflattening.models.SimpleProduct :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SimpleProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SimpleProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _name = None _simple_body_product = None @@ -527,16 +602,9 @@ async def put_simple_product_with_grouping( capacity = flatten_parameter_group.capacity _generic_value = flatten_parameter_group.generic_value _odata_value = flatten_parameter_group.odata_value - _simple_body_product = _models.SimpleProduct( - product_id=_product_id, - description=_description, - max_product_display_name=_max_product_display_name, - capacity=capacity, - generic_value=_generic_value, - odata_value=_odata_value, - ) + _simple_body_product = _models.SimpleProduct(product_id=_product_id, description=_description, max_product_display_name=_max_product_display_name, capacity=capacity, generic_value=_generic_value, odata_value=_odata_value) if _simple_body_product is not None: - _json = self._serialize.body(_simple_body_product, "SimpleProduct") + _json = self._serialize.body(_simple_body_product, 'SimpleProduct') else: _json = None @@ -544,12 +612,16 @@ async def put_simple_product_with_grouping( name=_name, content_type=content_type, json=_json, - template_url=self.put_simple_product_with_grouping.metadata["url"], + template_url=self.put_simple_product_with_grouping.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -557,11 +629,12 @@ async def put_simple_product_with_grouping( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SimpleProduct", pipeline_response) + deserialized = self._deserialize('SimpleProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_simple_product_with_grouping.metadata = {"url": "/model-flatten/customFlattening/parametergrouping/{name}/"} # type: ignore + put_simple_product_with_grouping.metadata = {'url': '/model-flatten/customFlattening/parametergrouping/{name}/'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py index 6c763d6d6b2..110d4f269c4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py @@ -36,16 +36,16 @@ ) __all__ = [ - "BaseProduct", - "Error", - "FlattenParameterGroup", - "FlattenedProduct", - "GenericUrl", - "ProductUrl", - "ProductWrapper", - "Resource", - "ResourceCollection", - "SimpleProduct", - "WrappedProduct", - "FlattenedProductPropertiesProvisioningStateValues", + 'BaseProduct', + 'Error', + 'FlattenParameterGroup', + 'FlattenedProduct', + 'GenericUrl', + 'ProductUrl', + 'ProductWrapper', + 'Resource', + 'ResourceCollection', + 'SimpleProduct', + 'WrappedProduct', + 'FlattenedProductPropertiesProvisioningStateValues', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py index c8fe5c979ae..b8e592d60aa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models.py @@ -24,15 +24,18 @@ class BaseProduct(msrest.serialization.Model): """ _validation = { - "product_id": {"required": True}, + 'product_id': {'required': True}, } _attribute_map = { - "product_id": {"key": "base_product_id", "type": "str"}, - "description": {"key": "base_product_description", "type": "str"}, + 'product_id': {'key': 'base_product_id', 'type': 'str'}, + 'description': {'key': 'base_product_description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword product_id: Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than @@ -42,8 +45,8 @@ def __init__(self, **kwargs): :paramtype description: str """ super(BaseProduct, self).__init__(**kwargs) - self.product_id = kwargs["product_id"] - self.description = kwargs.get("description", None) + self.product_id = kwargs['product_id'] + self.description = kwargs.get('description', None) class Error(msrest.serialization.Model): @@ -58,12 +61,15 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, - "parent_error": {"key": "parentError", "type": "Error"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + 'parent_error': {'key': 'parentError', 'type': 'Error'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -73,9 +79,9 @@ def __init__(self, **kwargs): :paramtype parent_error: ~modelflattening.models.Error """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) - self.parent_error = kwargs.get("parent_error", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) + self.parent_error = kwargs.get('parent_error', None) class Resource(msrest.serialization.Model): @@ -96,20 +102,23 @@ class Resource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -119,8 +128,8 @@ def __init__(self, **kwargs): super(Resource, self).__init__(**kwargs) self.id = None self.type = None - self.tags = kwargs.get("tags", None) - self.location = kwargs.get("location", None) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) self.name = None @@ -152,25 +161,28 @@ class FlattenedProduct(Resource): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, - "provisioning_state_values": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'provisioning_state_values': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "p_name": {"key": "properties.p\\.name", "type": "str"}, - "type_properties_type": {"key": "properties.type", "type": "str"}, - "provisioning_state_values": {"key": "properties.provisioningStateValues", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'p_name': {'key': 'properties.p\\.name', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'provisioning_state_values': {'key': 'properties.provisioningStateValues', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -184,10 +196,10 @@ def __init__(self, **kwargs): :paramtype provisioning_state: str """ super(FlattenedProduct, self).__init__(**kwargs) - self.p_name = kwargs.get("p_name", None) - self.type_properties_type = kwargs.get("type_properties_type", None) + self.p_name = kwargs.get('p_name', None) + self.type_properties_type = kwargs.get('type_properties_type', None) self.provisioning_state_values = None - self.provisioning_state = kwargs.get("provisioning_state", None) + self.provisioning_state = kwargs.get('provisioning_state', None) class FlattenParameterGroup(msrest.serialization.Model): @@ -217,22 +229,25 @@ class FlattenParameterGroup(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, - "product_id": {"required": True}, + 'name': {'required': True}, + 'product_id': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "simple_body_product": {"key": "SimpleBodyProduct", "type": "SimpleProduct"}, - "product_id": {"key": "productId", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "max_product_display_name": {"key": "max_product_display_name", "type": "str"}, - "capacity": {"key": "capacity", "type": "str"}, - "generic_value": {"key": "generic_value", "type": "str"}, - "odata_value": {"key": "@odata\\.value", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'simple_body_product': {'key': 'SimpleBodyProduct', 'type': 'SimpleProduct'}, + 'product_id': {'key': 'productId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'max_product_display_name': {'key': 'max_product_display_name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'str'}, + 'generic_value': {'key': 'generic_value', 'type': 'str'}, + 'odata_value': {'key': '@odata\\.value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Required. Product name with value 'groupproduct'. :paramtype name: str @@ -255,14 +270,14 @@ def __init__(self, **kwargs): :paramtype odata_value: str """ super(FlattenParameterGroup, self).__init__(**kwargs) - self.name = kwargs["name"] - self.simple_body_product = kwargs.get("simple_body_product", None) - self.product_id = kwargs["product_id"] - self.description = kwargs.get("description", None) - self.max_product_display_name = kwargs.get("max_product_display_name", None) - self.capacity = kwargs.get("capacity", None) - self.generic_value = kwargs.get("generic_value", None) - self.odata_value = kwargs.get("odata_value", None) + self.name = kwargs['name'] + self.simple_body_product = kwargs.get('simple_body_product', None) + self.product_id = kwargs['product_id'] + self.description = kwargs.get('description', None) + self.max_product_display_name = kwargs.get('max_product_display_name', None) + self.capacity = kwargs.get('capacity', None) + self.generic_value = kwargs.get('generic_value', None) + self.odata_value = kwargs.get('odata_value', None) class GenericUrl(msrest.serialization.Model): @@ -273,16 +288,19 @@ class GenericUrl(msrest.serialization.Model): """ _attribute_map = { - "generic_value": {"key": "generic_value", "type": "str"}, + 'generic_value': {'key': 'generic_value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword generic_value: Generic URL value. :paramtype generic_value: str """ super(GenericUrl, self).__init__(**kwargs) - self.generic_value = kwargs.get("generic_value", None) + self.generic_value = kwargs.get('generic_value', None) class ProductUrl(GenericUrl): @@ -295,11 +313,14 @@ class ProductUrl(GenericUrl): """ _attribute_map = { - "generic_value": {"key": "generic_value", "type": "str"}, - "odata_value": {"key": "@odata\\.value", "type": "str"}, + 'generic_value': {'key': 'generic_value', 'type': 'str'}, + 'odata_value': {'key': '@odata\\.value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword generic_value: Generic URL value. :paramtype generic_value: str @@ -307,7 +328,7 @@ def __init__(self, **kwargs): :paramtype odata_value: str """ super(ProductUrl, self).__init__(**kwargs) - self.odata_value = kwargs.get("odata_value", None) + self.odata_value = kwargs.get('odata_value', None) class ProductWrapper(msrest.serialization.Model): @@ -318,16 +339,19 @@ class ProductWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "property.value", "type": "str"}, + 'value': {'key': 'property.value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: the product value. :paramtype value: str """ super(ProductWrapper, self).__init__(**kwargs) - self.value = kwargs.get("value", None) + self.value = kwargs.get('value', None) class ResourceCollection(msrest.serialization.Model): @@ -342,12 +366,15 @@ class ResourceCollection(msrest.serialization.Model): """ _attribute_map = { - "productresource": {"key": "productresource", "type": "FlattenedProduct"}, - "arrayofresources": {"key": "arrayofresources", "type": "[FlattenedProduct]"}, - "dictionaryofresources": {"key": "dictionaryofresources", "type": "{FlattenedProduct}"}, + 'productresource': {'key': 'productresource', 'type': 'FlattenedProduct'}, + 'arrayofresources': {'key': 'arrayofresources', 'type': '[FlattenedProduct]'}, + 'dictionaryofresources': {'key': 'dictionaryofresources', 'type': '{FlattenedProduct}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword productresource: Flattened product. :paramtype productresource: ~modelflattening.models.FlattenedProduct @@ -357,9 +384,9 @@ def __init__(self, **kwargs): :paramtype dictionaryofresources: dict[str, ~modelflattening.models.FlattenedProduct] """ super(ResourceCollection, self).__init__(**kwargs) - self.productresource = kwargs.get("productresource", None) - self.arrayofresources = kwargs.get("arrayofresources", None) - self.dictionaryofresources = kwargs.get("dictionaryofresources", None) + self.productresource = kwargs.get('productresource', None) + self.arrayofresources = kwargs.get('arrayofresources', None) + self.dictionaryofresources = kwargs.get('dictionaryofresources', None) class SimpleProduct(BaseProduct): @@ -385,19 +412,22 @@ class SimpleProduct(BaseProduct): """ _validation = { - "product_id": {"required": True}, + 'product_id': {'required': True}, } _attribute_map = { - "product_id": {"key": "base_product_id", "type": "str"}, - "description": {"key": "base_product_description", "type": "str"}, - "max_product_display_name": {"key": "details.max_product_display_name", "type": "str"}, - "capacity": {"key": "details.max_product_capacity", "type": "str"}, - "generic_value": {"key": "details.max_product_image.generic_value", "type": "str"}, - "odata_value": {"key": "details.max_product_image.@odata\\.value", "type": "str"}, + 'product_id': {'key': 'base_product_id', 'type': 'str'}, + 'description': {'key': 'base_product_description', 'type': 'str'}, + 'max_product_display_name': {'key': 'details.max_product_display_name', 'type': 'str'}, + 'capacity': {'key': 'details.max_product_capacity', 'type': 'str'}, + 'generic_value': {'key': 'details.max_product_image.generic_value', 'type': 'str'}, + 'odata_value': {'key': 'details.max_product_image.@odata\\.value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword product_id: Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than @@ -416,10 +446,10 @@ def __init__(self, **kwargs): :paramtype odata_value: str """ super(SimpleProduct, self).__init__(**kwargs) - self.max_product_display_name = kwargs.get("max_product_display_name", None) - self.capacity = kwargs.get("capacity", None) - self.generic_value = kwargs.get("generic_value", None) - self.odata_value = kwargs.get("odata_value", None) + self.max_product_display_name = kwargs.get('max_product_display_name', None) + self.capacity = kwargs.get('capacity', None) + self.generic_value = kwargs.get('generic_value', None) + self.odata_value = kwargs.get('odata_value', None) class WrappedProduct(msrest.serialization.Model): @@ -430,13 +460,16 @@ class WrappedProduct(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: the product value. :paramtype value: str """ super(WrappedProduct, self).__init__(**kwargs) - self.value = kwargs.get("value", None) + self.value = kwargs.get('value', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py index be6804cf99f..63895e23a35 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_models_py3.py @@ -26,15 +26,21 @@ class BaseProduct(msrest.serialization.Model): """ _validation = { - "product_id": {"required": True}, + 'product_id': {'required': True}, } _attribute_map = { - "product_id": {"key": "base_product_id", "type": "str"}, - "description": {"key": "base_product_description", "type": "str"}, + 'product_id': {'key': 'base_product_id', 'type': 'str'}, + 'description': {'key': 'base_product_description', 'type': 'str'}, } - def __init__(self, *, product_id: str, description: Optional[str] = None, **kwargs): + def __init__( + self, + *, + product_id: str, + description: Optional[str] = None, + **kwargs + ): """ :keyword product_id: Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than @@ -60,9 +66,9 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, - "parent_error": {"key": "parentError", "type": "Error"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + 'parent_error': {'key': 'parentError', 'type': 'Error'}, } def __init__( @@ -105,20 +111,26 @@ class Resource(msrest.serialization.Model): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, **kwargs): + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + **kwargs + ): """ :keyword tags: A set of tags. Dictionary of :code:``. :paramtype tags: dict[str, str] @@ -161,22 +173,22 @@ class FlattenedProduct(Resource): """ _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, - "provisioning_state_values": {"readonly": True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'provisioning_state_values': {'readonly': True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "p_name": {"key": "properties.p\\.name", "type": "str"}, - "type_properties_type": {"key": "properties.type", "type": "str"}, - "provisioning_state_values": {"key": "properties.provisioningStateValues", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'p_name': {'key': 'properties.p\\.name', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'provisioning_state_values': {'key': 'properties.provisioningStateValues', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } def __init__( @@ -235,19 +247,19 @@ class FlattenParameterGroup(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, - "product_id": {"required": True}, + 'name': {'required': True}, + 'product_id': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "simple_body_product": {"key": "SimpleBodyProduct", "type": "SimpleProduct"}, - "product_id": {"key": "productId", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "max_product_display_name": {"key": "max_product_display_name", "type": "str"}, - "capacity": {"key": "capacity", "type": "str"}, - "generic_value": {"key": "generic_value", "type": "str"}, - "odata_value": {"key": "@odata\\.value", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, + 'simple_body_product': {'key': 'SimpleBodyProduct', 'type': 'SimpleProduct'}, + 'product_id': {'key': 'productId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'max_product_display_name': {'key': 'max_product_display_name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'str'}, + 'generic_value': {'key': 'generic_value', 'type': 'str'}, + 'odata_value': {'key': '@odata\\.value', 'type': 'str'}, } def __init__( @@ -303,10 +315,15 @@ class GenericUrl(msrest.serialization.Model): """ _attribute_map = { - "generic_value": {"key": "generic_value", "type": "str"}, + 'generic_value': {'key': 'generic_value', 'type': 'str'}, } - def __init__(self, *, generic_value: Optional[str] = None, **kwargs): + def __init__( + self, + *, + generic_value: Optional[str] = None, + **kwargs + ): """ :keyword generic_value: Generic URL value. :paramtype generic_value: str @@ -325,11 +342,17 @@ class ProductUrl(GenericUrl): """ _attribute_map = { - "generic_value": {"key": "generic_value", "type": "str"}, - "odata_value": {"key": "@odata\\.value", "type": "str"}, + 'generic_value': {'key': 'generic_value', 'type': 'str'}, + 'odata_value': {'key': '@odata\\.value', 'type': 'str'}, } - def __init__(self, *, generic_value: Optional[str] = None, odata_value: Optional[str] = None, **kwargs): + def __init__( + self, + *, + generic_value: Optional[str] = None, + odata_value: Optional[str] = None, + **kwargs + ): """ :keyword generic_value: Generic URL value. :paramtype generic_value: str @@ -348,10 +371,15 @@ class ProductWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "property.value", "type": "str"}, + 'value': {'key': 'property.value', 'type': 'str'}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[str] = None, + **kwargs + ): """ :keyword value: the product value. :paramtype value: str @@ -372,9 +400,9 @@ class ResourceCollection(msrest.serialization.Model): """ _attribute_map = { - "productresource": {"key": "productresource", "type": "FlattenedProduct"}, - "arrayofresources": {"key": "arrayofresources", "type": "[FlattenedProduct]"}, - "dictionaryofresources": {"key": "dictionaryofresources", "type": "{FlattenedProduct}"}, + 'productresource': {'key': 'productresource', 'type': 'FlattenedProduct'}, + 'arrayofresources': {'key': 'arrayofresources', 'type': '[FlattenedProduct]'}, + 'dictionaryofresources': {'key': 'dictionaryofresources', 'type': '{FlattenedProduct}'}, } def __init__( @@ -422,16 +450,16 @@ class SimpleProduct(BaseProduct): """ _validation = { - "product_id": {"required": True}, + 'product_id': {'required': True}, } _attribute_map = { - "product_id": {"key": "base_product_id", "type": "str"}, - "description": {"key": "base_product_description", "type": "str"}, - "max_product_display_name": {"key": "details.max_product_display_name", "type": "str"}, - "capacity": {"key": "details.max_product_capacity", "type": "str"}, - "generic_value": {"key": "details.max_product_image.generic_value", "type": "str"}, - "odata_value": {"key": "details.max_product_image.@odata\\.value", "type": "str"}, + 'product_id': {'key': 'base_product_id', 'type': 'str'}, + 'description': {'key': 'base_product_description', 'type': 'str'}, + 'max_product_display_name': {'key': 'details.max_product_display_name', 'type': 'str'}, + 'capacity': {'key': 'details.max_product_capacity', 'type': 'str'}, + 'generic_value': {'key': 'details.max_product_image.generic_value', 'type': 'str'}, + 'odata_value': {'key': 'details.max_product_image.@odata\\.value', 'type': 'str'}, } def __init__( @@ -477,10 +505,15 @@ class WrappedProduct(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[str] = None, + **kwargs + ): """ :keyword value: the product value. :paramtype value: str diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/__init__.py index 753b984bc23..97acfd337b3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_resource_flattening_test_service_operations import AutoRestResourceFlatteningTestServiceOperationsMixin __all__ = [ - "AutoRestResourceFlatteningTestServiceOperationsMixin", + 'AutoRestResourceFlatteningTestServiceOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py index 4f130422312..e97ee26356f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -291,6 +283,7 @@ def build_put_simple_product_with_grouping_request( # fmt: on class AutoRestResourceFlatteningTestServiceOperationsMixin(object): + @distributed_trace def put_array( self, @@ -307,26 +300,32 @@ def put_array( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: - _json = self._serialize.body(resource_array, "[Resource]") + _json = self._serialize.body(resource_array, '[Resource]') else: _json = None request = build_put_array_request( content_type=content_type, json=_json, - template_url=self.put_array.metadata["url"], + template_url=self.put_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -337,11 +336,13 @@ def put_array( if cls: return cls(pipeline_response, None, {}) - put_array.metadata = {"url": "/model-flatten/array"} # type: ignore + put_array.metadata = {'url': '/model-flatten/array'} # type: ignore + @distributed_trace def get_array( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.FlattenedProduct"] """Get External Resource as an Array. @@ -351,17 +352,24 @@ def get_array( :rtype: list[~modelflattening.models.FlattenedProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.FlattenedProduct"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.FlattenedProduct"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_array_request( - template_url=self.get_array.metadata["url"], + template_url=self.get_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -369,14 +377,15 @@ def get_array( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[FlattenedProduct]", pipeline_response) + deserialized = self._deserialize('[FlattenedProduct]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_array.metadata = {"url": "/model-flatten/array"} # type: ignore + get_array.metadata = {'url': '/model-flatten/array'} # type: ignore + @distributed_trace def put_wrapped_array( @@ -395,26 +404,32 @@ def put_wrapped_array( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: - _json = self._serialize.body(resource_array, "[WrappedProduct]") + _json = self._serialize.body(resource_array, '[WrappedProduct]') else: _json = None request = build_put_wrapped_array_request( content_type=content_type, json=_json, - template_url=self.put_wrapped_array.metadata["url"], + template_url=self.put_wrapped_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -425,11 +440,13 @@ def put_wrapped_array( if cls: return cls(pipeline_response, None, {}) - put_wrapped_array.metadata = {"url": "/model-flatten/wrappedarray"} # type: ignore + put_wrapped_array.metadata = {'url': '/model-flatten/wrappedarray'} # type: ignore + @distributed_trace def get_wrapped_array( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.ProductWrapper"] """No need to have a route in Express server for this operation. Used to verify the type flattened @@ -440,17 +457,24 @@ def get_wrapped_array( :rtype: list[~modelflattening.models.ProductWrapper] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.ProductWrapper"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ProductWrapper"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_wrapped_array_request( - template_url=self.get_wrapped_array.metadata["url"], + template_url=self.get_wrapped_array.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,14 +482,15 @@ def get_wrapped_array( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[ProductWrapper]", pipeline_response) + deserialized = self._deserialize('[ProductWrapper]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_wrapped_array.metadata = {"url": "/model-flatten/wrappedarray"} # type: ignore + get_wrapped_array.metadata = {'url': '/model-flatten/wrappedarray'} # type: ignore + @distributed_trace def put_dictionary( @@ -483,26 +508,32 @@ def put_dictionary( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_dictionary is not None: - _json = self._serialize.body(resource_dictionary, "{FlattenedProduct}") + _json = self._serialize.body(resource_dictionary, '{FlattenedProduct}') else: _json = None request = build_put_dictionary_request( content_type=content_type, json=_json, - template_url=self.put_dictionary.metadata["url"], + template_url=self.put_dictionary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,11 +544,13 @@ def put_dictionary( if cls: return cls(pipeline_response, None, {}) - put_dictionary.metadata = {"url": "/model-flatten/dictionary"} # type: ignore + put_dictionary.metadata = {'url': '/model-flatten/dictionary'} # type: ignore + @distributed_trace def get_dictionary( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Dict[str, "_models.FlattenedProduct"] """Get External Resource as a Dictionary. @@ -527,17 +560,24 @@ def get_dictionary( :rtype: dict[str, ~modelflattening.models.FlattenedProduct] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, "_models.FlattenedProduct"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, "_models.FlattenedProduct"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_dictionary_request( - template_url=self.get_dictionary.metadata["url"], + template_url=self.get_dictionary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -545,14 +585,15 @@ def get_dictionary( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{FlattenedProduct}", pipeline_response) + deserialized = self._deserialize('{FlattenedProduct}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_dictionary.metadata = {"url": "/model-flatten/dictionary"} # type: ignore + get_dictionary.metadata = {'url': '/model-flatten/dictionary'} # type: ignore + @distributed_trace def put_resource_collection( @@ -570,26 +611,32 @@ def put_resource_collection( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_complex_object is not None: - _json = self._serialize.body(resource_complex_object, "ResourceCollection") + _json = self._serialize.body(resource_complex_object, 'ResourceCollection') else: _json = None request = build_put_resource_collection_request( content_type=content_type, json=_json, - template_url=self.put_resource_collection.metadata["url"], + template_url=self.put_resource_collection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -600,11 +647,13 @@ def put_resource_collection( if cls: return cls(pipeline_response, None, {}) - put_resource_collection.metadata = {"url": "/model-flatten/resourcecollection"} # type: ignore + put_resource_collection.metadata = {'url': '/model-flatten/resourcecollection'} # type: ignore + @distributed_trace def get_resource_collection( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ResourceCollection" """Get External Resource as a ResourceCollection. @@ -614,17 +663,24 @@ def get_resource_collection( :rtype: ~modelflattening.models.ResourceCollection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ResourceCollection"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_resource_collection_request( - template_url=self.get_resource_collection.metadata["url"], + template_url=self.get_resource_collection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -632,14 +688,15 @@ def get_resource_collection( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ResourceCollection", pipeline_response) + deserialized = self._deserialize('ResourceCollection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_collection.metadata = {"url": "/model-flatten/resourcecollection"} # type: ignore + get_resource_collection.metadata = {'url': '/model-flatten/resourcecollection'} # type: ignore + @distributed_trace def put_simple_product( @@ -657,26 +714,32 @@ def put_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SimpleProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SimpleProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: - _json = self._serialize.body(simple_body_product, "SimpleProduct") + _json = self._serialize.body(simple_body_product, 'SimpleProduct') else: _json = None request = build_put_simple_product_request( content_type=content_type, json=_json, - template_url=self.put_simple_product.metadata["url"], + template_url=self.put_simple_product.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -684,14 +747,15 @@ def put_simple_product( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SimpleProduct", pipeline_response) + deserialized = self._deserialize('SimpleProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_simple_product.metadata = {"url": "/model-flatten/customFlattening"} # type: ignore + put_simple_product.metadata = {'url': '/model-flatten/customFlattening'} # type: ignore + @distributed_trace def post_flattened_simple_product( @@ -726,34 +790,33 @@ def post_flattened_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SimpleProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - - _simple_body_product = _models.SimpleProduct( - product_id=product_id, - description=description, - max_product_display_name=max_product_display_name, - capacity=capacity, - generic_value=generic_value, - odata_value=odata_value, - ) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SimpleProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _simple_body_product = _models.SimpleProduct(product_id=product_id, description=description, max_product_display_name=max_product_display_name, capacity=capacity, generic_value=generic_value, odata_value=odata_value) if _simple_body_product is not None: - _json = self._serialize.body(_simple_body_product, "SimpleProduct") + _json = self._serialize.body(_simple_body_product, 'SimpleProduct') else: _json = None request = build_post_flattened_simple_product_request( content_type=content_type, json=_json, - template_url=self.post_flattened_simple_product.metadata["url"], + template_url=self.post_flattened_simple_product.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -761,14 +824,15 @@ def post_flattened_simple_product( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SimpleProduct", pipeline_response) + deserialized = self._deserialize('SimpleProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_flattened_simple_product.metadata = {"url": "/model-flatten/customFlattening"} # type: ignore + post_flattened_simple_product.metadata = {'url': '/model-flatten/customFlattening'} # type: ignore + @distributed_trace def put_simple_product_with_grouping( @@ -786,11 +850,13 @@ def put_simple_product_with_grouping( :rtype: ~modelflattening.models.SimpleProduct :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SimpleProduct"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SimpleProduct"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _name = None _simple_body_product = None @@ -809,16 +875,9 @@ def put_simple_product_with_grouping( capacity = flatten_parameter_group.capacity _generic_value = flatten_parameter_group.generic_value _odata_value = flatten_parameter_group.odata_value - _simple_body_product = _models.SimpleProduct( - product_id=_product_id, - description=_description, - max_product_display_name=_max_product_display_name, - capacity=capacity, - generic_value=_generic_value, - odata_value=_odata_value, - ) + _simple_body_product = _models.SimpleProduct(product_id=_product_id, description=_description, max_product_display_name=_max_product_display_name, capacity=capacity, generic_value=_generic_value, odata_value=_odata_value) if _simple_body_product is not None: - _json = self._serialize.body(_simple_body_product, "SimpleProduct") + _json = self._serialize.body(_simple_body_product, 'SimpleProduct') else: _json = None @@ -826,12 +885,16 @@ def put_simple_product_with_grouping( name=_name, content_type=content_type, json=_json, - template_url=self.put_simple_product_with_grouping.metadata["url"], + template_url=self.put_simple_product_with_grouping.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -839,11 +902,12 @@ def put_simple_product_with_grouping( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SimpleProduct", pipeline_response) + deserialized = self._deserialize('SimpleProduct', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_simple_product_with_grouping.metadata = {"url": "/model-flatten/customFlattening/parametergrouping/{name}/"} # type: ignore + put_simple_product_with_grouping.metadata = {'url': '/model-flatten/customFlattening/parametergrouping/{name}/'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py index 8d1edff1db1..39383fce365 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Resource Flattening for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/__init__.py index 38868bb00ab..41f59902549 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MultipleInheritanceServiceClient"] +__all__ = ['MultipleInheritanceServiceClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_configuration.py index 3bf3a3a50bc..db7540c9ff8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class MultipleInheritanceServiceClientConfiguration(Configuration): +class MultipleInheritanceServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultipleInheritanceServiceClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class MultipleInheritanceServiceClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "multipleinheritanceserviceclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py index 16a0e8a3546..30de669614a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperationsMixin): """Service client for multiinheritance client testing. @@ -44,6 +43,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/__init__.py index c1cb6dab943..5f66ffeb27e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._multiple_inheritance_service_client import MultipleInheritanceServiceClient - -__all__ = ["MultipleInheritanceServiceClient"] +__all__ = ['MultipleInheritanceServiceClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration.py index 795387844ed..1e4b897da2a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class MultipleInheritanceServiceClientConfiguration(Configuration): +class MultipleInheritanceServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultipleInheritanceServiceClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "multipleinheritanceserviceclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py index 8eb31a232f3..31eccce4b29 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import MultipleInheritanceServiceClientConfiguration from .operations import MultipleInheritanceServiceClientOperationsMixin - class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperationsMixin): """Service client for multiinheritance client testing. @@ -25,7 +24,11 @@ class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperation :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -34,7 +37,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/__init__.py index 86aed303fc8..4afee8c7842 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._multiple_inheritance_service_client_operations import MultipleInheritanceServiceClientOperationsMixin __all__ = [ - "MultipleInheritanceServiceClientOperationsMixin", + 'MultipleInheritanceServiceClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py index 54aa8aced93..ab36624073f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,26 +16,17 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._multiple_inheritance_service_client_operations import ( - build_get_cat_request, - build_get_feline_request, - build_get_horse_request, - build_get_kitten_request, - build_get_pet_request, - build_put_cat_request, - build_put_feline_request, - build_put_horse_request, - build_put_kitten_request, - build_put_pet_request, -) - -T = TypeVar("T") +from ...operations._multiple_inheritance_service_client_operations import build_get_cat_request, build_get_feline_request, build_get_horse_request, build_get_kitten_request, build_get_pet_request, build_put_cat_request, build_put_feline_request, build_put_horse_request, build_put_kitten_request, build_put_pet_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class MultipleInheritanceServiceClientOperationsMixin: + @distributed_trace_async - async def get_horse(self, **kwargs: Any) -> "_models.Horse": + async def get_horse( + self, + **kwargs: Any + ) -> "_models.Horse": """Get a horse with name 'Fred' and isAShowHorse true. :keyword callable cls: A custom type or function that will be passed the direct response @@ -50,17 +34,24 @@ async def get_horse(self, **kwargs: Any) -> "_models.Horse": :rtype: ~multipleinheritance.models.Horse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Horse"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Horse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_horse_request( - template_url=self.get_horse.metadata["url"], + template_url=self.get_horse.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -68,17 +59,22 @@ async def get_horse(self, **kwargs: Any) -> "_models.Horse": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Horse", pipeline_response) + deserialized = self._deserialize('Horse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_horse.metadata = {"url": "/multipleInheritance/horse"} # type: ignore + get_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + @distributed_trace_async - async def put_horse(self, horse: "_models.Horse", **kwargs: Any) -> str: + async def put_horse( + self, + horse: "_models.Horse", + **kwargs: Any + ) -> str: """Put a horse with name 'General' and isAShowHorse false. :param horse: Put a horse with name 'General' and isAShowHorse false. @@ -88,40 +84,50 @@ async def put_horse(self, horse: "_models.Horse", **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(horse, "Horse") + _json = self._serialize.body(horse, 'Horse') request = build_put_horse_request( content_type=content_type, json=_json, - template_url=self.put_horse.metadata["url"], + template_url=self.put_horse.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_horse.metadata = {"url": "/multipleInheritance/horse"} # type: ignore + put_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + @distributed_trace_async - async def get_pet(self, **kwargs: Any) -> "_models.Pet": + async def get_pet( + self, + **kwargs: Any + ) -> "_models.Pet": """Get a pet with name 'Peanut'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -129,17 +135,24 @@ async def get_pet(self, **kwargs: Any) -> "_models.Pet": :rtype: ~multipleinheritance.models.Pet :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Pet"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Pet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_pet_request( - template_url=self.get_pet.metadata["url"], + template_url=self.get_pet.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -147,17 +160,22 @@ async def get_pet(self, **kwargs: Any) -> "_models.Pet": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_pet.metadata = {"url": "/multipleInheritance/pet"} # type: ignore + get_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + @distributed_trace_async - async def put_pet(self, name: str, **kwargs: Any) -> str: + async def put_pet( + self, + name: str, + **kwargs: Any + ) -> str: """Put a pet with name 'Butter'. :param name: @@ -167,41 +185,51 @@ async def put_pet(self, name: str, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _pet = _models.Pet(name=name) - _json = self._serialize.body(_pet, "Pet") + _json = self._serialize.body(_pet, 'Pet') request = build_put_pet_request( content_type=content_type, json=_json, - template_url=self.put_pet.metadata["url"], + template_url=self.put_pet.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_pet.metadata = {"url": "/multipleInheritance/pet"} # type: ignore + put_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + @distributed_trace_async - async def get_feline(self, **kwargs: Any) -> "_models.Feline": + async def get_feline( + self, + **kwargs: Any + ) -> "_models.Feline": """Get a feline where meows and hisses are true. :keyword callable cls: A custom type or function that will be passed the direct response @@ -209,17 +237,24 @@ async def get_feline(self, **kwargs: Any) -> "_models.Feline": :rtype: ~multipleinheritance.models.Feline :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Feline"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Feline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_feline_request( - template_url=self.get_feline.metadata["url"], + template_url=self.get_feline.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,17 +262,22 @@ async def get_feline(self, **kwargs: Any) -> "_models.Feline": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Feline", pipeline_response) + deserialized = self._deserialize('Feline', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_feline.metadata = {"url": "/multipleInheritance/feline"} # type: ignore + get_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + @distributed_trace_async - async def put_feline(self, feline: "_models.Feline", **kwargs: Any) -> str: + async def put_feline( + self, + feline: "_models.Feline", + **kwargs: Any + ) -> str: """Put a feline who hisses and doesn't meow. :param feline: Put a feline who hisses and doesn't meow. @@ -247,40 +287,50 @@ async def put_feline(self, feline: "_models.Feline", **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(feline, "Feline") + _json = self._serialize.body(feline, 'Feline') request = build_put_feline_request( content_type=content_type, json=_json, - template_url=self.put_feline.metadata["url"], + template_url=self.put_feline.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_feline.metadata = {"url": "/multipleInheritance/feline"} # type: ignore + put_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + @distributed_trace_async - async def get_cat(self, **kwargs: Any) -> "_models.Cat": + async def get_cat( + self, + **kwargs: Any + ) -> "_models.Cat": """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. :keyword callable cls: A custom type or function that will be passed the direct response @@ -288,17 +338,24 @@ async def get_cat(self, **kwargs: Any) -> "_models.Cat": :rtype: ~multipleinheritance.models.Cat :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Cat"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cat"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_cat_request( - template_url=self.get_cat.metadata["url"], + template_url=self.get_cat.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -306,17 +363,22 @@ async def get_cat(self, **kwargs: Any) -> "_models.Cat": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Cat", pipeline_response) + deserialized = self._deserialize('Cat', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_cat.metadata = {"url": "/multipleInheritance/cat"} # type: ignore + get_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + @distributed_trace_async - async def put_cat(self, cat: "_models.Cat", **kwargs: Any) -> str: + async def put_cat( + self, + cat: "_models.Cat", + **kwargs: Any + ) -> str: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. :param cat: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. @@ -326,40 +388,50 @@ async def put_cat(self, cat: "_models.Cat", **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(cat, "Cat") + _json = self._serialize.body(cat, 'Cat') request = build_put_cat_request( content_type=content_type, json=_json, - template_url=self.put_cat.metadata["url"], + template_url=self.put_cat.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_cat.metadata = {"url": "/multipleInheritance/cat"} # type: ignore + put_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + @distributed_trace_async - async def get_kitten(self, **kwargs: Any) -> "_models.Kitten": + async def get_kitten( + self, + **kwargs: Any + ) -> "_models.Kitten": """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet is false. @@ -368,17 +440,24 @@ async def get_kitten(self, **kwargs: Any) -> "_models.Kitten": :rtype: ~multipleinheritance.models.Kitten :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Kitten"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Kitten"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_kitten_request( - template_url=self.get_kitten.metadata["url"], + template_url=self.get_kitten.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -386,17 +465,22 @@ async def get_kitten(self, **kwargs: Any) -> "_models.Kitten": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Kitten", pipeline_response) + deserialized = self._deserialize('Kitten', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_kitten.metadata = {"url": "/multipleInheritance/kitten"} # type: ignore + get_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore + @distributed_trace_async - async def put_kitten(self, kitten: "_models.Kitten", **kwargs: Any) -> str: + async def put_kitten( + self, + kitten: "_models.Kitten", + **kwargs: Any + ) -> str: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -408,34 +492,41 @@ async def put_kitten(self, kitten: "_models.Kitten", **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(kitten, "Kitten") + _json = self._serialize.body(kitten, 'Kitten') request = build_put_kitten_request( content_type=content_type, json=_json, - template_url=self.put_kitten.metadata["url"], + template_url=self.put_kitten.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_kitten.metadata = {"url": "/multipleInheritance/kitten"} # type: ignore + put_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py index 56f72f40172..8c9e96065f7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py @@ -22,10 +22,10 @@ from ._models import Pet # type: ignore __all__ = [ - "Cat", - "Error", - "Feline", - "Horse", - "Kitten", - "Pet", + 'Cat', + 'Error', + 'Feline', + 'Horse', + 'Kitten', + 'Pet', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models.py index 6f21150b2b5..ab99039f492 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models.py @@ -20,11 +20,14 @@ class Feline(msrest.serialization.Model): """ _attribute_map = { - "meows": {"key": "meows", "type": "bool"}, - "hisses": {"key": "hisses", "type": "bool"}, + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword meows: :paramtype meows: bool @@ -32,8 +35,8 @@ def __init__(self, **kwargs): :paramtype hisses: bool """ super(Feline, self).__init__(**kwargs) - self.meows = kwargs.get("meows", None) - self.hisses = kwargs.get("hisses", None) + self.meows = kwargs.get('meows', None) + self.hisses = kwargs.get('hisses', None) class Pet(msrest.serialization.Model): @@ -46,20 +49,23 @@ class Pet(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Required. :paramtype name: str """ super(Pet, self).__init__(**kwargs) - self.name = kwargs["name"] + self.name = kwargs['name'] class Cat(Pet, Feline): @@ -78,17 +84,20 @@ class Cat(Pet, Feline): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "meows": {"key": "meows", "type": "bool"}, - "hisses": {"key": "hisses", "type": "bool"}, - "name": {"key": "name", "type": "str"}, - "likes_milk": {"key": "likesMilk", "type": "bool"}, + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword meows: :paramtype meows: bool @@ -100,10 +109,10 @@ def __init__(self, **kwargs): :paramtype likes_milk: bool """ super(Cat, self).__init__(**kwargs) - self.meows = kwargs.get("meows", None) - self.hisses = kwargs.get("hisses", None) - self.likes_milk = kwargs.get("likes_milk", None) - self.name = kwargs["name"] + self.meows = kwargs.get('meows', None) + self.hisses = kwargs.get('hisses', None) + self.likes_milk = kwargs.get('likes_milk', None) + self.name = kwargs['name'] class Error(msrest.serialization.Model): @@ -116,11 +125,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -128,8 +140,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class Horse(Pet): @@ -144,15 +156,18 @@ class Horse(Pet): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_a_show_horse": {"key": "isAShowHorse", "type": "bool"}, + 'name': {'key': 'name', 'type': 'str'}, + 'is_a_show_horse': {'key': 'isAShowHorse', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -160,7 +175,7 @@ def __init__(self, **kwargs): :paramtype is_a_show_horse: bool """ super(Horse, self).__init__(**kwargs) - self.is_a_show_horse = kwargs.get("is_a_show_horse", None) + self.is_a_show_horse = kwargs.get('is_a_show_horse', None) class Kitten(Cat): @@ -181,18 +196,21 @@ class Kitten(Cat): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "meows": {"key": "meows", "type": "bool"}, - "hisses": {"key": "hisses", "type": "bool"}, - "name": {"key": "name", "type": "str"}, - "likes_milk": {"key": "likesMilk", "type": "bool"}, - "eats_mice_yet": {"key": "eatsMiceYet", "type": "bool"}, + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, + 'eats_mice_yet': {'key': 'eatsMiceYet', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword meows: :paramtype meows: bool @@ -206,4 +224,4 @@ def __init__(self, **kwargs): :paramtype eats_mice_yet: bool """ super(Kitten, self).__init__(**kwargs) - self.eats_mice_yet = kwargs.get("eats_mice_yet", None) + self.eats_mice_yet = kwargs.get('eats_mice_yet', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models_py3.py index 333e7197a42..1eb8fd00ae7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models_py3.py @@ -22,11 +22,17 @@ class Feline(msrest.serialization.Model): """ _attribute_map = { - "meows": {"key": "meows", "type": "bool"}, - "hisses": {"key": "hisses", "type": "bool"}, + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, } - def __init__(self, *, meows: Optional[bool] = None, hisses: Optional[bool] = None, **kwargs): + def __init__( + self, + *, + meows: Optional[bool] = None, + hisses: Optional[bool] = None, + **kwargs + ): """ :keyword meows: :paramtype meows: bool @@ -48,14 +54,19 @@ class Pet(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs): + def __init__( + self, + *, + name: str, + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -80,14 +91,14 @@ class Cat(Pet, Feline): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "meows": {"key": "meows", "type": "bool"}, - "hisses": {"key": "hisses", "type": "bool"}, - "name": {"key": "name", "type": "str"}, - "likes_milk": {"key": "likesMilk", "type": "bool"}, + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, } def __init__( @@ -126,11 +137,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -154,15 +171,21 @@ class Horse(Pet): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_a_show_horse": {"key": "isAShowHorse", "type": "bool"}, + 'name': {'key': 'name', 'type': 'str'}, + 'is_a_show_horse': {'key': 'isAShowHorse', 'type': 'bool'}, } - def __init__(self, *, name: str, is_a_show_horse: Optional[bool] = None, **kwargs): + def __init__( + self, + *, + name: str, + is_a_show_horse: Optional[bool] = None, + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -191,15 +214,15 @@ class Kitten(Cat): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "meows": {"key": "meows", "type": "bool"}, - "hisses": {"key": "hisses", "type": "bool"}, - "name": {"key": "name", "type": "str"}, - "likes_milk": {"key": "likesMilk", "type": "bool"}, - "eats_mice_yet": {"key": "eatsMiceYet", "type": "bool"}, + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, + 'eats_mice_yet': {'key': 'eatsMiceYet', 'type': 'bool'}, } def __init__( diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/__init__.py index 86aed303fc8..4afee8c7842 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/__init__.py @@ -9,5 +9,5 @@ from ._multiple_inheritance_service_client_operations import MultipleInheritanceServiceClientOperationsMixin __all__ = [ - "MultipleInheritanceServiceClientOperationsMixin", + 'MultipleInheritanceServiceClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py index 94b4e269c5c..2febf4e3270 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -257,9 +249,11 @@ def build_put_kitten_request( # fmt: on class MultipleInheritanceServiceClientOperationsMixin(object): + @distributed_trace def get_horse( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Horse" """Get a horse with name 'Fred' and isAShowHorse true. @@ -269,17 +263,24 @@ def get_horse( :rtype: ~multipleinheritance.models.Horse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Horse"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Horse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_horse_request( - template_url=self.get_horse.metadata["url"], + template_url=self.get_horse.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -287,14 +288,15 @@ def get_horse( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Horse", pipeline_response) + deserialized = self._deserialize('Horse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_horse.metadata = {"url": "/multipleInheritance/horse"} # type: ignore + get_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + @distributed_trace def put_horse( @@ -312,41 +314,49 @@ def put_horse( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(horse, "Horse") + _json = self._serialize.body(horse, 'Horse') request = build_put_horse_request( content_type=content_type, json=_json, - template_url=self.put_horse.metadata["url"], + template_url=self.put_horse.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_horse.metadata = {"url": "/multipleInheritance/horse"} # type: ignore + put_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + @distributed_trace def get_pet( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Pet" """Get a pet with name 'Peanut'. @@ -356,17 +366,24 @@ def get_pet( :rtype: ~multipleinheritance.models.Pet :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Pet"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Pet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_pet_request( - template_url=self.get_pet.metadata["url"], + template_url=self.get_pet.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -374,14 +391,15 @@ def get_pet( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_pet.metadata = {"url": "/multipleInheritance/pet"} # type: ignore + get_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + @distributed_trace def put_pet( @@ -399,42 +417,50 @@ def put_pet( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _pet = _models.Pet(name=name) - _json = self._serialize.body(_pet, "Pet") + _json = self._serialize.body(_pet, 'Pet') request = build_put_pet_request( content_type=content_type, json=_json, - template_url=self.put_pet.metadata["url"], + template_url=self.put_pet.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_pet.metadata = {"url": "/multipleInheritance/pet"} # type: ignore + put_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + @distributed_trace def get_feline( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Feline" """Get a feline where meows and hisses are true. @@ -444,17 +470,24 @@ def get_feline( :rtype: ~multipleinheritance.models.Feline :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Feline"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Feline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_feline_request( - template_url=self.get_feline.metadata["url"], + template_url=self.get_feline.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -462,14 +495,15 @@ def get_feline( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Feline", pipeline_response) + deserialized = self._deserialize('Feline', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_feline.metadata = {"url": "/multipleInheritance/feline"} # type: ignore + get_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + @distributed_trace def put_feline( @@ -487,41 +521,49 @@ def put_feline( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(feline, "Feline") + _json = self._serialize.body(feline, 'Feline') request = build_put_feline_request( content_type=content_type, json=_json, - template_url=self.put_feline.metadata["url"], + template_url=self.put_feline.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_feline.metadata = {"url": "/multipleInheritance/feline"} # type: ignore + put_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + @distributed_trace def get_cat( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Cat" """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. @@ -531,17 +573,24 @@ def get_cat( :rtype: ~multipleinheritance.models.Cat :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Cat"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Cat"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_cat_request( - template_url=self.get_cat.metadata["url"], + template_url=self.get_cat.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -549,14 +598,15 @@ def get_cat( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Cat", pipeline_response) + deserialized = self._deserialize('Cat', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_cat.metadata = {"url": "/multipleInheritance/cat"} # type: ignore + get_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + @distributed_trace def put_cat( @@ -574,41 +624,49 @@ def put_cat( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(cat, "Cat") + _json = self._serialize.body(cat, 'Cat') request = build_put_cat_request( content_type=content_type, json=_json, - template_url=self.put_cat.metadata["url"], + template_url=self.put_cat.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_cat.metadata = {"url": "/multipleInheritance/cat"} # type: ignore + put_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + @distributed_trace def get_kitten( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Kitten" """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet @@ -619,17 +677,24 @@ def get_kitten( :rtype: ~multipleinheritance.models.Kitten :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Kitten"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Kitten"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_kitten_request( - template_url=self.get_kitten.metadata["url"], + template_url=self.get_kitten.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -637,14 +702,15 @@ def get_kitten( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Kitten", pipeline_response) + deserialized = self._deserialize('Kitten', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_kitten.metadata = {"url": "/multipleInheritance/kitten"} # type: ignore + get_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore + @distributed_trace def put_kitten( @@ -664,34 +730,41 @@ def put_kitten( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(kitten, "Kitten") + _json = self._serialize.body(kitten, 'Kitten') request = build_put_kitten_request( content_type=content_type, json=_json, - template_url=self.put_kitten.metadata["url"], + template_url=self.put_kitten.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put_kitten.metadata = {"url": "/multipleInheritance/kitten"} # type: ignore + put_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py index 5d90113dd65..cfdb6a2a981 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for multiinheritance client testing. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/__init__.py index d55ccad1f57..5960c353a89 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models.py index 24f34f6486a..04624aa582b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models.py @@ -19,11 +19,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -31,5 +34,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models_py3.py index 193592d4755..2cbead8e4d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_models_py3.py @@ -21,11 +21,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py index 66ffc7560f0..e89f95f6531 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client with no operations. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/__init__.py index 0d39634a248..339a2c819ef 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["NonStringEnumsClient"] +__all__ = ['NonStringEnumsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_configuration.py index a29dd58414b..4d64898e703 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class NonStringEnumsClientConfiguration(Configuration): +class NonStringEnumsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for NonStringEnumsClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class NonStringEnumsClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(NonStringEnumsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "nonstringenumsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'nonstringenumsclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py index 187a0a813f1..118f6f5299b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py @@ -17,11 +17,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.rest import HttpRequest, HttpResponse - class NonStringEnumsClient(object): """Testing non-string enums. @@ -49,6 +48,7 @@ def __init__( self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) self.float = FloatOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/__init__.py index affc03b809b..32ad006d576 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._non_string_enums_client import NonStringEnumsClient - -__all__ = ["NonStringEnumsClient"] +__all__ = ['NonStringEnumsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_configuration.py index 7daa742b2c9..ce96ec5284b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class NonStringEnumsClientConfiguration(Configuration): +class NonStringEnumsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for NonStringEnumsClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(NonStringEnumsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "nonstringenumsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'nonstringenumsclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py index 08eccf482bc..124098de619 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class NonStringEnumsClient: """Testing non-string enums. @@ -32,7 +31,11 @@ class NonStringEnumsClient: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = NonStringEnumsClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -43,7 +46,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) self.float = FloatOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/__init__.py index 428fb2bd59e..c2816987187 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._float_operations import FloatOperations __all__ = [ - "IntOperations", - "FloatOperations", + 'IntOperations', + 'FloatOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py index 4ba232fdd1b..e35fe7c0302 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._float_operations import build_get_request, build_put_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FloatOperations: """FloatOperations async operations. @@ -48,7 +39,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def put(self, input: Optional[Union[float, "_models.FloatEnum"]] = None, **kwargs: Any) -> str: + async def put( + self, + input: Optional[Union[float, "_models.FloatEnum"]] = None, + **kwargs: Any + ) -> str: """Put a float enum. :param input: Input float enum. @@ -58,43 +53,53 @@ async def put(self, input: Optional[Union[float, "_models.FloatEnum"]] = None, * :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: - _json = self._serialize.body(input, "float") + _json = self._serialize.body(input, 'float') else: _json = None request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {"url": "/nonStringEnums/float/put"} # type: ignore + put.metadata = {'url': '/nonStringEnums/float/put'} # type: ignore + @distributed_trace_async - async def get(self, **kwargs: Any) -> Union[float, "_models.FloatEnum"]: + async def get( + self, + **kwargs: Any + ) -> Union[float, "_models.FloatEnum"]: """Get a float enum. :keyword callable cls: A custom type or function that will be passed the direct response @@ -102,28 +107,36 @@ async def get(self, **kwargs: Any) -> Union[float, "_models.FloatEnum"]: :rtype: float or ~nonstringenums.models.FloatEnum :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[float, "_models.FloatEnum"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[float, "_models.FloatEnum"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/nonStringEnums/float/get"} # type: ignore + get.metadata = {'url': '/nonStringEnums/float/get'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations.py index 19d71cae33d..a6da6c32a51 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._int_operations import build_get_request, build_put_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class IntOperations: """IntOperations async operations. @@ -48,7 +39,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def put(self, input: Optional[Union[int, "_models.IntEnum"]] = None, **kwargs: Any) -> str: + async def put( + self, + input: Optional[Union[int, "_models.IntEnum"]] = None, + **kwargs: Any + ) -> str: """Put an int enum. :param input: Input int enum. @@ -58,43 +53,53 @@ async def put(self, input: Optional[Union[int, "_models.IntEnum"]] = None, **kwa :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: - _json = self._serialize.body(input, "int") + _json = self._serialize.body(input, 'int') else: _json = None request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {"url": "/nonStringEnums/int/put"} # type: ignore + put.metadata = {'url': '/nonStringEnums/int/put'} # type: ignore + @distributed_trace_async - async def get(self, **kwargs: Any) -> Union[int, "_models.IntEnum"]: + async def get( + self, + **kwargs: Any + ) -> Union[int, "_models.IntEnum"]: """Get an int enum. :keyword callable cls: A custom type or function that will be passed the direct response @@ -102,28 +107,36 @@ async def get(self, **kwargs: Any) -> Union[int, "_models.IntEnum"]: :rtype: int or ~nonstringenums.models.IntEnum :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[int, "_models.IntEnum"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[int, "_models.IntEnum"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/nonStringEnums/int/get"} # type: ignore + get.metadata = {'url': '/nonStringEnums/int/get'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py index 426ca8a6ea6..1a2e00a41b0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py @@ -13,6 +13,6 @@ ) __all__ = [ - "FloatEnum", - "IntEnum", + 'FloatEnum', + 'IntEnum', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_non_string_enums_client_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_non_string_enums_client_enums.py index 8854d9960a9..489af9aafe4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_non_string_enums_client_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_non_string_enums_client_enums.py @@ -12,7 +12,8 @@ class FloatEnum(with_metaclass(CaseInsensitiveEnumMeta, float, Enum)): - """List of float enums""" + """List of float enums + """ TWO_HUNDRED4 = 200.4 FOUR_HUNDRED_THREE4 = 403.4 @@ -20,9 +21,9 @@ class FloatEnum(with_metaclass(CaseInsensitiveEnumMeta, float, Enum)): FOUR_HUNDRED_SIX2 = 406.2 FOUR_HUNDRED_TWENTY_NINE1 = 429.1 - class IntEnum(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): - """List of integer enums""" + """List of integer enums + """ TWO_HUNDRED = 200 FOUR_HUNDRED_THREE = 403 diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/__init__.py index 428fb2bd59e..c2816987187 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/__init__.py @@ -10,6 +10,6 @@ from ._float_operations import FloatOperations __all__ = [ - "IntOperations", - "FloatOperations", + 'IntOperations', + 'FloatOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py index 98c5e2ede4e..241d22061c1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -114,44 +106,52 @@ def put( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: - _json = self._serialize.body(input, "float") + _json = self._serialize.body(input, 'float') else: _json = None request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {"url": "/nonStringEnums/float/put"} # type: ignore + put.metadata = {'url': '/nonStringEnums/float/put'} # type: ignore + @distributed_trace def get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union[float, "_models.FloatEnum"] """Get a float enum. @@ -161,28 +161,36 @@ def get( :rtype: float or ~nonstringenums.models.FloatEnum :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[float, "_models.FloatEnum"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[float, "_models.FloatEnum"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("float", pipeline_response) + deserialized = self._deserialize('float', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/nonStringEnums/float/get"} # type: ignore + get.metadata = {'url': '/nonStringEnums/float/get'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations.py index 3958137f0fd..6583d91ba78 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -114,44 +106,52 @@ def put( :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: - _json = self._serialize.body(input, "int") + _json = self._serialize.body(input, 'int') else: _json = None request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("str", pipeline_response) + deserialized = self._deserialize('str', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {"url": "/nonStringEnums/int/put"} # type: ignore + put.metadata = {'url': '/nonStringEnums/int/put'} # type: ignore + @distributed_trace def get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Union[int, "_models.IntEnum"] """Get an int enum. @@ -161,28 +161,36 @@ def get( :rtype: int or ~nonstringenums.models.IntEnum :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Union[int, "_models.IntEnum"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Union[int, "_models.IntEnum"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("int", pipeline_response) + deserialized = self._deserialize('int', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/nonStringEnums/int/get"} # type: ignore + get.metadata = {'url': '/nonStringEnums/int/get'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py index 67f8f2e27c2..d67d567521a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Testing non-string enums. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/__init__.py index 09dfe0c03cd..e56ee1488d0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ObjectTypeClient"] +__all__ = ['ObjectTypeClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_configuration.py index b8c2eb028e2..ebd7b5e830e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class ObjectTypeClientConfiguration(Configuration): +class ObjectTypeClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ObjectTypeClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class ObjectTypeClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(ObjectTypeClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "objecttypeclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'objecttypeclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py index 3e86486fa6a..a874633c2e1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py @@ -17,11 +17,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, Optional + from typing import Any, Dict from azure.core.rest import HttpRequest, HttpResponse - class ObjectTypeClient(ObjectTypeClientOperationsMixin): """Service client for testing basic type: object swaggers. @@ -43,6 +42,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/__init__.py index c1ad6e24f4d..2ab3dbf0215 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._object_type_client import ObjectTypeClient - -__all__ = ["ObjectTypeClient"] +__all__ = ['ObjectTypeClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_configuration.py index 5c8877fc3b9..6780a0e6232 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class ObjectTypeClientConfiguration(Configuration): +class ObjectTypeClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ObjectTypeClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ObjectTypeClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "objecttypeclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'objecttypeclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py index 7061faa0de3..bc24da13f74 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ObjectTypeClient(ObjectTypeClientOperationsMixin): """Service client for testing basic type: object swaggers. @@ -28,7 +27,11 @@ class ObjectTypeClient(ObjectTypeClientOperationsMixin): :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = ObjectTypeClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/__init__.py index 73af5b3aae6..29266a8de5e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._object_type_client_operations import ObjectTypeClientOperationsMixin __all__ = [ - "ObjectTypeClientOperationsMixin", + 'ObjectTypeClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py index 5e7b0afb06d..d2b9e8c0214 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,14 +16,16 @@ from ..._vendor import _convert_request from ...operations._object_type_client_operations import build_get_request, build_put_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ObjectTypeClientOperationsMixin: + @distributed_trace_async - async def get(self, **kwargs: Any) -> Any: + async def get( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an object. Returns object { 'message': 'An object was successfully returned' }. @@ -39,35 +34,47 @@ async def get(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) + error = self._deserialize.failsafe_deserialize('object', pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/objectType/get"} # type: ignore + get.metadata = {'url': '/objectType/get'} # type: ignore + @distributed_trace_async - async def put(self, put_object: Any, **kwargs: Any) -> None: + async def put( + self, + put_object: Any, + **kwargs: Any + ) -> None: """Basic put that puts an object. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -78,31 +85,38 @@ async def put(self, put_object: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(put_object, "object") + _json = self._serialize.body(put_object, 'object') request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) + error = self._deserialize.failsafe_deserialize('object', pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {}) - put.metadata = {"url": "/objectType/put"} # type: ignore + put.metadata = {'url': '/objectType/put'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/__init__.py index 73af5b3aae6..29266a8de5e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/__init__.py @@ -9,5 +9,5 @@ from ._object_type_client_operations import ObjectTypeClientOperationsMixin __all__ = [ - "ObjectTypeClientOperationsMixin", + 'ObjectTypeClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py index df3fd000640..496cd0480d4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -26,9 +19,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -80,9 +72,11 @@ def build_put_request( # fmt: on class ObjectTypeClientOperationsMixin(object): + @distributed_trace def get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> Any """Basic get that returns an object. Returns object { 'message': 'An object was successfully @@ -93,32 +87,40 @@ def get( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) + error = self._deserialize.failsafe_deserialize('object', pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {"url": "/objectType/get"} # type: ignore + get.metadata = {'url': '/objectType/get'} # type: ignore + @distributed_trace def put( @@ -137,31 +139,38 @@ def put( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(put_object, "object") + _json = self._serialize.body(put_object, 'object') request = build_put_request( content_type=content_type, json=_json, - template_url=self.put.metadata["url"], + template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize("object", pipeline_response) + error = self._deserialize.failsafe_deserialize('object', pipeline_response) raise HttpResponseError(response=response, model=error) if cls: return cls(pipeline_response, None, {}) - put.metadata = {"url": "/objectType/put"} # type: ignore + put.metadata = {'url': '/objectType/put'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py index fae955ee4ad..8c6b57e7416 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing basic type: object swaggers. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/__init__.py index 89734cff0ef..e3a59770bd4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterFlattening"] +__all__ = ['AutoRestParameterFlattening'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py index b9b8b6cac6a..4a09eed602a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestParameterFlattening(object): """Resource Flattening for AutoRest. @@ -45,9 +44,8 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.availability_sets = AvailabilitySetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.availability_sets = AvailabilitySetsOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_configuration.py index ad161b32967..94f9a88f6a6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestParameterFlatteningConfiguration(Configuration): +class AutoRestParameterFlatteningConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterFlattening. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestParameterFlatteningConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestParameterFlatteningConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparameterflattening/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterflattening/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/__init__.py index afd7446dd4f..79225d2b2ed 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameter_flattening import AutoRestParameterFlattening - -__all__ = ["AutoRestParameterFlattening"] +__all__ = ['AutoRestParameterFlattening'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py index e33d8e1fec2..c109aa15610 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestParameterFlatteningConfiguration from .operations import AvailabilitySetsOperations - class AutoRestParameterFlattening: """Resource Flattening for AutoRest. @@ -27,7 +26,11 @@ class AutoRestParameterFlattening: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestParameterFlatteningConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -35,11 +38,14 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.availability_sets = AvailabilitySetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.availability_sets = AvailabilitySetsOperations(self._client, self._config, self._serialize, self._deserialize) + - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_configuration.py index 2def2fa1a10..62d5d8180ef 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestParameterFlatteningConfiguration(Configuration): +class AutoRestParameterFlatteningConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterFlattening. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterFlatteningConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparameterflattening/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterflattening/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/__init__.py index cf8595799b1..953ac9ff0bb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._availability_sets_operations import AvailabilitySetsOperations __all__ = [ - "AvailabilitySetsOperations", + 'AvailabilitySetsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py index a8598dd4423..032fefc3af1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._availability_sets_operations import build_update_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AvailabilitySetsOperations: """AvailabilitySetsOperations async operations. @@ -52,7 +43,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def update(self, resource_group_name: str, avset: str, tags: Dict[str, str], **kwargs: Any) -> None: + async def update( + self, + resource_group_name: str, + avset: str, + tags: Dict[str, str], + **kwargs: Any + ) -> None: """Updates the tags for an availability set. :param resource_group_name: The name of the resource group. @@ -66,26 +63,32 @@ async def update(self, resource_group_name: str, avset: str, tags: Dict[str, str :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _tags = _models.AvailabilitySetUpdateParameters(tags=tags) - _json = self._serialize.body(_tags, "AvailabilitySetUpdateParameters") + _json = self._serialize.body(_tags, 'AvailabilitySetUpdateParameters') request = build_update_request( resource_group_name=resource_group_name, avset=avset, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], + template_url=self.update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -95,4 +98,5 @@ async def update(self, resource_group_name: str, avset: str, tags: Dict[str, str if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/parameterFlattening/{resourceGroupName}/{availabilitySetName}"} # type: ignore + update.metadata = {'url': '/parameterFlattening/{resourceGroupName}/{availabilitySetName}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py index 0acd5704db4..b839319a488 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py @@ -12,5 +12,5 @@ from ._models import AvailabilitySetUpdateParameters # type: ignore __all__ = [ - "AvailabilitySetUpdateParameters", + 'AvailabilitySetUpdateParameters', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models.py index 9182722f176..e9917c4f909 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models.py @@ -19,17 +19,20 @@ class AvailabilitySetUpdateParameters(msrest.serialization.Model): """ _validation = { - "tags": {"required": True}, + 'tags': {'required': True}, } _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword tags: Required. A set of tags. A description about the set of tags. :paramtype tags: dict[str, str] """ super(AvailabilitySetUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs["tags"] + self.tags = kwargs['tags'] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models_py3.py index 64de0c21e73..066a8204dd4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_models_py3.py @@ -21,14 +21,19 @@ class AvailabilitySetUpdateParameters(msrest.serialization.Model): """ _validation = { - "tags": {"required": True}, + 'tags': {'required': True}, } _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, tags: Dict[str, str], **kwargs): + def __init__( + self, + *, + tags: Dict[str, str], + **kwargs + ): """ :keyword tags: Required. A set of tags. A description about the set of tags. :paramtype tags: dict[str, str] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/__init__.py index cf8595799b1..953ac9ff0bb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/__init__.py @@ -9,5 +9,5 @@ from ._availability_sets_operations import AvailabilitySetsOperations __all__ = [ - "AvailabilitySetsOperations", + 'AvailabilitySetsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py index 620d1480ca5..47504676240 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -110,26 +102,32 @@ def update( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _tags = _models.AvailabilitySetUpdateParameters(tags=tags) - _json = self._serialize.body(_tags, "AvailabilitySetUpdateParameters") + _json = self._serialize.body(_tags, 'AvailabilitySetUpdateParameters') request = build_update_request( resource_group_name=resource_group_name, avset=avset, content_type=content_type, json=_json, - template_url=self.update.metadata["url"], + template_url=self.update.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -139,4 +137,5 @@ def update( if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/parameterFlattening/{resourceGroupName}/{availabilitySetName}"} # type: ignore + update.metadata = {'url': '/parameterFlattening/{resourceGroupName}/{availabilitySetName}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py index 5deb8606bc4..9da8a75fb55 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Resource Flattening for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/__init__.py index b8ba21b64e7..2668d267b05 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ParmaterizedEndpointClient"] +__all__ = ['ParmaterizedEndpointClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_configuration.py index 551be228881..b3555b7d1dd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class ParmaterizedEndpointClientConfiguration(Configuration): +class ParmaterizedEndpointClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ParmaterizedEndpointClient. Note that all parameters used to create this instance are saved as instance @@ -39,19 +39,20 @@ def __init__( raise ValueError("Parameter 'endpoint' must not be None.") self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "parmaterizedendpointclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'parmaterizedendpointclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py index a0e95296769..09bad8df71a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py @@ -21,7 +21,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class ParmaterizedEndpointClient(ParmaterizedEndpointClientOperationsMixin): """Service client for testing parameterized hosts with the name 'endpoint'. @@ -35,7 +34,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - _base_url = "{endpoint}" + _base_url = '{endpoint}' self._config = ParmaterizedEndpointClientConfiguration(endpoint=endpoint, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -44,6 +43,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest @@ -69,7 +69,7 @@ def _send_request( request_copy = deepcopy(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/__init__.py index cc7178494ae..59521cea44d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._parmaterized_endpoint_client import ParmaterizedEndpointClient - -__all__ = ["ParmaterizedEndpointClient"] +__all__ = ['ParmaterizedEndpointClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_configuration.py index ea820d0034b..cbdabb5aa79 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class ParmaterizedEndpointClientConfiguration(Configuration): +class ParmaterizedEndpointClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ParmaterizedEndpointClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class ParmaterizedEndpointClientConfiguration(Configuration): :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: super(ParmaterizedEndpointClientConfiguration, self).__init__(**kwargs) if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "parmaterizedendpointclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'parmaterizedendpointclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py index 7bde59790cc..8068bfeb883 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ParmaterizedEndpointClient(ParmaterizedEndpointClientOperationsMixin): """Service client for testing parameterized hosts with the name 'endpoint'. @@ -28,8 +27,12 @@ class ParmaterizedEndpointClient(ParmaterizedEndpointClientOperationsMixin): :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: - _base_url = "{endpoint}" + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: + _base_url = '{endpoint}' self._config = ParmaterizedEndpointClientConfiguration(endpoint=endpoint, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) @@ -38,7 +41,12 @@ def __init__(self, endpoint: str, **kwargs: Any) -> None: self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -58,7 +66,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/__init__.py index 0ba9ffa6fda..45b99323eba 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._parmaterized_endpoint_client_operations import ParmaterizedEndpointClientOperationsMixin __all__ = [ - "ParmaterizedEndpointClientOperationsMixin", + 'ParmaterizedEndpointClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py index ddb3797a3cc..19b9201d97c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,14 +16,16 @@ from ..._vendor import _convert_request from ...operations._parmaterized_endpoint_client_operations import build_get_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ParmaterizedEndpointClientOperationsMixin: + @distributed_trace_async - async def get(self, **kwargs: Any) -> None: + async def get( + self, + **kwargs: Any + ) -> None: """Basic get to make sure base url formatting of 'endpoint' works. :keyword callable cls: A custom type or function that will be passed the direct response @@ -38,20 +33,27 @@ async def get(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -61,4 +63,5 @@ async def get(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/parameterizedEndpoint/get"} # type: ignore + get.metadata = {'url': '/parameterizedEndpoint/get'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/__init__.py index 0ba9ffa6fda..45b99323eba 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/__init__.py @@ -9,5 +9,5 @@ from ._parmaterized_endpoint_client_operations import ParmaterizedEndpointClientOperationsMixin __all__ = [ - "ParmaterizedEndpointClientOperationsMixin", + 'ParmaterizedEndpointClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py index b228f2aeb62..1783354ea57 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -26,9 +19,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -50,9 +42,11 @@ def build_get_request( # fmt: on class ParmaterizedEndpointClientOperationsMixin(object): + @distributed_trace def get( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Basic get to make sure base url formatting of 'endpoint' works. @@ -62,20 +56,27 @@ def get( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_request( - template_url=self.get.metadata["url"], + template_url=self.get.metadata['url'], ) request = _convert_request(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -85,4 +86,5 @@ def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/parameterizedEndpoint/get"} # type: ignore + get.metadata = {'url': '/parameterizedEndpoint/get'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py index b4cd6534537..64afd119cb9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing parameterized hosts with the name 'endpoint'. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/__init__.py index 194a940b001..3c47c0e71b8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestReportService"] +__all__ = ['AutoRestReportService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py index 062767db1c1..d6473665f7c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestReportService(AutoRestReportServiceOperationsMixin): """Test Infrastructure for AutoRest. @@ -44,6 +43,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_configuration.py index 80e1163ce47..ffd51612fab 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestReportServiceConfiguration(Configuration): +class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestReportServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/__init__.py index 7db91454410..d2bc65f6452 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_report_service import AutoRestReportService - -__all__ = ["AutoRestReportService"] +__all__ = ['AutoRestReportService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py index 93dc2dcd037..0d7aebcf5e4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestReportServiceConfiguration from .operations import AutoRestReportServiceOperationsMixin - class AutoRestReportService(AutoRestReportServiceOperationsMixin): """Test Infrastructure for AutoRest. @@ -25,7 +24,11 @@ class AutoRestReportService(AutoRestReportServiceOperationsMixin): :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestReportServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -34,7 +37,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_configuration.py index 0b086b995d9..07f1640ca40 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestReportServiceConfiguration(Configuration): +class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/__init__.py index 05baf0fc22d..00cb6f42dd3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_report_service_operations import AutoRestReportServiceOperationsMixin __all__ = [ - "AutoRestReportServiceOperationsMixin", + 'AutoRestReportServiceOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py index 9872b83ad3b..97a23461849 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,18 +16,18 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._auto_rest_report_service_operations import ( - build_get_optional_report_request, - build_get_report_request, -) - -T = TypeVar("T") +from ...operations._auto_rest_report_service_operations import build_get_optional_report_request, build_get_report_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestReportServiceOperationsMixin: + @distributed_trace_async - async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + async def get_report( + self, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get test coverage report. :param qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' in @@ -46,18 +39,25 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_report_request( qualifier=qualifier, - template_url=self.get_report.metadata["url"], + template_url=self.get_report.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -65,17 +65,22 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_report.metadata = {"url": "/report"} # type: ignore + get_report.metadata = {'url': '/report'} # type: ignore + @distributed_trace_async - async def get_optional_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + async def get_optional_report( + self, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get optional test coverage report. :param qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' in @@ -87,18 +92,25 @@ async def get_optional_report(self, qualifier: Optional[str] = None, **kwargs: A :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_optional_report_request( qualifier=qualifier, - template_url=self.get_optional_report.metadata["url"], + template_url=self.get_optional_report.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,11 +118,12 @@ async def get_optional_report(self, qualifier: Optional[str] = None, **kwargs: A error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_optional_report.metadata = {"url": "/report/optional"} # type: ignore + get_optional_report.metadata = {'url': '/report/optional'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/__init__.py index 05baf0fc22d..00cb6f42dd3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_report_service_operations import AutoRestReportServiceOperationsMixin __all__ = [ - "AutoRestReportServiceOperationsMixin", + 'AutoRestReportServiceOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py index 7a5cdd6079e..04da29b4f3a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -93,6 +85,7 @@ def build_get_optional_report_request( # fmt: on class AutoRestReportServiceOperationsMixin(object): + @distributed_trace def get_report( self, @@ -111,18 +104,25 @@ def get_report( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_report_request( qualifier=qualifier, - template_url=self.get_report.metadata["url"], + template_url=self.get_report.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,14 +130,15 @@ def get_report( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_report.metadata = {"url": "/report"} # type: ignore + get_report.metadata = {'url': '/report'} # type: ignore + @distributed_trace def get_optional_report( @@ -157,18 +158,25 @@ def get_optional_report( :rtype: dict[str, int] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_optional_report_request( qualifier=qualifier, - template_url=self.get_optional_report.metadata["url"], + template_url=self.get_optional_report.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,11 +184,12 @@ def get_optional_report( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{int}", pipeline_response) + deserialized = self._deserialize('{int}', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_optional_report.metadata = {"url": "/report/optional"} # type: ignore + get_optional_report.metadata = {'url': '/report/optional'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py index 2f4459980ef..a1b05ebd53f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/__init__.py index c9a1faeed62..aeb3ff59763 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestRequiredOptionalTestService"] +__all__ = ['AutoRestRequiredOptionalTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py index 9bcbd8becf9..98667e3d3b4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py @@ -22,7 +22,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class AutoRestRequiredOptionalTestService(object): """Test Infrastructure for AutoRest. @@ -49,12 +48,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - self._config = AutoRestRequiredOptionalTestServiceConfiguration( - required_global_path=required_global_path, - required_global_query=required_global_query, - optional_global_query=optional_global_query, - **kwargs - ) + self._config = AutoRestRequiredOptionalTestServiceConfiguration(required_global_path=required_global_path, required_global_query=required_global_query, optional_global_query=optional_global_query, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -63,6 +57,7 @@ def __init__( self.implicit = ImplicitOperations(self._client, self._config, self._serialize, self._deserialize) self.explicit = ExplicitOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_configuration.py index 6e31b436139..a9f2f148d50 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_configuration.py @@ -18,7 +18,7 @@ from typing import Any, Optional -class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): +class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRequiredOptionalTestService. Note that all parameters used to create this instance are saved as instance @@ -49,19 +49,20 @@ def __init__( self.required_global_path = required_global_path self.required_global_query = required_global_query self.optional_global_query = optional_global_query - kwargs.setdefault("sdk_moniker", "autorestrequiredoptionaltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrequiredoptionaltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/__init__.py index 0648b590400..455a4888284 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_required_optional_test_service import AutoRestRequiredOptionalTestService - -__all__ = ["AutoRestRequiredOptionalTestService"] +__all__ = ['AutoRestRequiredOptionalTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py index d51931c0691..da1707e3dad 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py @@ -17,7 +17,6 @@ from ._configuration import AutoRestRequiredOptionalTestServiceConfiguration from .operations import ExplicitOperations, ImplicitOperations - class AutoRestRequiredOptionalTestService: """Test Infrastructure for AutoRest. @@ -43,12 +42,7 @@ def __init__( base_url: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestRequiredOptionalTestServiceConfiguration( - required_global_path=required_global_path, - required_global_query=required_global_query, - optional_global_query=optional_global_query, - **kwargs - ) + self._config = AutoRestRequiredOptionalTestServiceConfiguration(required_global_path=required_global_path, required_global_query=required_global_query, optional_global_query=optional_global_query, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -57,7 +51,12 @@ def __init__( self.implicit = ImplicitOperations(self._client, self._config, self._serialize, self._deserialize) self.explicit = ExplicitOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_configuration.py index 2a219b5169e..1c395c72058 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): +class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRequiredOptionalTestService. Note that all parameters used to create this instance are saved as instance @@ -44,16 +44,19 @@ def __init__( self.required_global_path = required_global_path self.required_global_query = required_global_query self.optional_global_query = optional_global_query - kwargs.setdefault("sdk_moniker", "autorestrequiredoptionaltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrequiredoptionaltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/__init__.py index 8bf716be8df..d145a1fba4e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._explicit_operations import ExplicitOperations __all__ = [ - "ImplicitOperations", - "ExplicitOperations", + 'ImplicitOperations', + 'ExplicitOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py index 954d5c79fce..10e48450f6a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,38 +16,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._explicit_operations import ( - build_post_optional_array_header_request, - build_post_optional_array_parameter_request, - build_post_optional_array_property_request, - build_post_optional_class_parameter_request, - build_post_optional_class_property_request, - build_post_optional_integer_header_request, - build_post_optional_integer_parameter_request, - build_post_optional_integer_property_request, - build_post_optional_string_header_request, - build_post_optional_string_parameter_request, - build_post_optional_string_property_request, - build_post_required_array_header_request, - build_post_required_array_parameter_request, - build_post_required_array_property_request, - build_post_required_class_parameter_request, - build_post_required_class_property_request, - build_post_required_integer_header_request, - build_post_required_integer_parameter_request, - build_post_required_integer_property_request, - build_post_required_string_header_request, - build_post_required_string_parameter_request, - build_post_required_string_property_request, - build_put_optional_binary_body_request, - build_put_required_binary_body_request, -) - -T = TypeVar("T") +from ...operations._explicit_operations import build_post_optional_array_header_request, build_post_optional_array_parameter_request, build_post_optional_array_property_request, build_post_optional_class_parameter_request, build_post_optional_class_property_request, build_post_optional_integer_header_request, build_post_optional_integer_parameter_request, build_post_optional_integer_property_request, build_post_optional_string_header_request, build_post_optional_string_parameter_request, build_post_optional_string_property_request, build_post_required_array_header_request, build_post_required_array_parameter_request, build_post_required_array_property_request, build_post_required_class_parameter_request, build_post_required_class_property_request, build_post_required_integer_header_request, build_post_required_integer_parameter_request, build_post_required_integer_property_request, build_post_required_string_header_request, build_post_required_string_parameter_request, build_post_required_string_property_request, build_put_optional_binary_body_request, build_put_required_binary_body_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ExplicitOperations: +class ExplicitOperations: # pylint: disable=too-many-public-methods """ExplicitOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -77,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs: Any) -> None: + async def put_optional_binary_body( + self, + body_parameter: Optional[IO] = None, + **kwargs: Any + ) -> None: """Test explicitly optional body parameter. :param body_parameter: @@ -87,23 +57,29 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter request = build_put_optional_binary_body_request( content_type=content_type, content=_content, - template_url=self.put_optional_binary_body.metadata["url"], + template_url=self.put_optional_binary_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,10 +90,15 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** if cls: return cls(pipeline_response, None, {}) - put_optional_binary_body.metadata = {"url": "/reqopt/explicit/optional/binary-body"} # type: ignore + put_optional_binary_body.metadata = {'url': '/reqopt/explicit/optional/binary-body'} # type: ignore + @distributed_trace_async - async def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> None: + async def put_required_binary_body( + self, + body_parameter: IO, + **kwargs: Any + ) -> None: """Test explicitly required body parameter. :param body_parameter: @@ -127,23 +108,29 @@ async def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter request = build_put_required_binary_body_request( content_type=content_type, content=_content, - template_url=self.put_required_binary_body.metadata["url"], + template_url=self.put_required_binary_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -154,10 +141,15 @@ async def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) - put_required_binary_body.metadata = {"url": "/reqopt/explicit/required/binary-body"} # type: ignore + put_required_binary_body.metadata = {'url': '/reqopt/explicit/required/binary-body'} # type: ignore + @distributed_trace_async - async def post_required_integer_parameter(self, body_parameter: int, **kwargs: Any) -> None: + async def post_required_integer_parameter( + self, + body_parameter: int, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put null and the client library should throw before the request is sent. @@ -168,23 +160,29 @@ async def post_required_integer_parameter(self, body_parameter: int, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "int") + _json = self._serialize.body(body_parameter, 'int') request = build_post_required_integer_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_integer_parameter.metadata["url"], + template_url=self.post_required_integer_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,10 +193,15 @@ async def post_required_integer_parameter(self, body_parameter: int, **kwargs: A if cls: return cls(pipeline_response, None, {}) - post_required_integer_parameter.metadata = {"url": "/reqopt/requied/integer/parameter"} # type: ignore + post_required_integer_parameter.metadata = {'url': '/reqopt/requied/integer/parameter'} # type: ignore + @distributed_trace_async - async def post_optional_integer_parameter(self, body_parameter: Optional[int] = None, **kwargs: Any) -> None: + async def post_optional_integer_parameter( + self, + body_parameter: Optional[int] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put null. :param body_parameter: @@ -208,26 +211,32 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "int") + _json = self._serialize.body(body_parameter, 'int') else: _json = None request = build_post_optional_integer_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_integer_parameter.metadata["url"], + template_url=self.post_optional_integer_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -238,10 +247,15 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = if cls: return cls(pipeline_response, None, {}) - post_optional_integer_parameter.metadata = {"url": "/reqopt/optional/integer/parameter"} # type: ignore + post_optional_integer_parameter.metadata = {'url': '/reqopt/optional/integer/parameter'} # type: ignore + @distributed_trace_async - async def post_required_integer_property(self, value: int, **kwargs: Any) -> None: + async def post_required_integer_property( + self, + value: int, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -252,24 +266,30 @@ async def post_required_integer_property(self, value: int, **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.IntWrapper(value=value) - _json = self._serialize.body(_body_parameter, "IntWrapper") + _json = self._serialize.body(_body_parameter, 'IntWrapper') request = build_post_required_integer_property_request( content_type=content_type, json=_json, - template_url=self.post_required_integer_property.metadata["url"], + template_url=self.post_required_integer_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,10 +300,15 @@ async def post_required_integer_property(self, value: int, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - post_required_integer_property.metadata = {"url": "/reqopt/requied/integer/property"} # type: ignore + post_required_integer_property.metadata = {'url': '/reqopt/requied/integer/property'} # type: ignore + @distributed_trace_async - async def post_optional_integer_property(self, value: Optional[int] = None, **kwargs: Any) -> None: + async def post_optional_integer_property( + self, + value: Optional[int] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. :param value: @@ -293,27 +318,33 @@ async def post_optional_integer_property(self, value: Optional[int] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.IntOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "IntOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'IntOptionalWrapper') else: _json = None request = build_post_optional_integer_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_integer_property.metadata["url"], + template_url=self.post_optional_integer_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -324,10 +355,15 @@ async def post_optional_integer_property(self, value: Optional[int] = None, **kw if cls: return cls(pipeline_response, None, {}) - post_optional_integer_property.metadata = {"url": "/reqopt/optional/integer/property"} # type: ignore + post_optional_integer_property.metadata = {'url': '/reqopt/optional/integer/property'} # type: ignore + @distributed_trace_async - async def post_required_integer_header(self, header_parameter: int, **kwargs: Any) -> None: + async def post_required_integer_header( + self, + header_parameter: int, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -338,18 +374,25 @@ async def post_required_integer_header(self, header_parameter: int, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_required_integer_header_request( header_parameter=header_parameter, - template_url=self.post_required_integer_header.metadata["url"], + template_url=self.post_required_integer_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -360,10 +403,15 @@ async def post_required_integer_header(self, header_parameter: int, **kwargs: An if cls: return cls(pipeline_response, None, {}) - post_required_integer_header.metadata = {"url": "/reqopt/requied/integer/header"} # type: ignore + post_required_integer_header.metadata = {'url': '/reqopt/requied/integer/header'} # type: ignore + @distributed_trace_async - async def post_optional_integer_header(self, header_parameter: Optional[int] = None, **kwargs: Any) -> None: + async def post_optional_integer_header( + self, + header_parameter: Optional[int] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a header 'headerParameter' => null. :param header_parameter: @@ -373,18 +421,25 @@ async def post_optional_integer_header(self, header_parameter: Optional[int] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_optional_integer_header_request( header_parameter=header_parameter, - template_url=self.post_optional_integer_header.metadata["url"], + template_url=self.post_optional_integer_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -395,10 +450,15 @@ async def post_optional_integer_header(self, header_parameter: Optional[int] = N if cls: return cls(pipeline_response, None, {}) - post_optional_integer_header.metadata = {"url": "/reqopt/optional/integer/header"} # type: ignore + post_optional_integer_header.metadata = {'url': '/reqopt/optional/integer/header'} # type: ignore + @distributed_trace_async - async def post_required_string_parameter(self, body_parameter: str, **kwargs: Any) -> None: + async def post_required_string_parameter( + self, + body_parameter: str, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put null and the client library should throw before the request is sent. @@ -409,23 +469,29 @@ async def post_required_string_parameter(self, body_parameter: str, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "str") + _json = self._serialize.body(body_parameter, 'str') request = build_post_required_string_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_string_parameter.metadata["url"], + template_url=self.post_required_string_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -436,10 +502,15 @@ async def post_required_string_parameter(self, body_parameter: str, **kwargs: An if cls: return cls(pipeline_response, None, {}) - post_required_string_parameter.metadata = {"url": "/reqopt/requied/string/parameter"} # type: ignore + post_required_string_parameter.metadata = {'url': '/reqopt/requied/string/parameter'} # type: ignore + @distributed_trace_async - async def post_optional_string_parameter(self, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def post_optional_string_parameter( + self, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test explicitly optional string. Please put null. :param body_parameter: @@ -449,26 +520,32 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "str") + _json = self._serialize.body(body_parameter, 'str') else: _json = None request = build_post_optional_string_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_string_parameter.metadata["url"], + template_url=self.post_optional_string_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -479,10 +556,15 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N if cls: return cls(pipeline_response, None, {}) - post_optional_string_parameter.metadata = {"url": "/reqopt/optional/string/parameter"} # type: ignore + post_optional_string_parameter.metadata = {'url': '/reqopt/optional/string/parameter'} # type: ignore + @distributed_trace_async - async def post_required_string_property(self, value: str, **kwargs: Any) -> None: + async def post_required_string_property( + self, + value: str, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -493,24 +575,30 @@ async def post_required_string_property(self, value: str, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.StringWrapper(value=value) - _json = self._serialize.body(_body_parameter, "StringWrapper") + _json = self._serialize.body(_body_parameter, 'StringWrapper') request = build_post_required_string_property_request( content_type=content_type, json=_json, - template_url=self.post_required_string_property.metadata["url"], + template_url=self.post_required_string_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -521,10 +609,15 @@ async def post_required_string_property(self, value: str, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) - post_required_string_property.metadata = {"url": "/reqopt/requied/string/property"} # type: ignore + post_required_string_property.metadata = {'url': '/reqopt/requied/string/property'} # type: ignore + @distributed_trace_async - async def post_optional_string_property(self, value: Optional[str] = None, **kwargs: Any) -> None: + async def post_optional_string_property( + self, + value: Optional[str] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. :param value: @@ -534,27 +627,33 @@ async def post_optional_string_property(self, value: Optional[str] = None, **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.StringOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "StringOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'StringOptionalWrapper') else: _json = None request = build_post_optional_string_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_string_property.metadata["url"], + template_url=self.post_optional_string_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -565,10 +664,15 @@ async def post_optional_string_property(self, value: Optional[str] = None, **kwa if cls: return cls(pipeline_response, None, {}) - post_optional_string_property.metadata = {"url": "/reqopt/optional/string/property"} # type: ignore + post_optional_string_property.metadata = {'url': '/reqopt/optional/string/property'} # type: ignore + @distributed_trace_async - async def post_required_string_header(self, header_parameter: str, **kwargs: Any) -> None: + async def post_required_string_header( + self, + header_parameter: str, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -579,18 +683,25 @@ async def post_required_string_header(self, header_parameter: str, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_required_string_header_request( header_parameter=header_parameter, - template_url=self.post_required_string_header.metadata["url"], + template_url=self.post_required_string_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,10 +712,15 @@ async def post_required_string_header(self, header_parameter: str, **kwargs: Any if cls: return cls(pipeline_response, None, {}) - post_required_string_header.metadata = {"url": "/reqopt/requied/string/header"} # type: ignore + post_required_string_header.metadata = {'url': '/reqopt/requied/string/header'} # type: ignore + @distributed_trace_async - async def post_optional_string_header(self, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def post_optional_string_header( + self, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test explicitly optional string. Please put a header 'headerParameter' => null. :param body_parameter: @@ -614,18 +730,25 @@ async def post_optional_string_header(self, body_parameter: Optional[str] = None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_optional_string_header_request( body_parameter=body_parameter, - template_url=self.post_optional_string_header.metadata["url"], + template_url=self.post_optional_string_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -636,10 +759,15 @@ async def post_optional_string_header(self, body_parameter: Optional[str] = None if cls: return cls(pipeline_response, None, {}) - post_optional_string_header.metadata = {"url": "/reqopt/optional/string/header"} # type: ignore + post_optional_string_header.metadata = {'url': '/reqopt/optional/string/header'} # type: ignore + @distributed_trace_async - async def post_required_class_parameter(self, body_parameter: "_models.Product", **kwargs: Any) -> None: + async def post_required_class_parameter( + self, + body_parameter: "_models.Product", + **kwargs: Any + ) -> None: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -650,23 +778,29 @@ async def post_required_class_parameter(self, body_parameter: "_models.Product", :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "Product") + _json = self._serialize.body(body_parameter, 'Product') request = build_post_required_class_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_class_parameter.metadata["url"], + template_url=self.post_required_class_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -677,11 +811,14 @@ async def post_required_class_parameter(self, body_parameter: "_models.Product", if cls: return cls(pipeline_response, None, {}) - post_required_class_parameter.metadata = {"url": "/reqopt/requied/class/parameter"} # type: ignore + post_required_class_parameter.metadata = {'url': '/reqopt/requied/class/parameter'} # type: ignore + @distributed_trace_async async def post_optional_class_parameter( - self, body_parameter: Optional["_models.Product"] = None, **kwargs: Any + self, + body_parameter: Optional["_models.Product"] = None, + **kwargs: Any ) -> None: """Test explicitly optional complex object. Please put null. @@ -692,26 +829,32 @@ async def post_optional_class_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "Product") + _json = self._serialize.body(body_parameter, 'Product') else: _json = None request = build_post_optional_class_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_class_parameter.metadata["url"], + template_url=self.post_optional_class_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -722,10 +865,15 @@ async def post_optional_class_parameter( if cls: return cls(pipeline_response, None, {}) - post_optional_class_parameter.metadata = {"url": "/reqopt/optional/class/parameter"} # type: ignore + post_optional_class_parameter.metadata = {'url': '/reqopt/optional/class/parameter'} # type: ignore + @distributed_trace_async - async def post_required_class_property(self, value: "_models.Product", **kwargs: Any) -> None: + async def post_required_class_property( + self, + value: "_models.Product", + **kwargs: Any + ) -> None: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -736,24 +884,30 @@ async def post_required_class_property(self, value: "_models.Product", **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ClassWrapper(value=value) - _json = self._serialize.body(_body_parameter, "ClassWrapper") + _json = self._serialize.body(_body_parameter, 'ClassWrapper') request = build_post_required_class_property_request( content_type=content_type, json=_json, - template_url=self.post_required_class_property.metadata["url"], + template_url=self.post_required_class_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -764,10 +918,15 @@ async def post_required_class_property(self, value: "_models.Product", **kwargs: if cls: return cls(pipeline_response, None, {}) - post_required_class_property.metadata = {"url": "/reqopt/requied/class/property"} # type: ignore + post_required_class_property.metadata = {'url': '/reqopt/requied/class/property'} # type: ignore + @distributed_trace_async - async def post_optional_class_property(self, value: Optional["_models.Product"] = None, **kwargs: Any) -> None: + async def post_optional_class_property( + self, + value: Optional["_models.Product"] = None, + **kwargs: Any + ) -> None: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. :param value: @@ -777,27 +936,33 @@ async def post_optional_class_property(self, value: Optional["_models.Product"] :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ClassOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "ClassOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'ClassOptionalWrapper') else: _json = None request = build_post_optional_class_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_class_property.metadata["url"], + template_url=self.post_optional_class_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -808,10 +973,15 @@ async def post_optional_class_property(self, value: Optional["_models.Product"] if cls: return cls(pipeline_response, None, {}) - post_optional_class_property.metadata = {"url": "/reqopt/optional/class/property"} # type: ignore + post_optional_class_property.metadata = {'url': '/reqopt/optional/class/property'} # type: ignore + @distributed_trace_async - async def post_required_array_parameter(self, body_parameter: List[str], **kwargs: Any) -> None: + async def post_required_array_parameter( + self, + body_parameter: List[str], + **kwargs: Any + ) -> None: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -822,23 +992,29 @@ async def post_required_array_parameter(self, body_parameter: List[str], **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "[str]") + _json = self._serialize.body(body_parameter, '[str]') request = build_post_required_array_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_array_parameter.metadata["url"], + template_url=self.post_required_array_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -849,10 +1025,15 @@ async def post_required_array_parameter(self, body_parameter: List[str], **kwarg if cls: return cls(pipeline_response, None, {}) - post_required_array_parameter.metadata = {"url": "/reqopt/requied/array/parameter"} # type: ignore + post_required_array_parameter.metadata = {'url': '/reqopt/requied/array/parameter'} # type: ignore + @distributed_trace_async - async def post_optional_array_parameter(self, body_parameter: Optional[List[str]] = None, **kwargs: Any) -> None: + async def post_optional_array_parameter( + self, + body_parameter: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Test explicitly optional array. Please put null. :param body_parameter: @@ -862,26 +1043,32 @@ async def post_optional_array_parameter(self, body_parameter: Optional[List[str] :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "[str]") + _json = self._serialize.body(body_parameter, '[str]') else: _json = None request = build_post_optional_array_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_array_parameter.metadata["url"], + template_url=self.post_optional_array_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -892,10 +1079,15 @@ async def post_optional_array_parameter(self, body_parameter: Optional[List[str] if cls: return cls(pipeline_response, None, {}) - post_optional_array_parameter.metadata = {"url": "/reqopt/optional/array/parameter"} # type: ignore + post_optional_array_parameter.metadata = {'url': '/reqopt/optional/array/parameter'} # type: ignore + @distributed_trace_async - async def post_required_array_property(self, value: List[str], **kwargs: Any) -> None: + async def post_required_array_property( + self, + value: List[str], + **kwargs: Any + ) -> None: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -906,24 +1098,30 @@ async def post_required_array_property(self, value: List[str], **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ArrayWrapper(value=value) - _json = self._serialize.body(_body_parameter, "ArrayWrapper") + _json = self._serialize.body(_body_parameter, 'ArrayWrapper') request = build_post_required_array_property_request( content_type=content_type, json=_json, - template_url=self.post_required_array_property.metadata["url"], + template_url=self.post_required_array_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -934,10 +1132,15 @@ async def post_required_array_property(self, value: List[str], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - post_required_array_property.metadata = {"url": "/reqopt/requied/array/property"} # type: ignore + post_required_array_property.metadata = {'url': '/reqopt/requied/array/property'} # type: ignore + @distributed_trace_async - async def post_optional_array_property(self, value: Optional[List[str]] = None, **kwargs: Any) -> None: + async def post_optional_array_property( + self, + value: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. :param value: @@ -947,27 +1150,33 @@ async def post_optional_array_property(self, value: Optional[List[str]] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ArrayOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "ArrayOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'ArrayOptionalWrapper') else: _json = None request = build_post_optional_array_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_array_property.metadata["url"], + template_url=self.post_optional_array_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -978,10 +1187,15 @@ async def post_optional_array_property(self, value: Optional[List[str]] = None, if cls: return cls(pipeline_response, None, {}) - post_optional_array_property.metadata = {"url": "/reqopt/optional/array/property"} # type: ignore + post_optional_array_property.metadata = {'url': '/reqopt/optional/array/property'} # type: ignore + @distributed_trace_async - async def post_required_array_header(self, header_parameter: List[str], **kwargs: Any) -> None: + async def post_required_array_header( + self, + header_parameter: List[str], + **kwargs: Any + ) -> None: """Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -992,18 +1206,25 @@ async def post_required_array_header(self, header_parameter: List[str], **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_required_array_header_request( header_parameter=header_parameter, - template_url=self.post_required_array_header.metadata["url"], + template_url=self.post_required_array_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1014,10 +1235,15 @@ async def post_required_array_header(self, header_parameter: List[str], **kwargs if cls: return cls(pipeline_response, None, {}) - post_required_array_header.metadata = {"url": "/reqopt/requied/array/header"} # type: ignore + post_required_array_header.metadata = {'url': '/reqopt/requied/array/header'} # type: ignore + @distributed_trace_async - async def post_optional_array_header(self, header_parameter: Optional[List[str]] = None, **kwargs: Any) -> None: + async def post_optional_array_header( + self, + header_parameter: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a header 'headerParameter' => null. :param header_parameter: @@ -1027,18 +1253,25 @@ async def post_optional_array_header(self, header_parameter: Optional[List[str]] :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_optional_array_header_request( header_parameter=header_parameter, - template_url=self.post_optional_array_header.metadata["url"], + template_url=self.post_optional_array_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1049,4 +1282,5 @@ async def post_optional_array_header(self, header_parameter: Optional[List[str]] if cls: return cls(pipeline_response, None, {}) - post_optional_array_header.metadata = {"url": "/reqopt/optional/array/header"} # type: ignore + post_optional_array_header.metadata = {'url': '/reqopt/optional/array/header'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py index a8ba5b6fc59..4b5a9037cc5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, IO, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,21 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._implicit_operations import ( - build_get_optional_global_query_request, - build_get_required_global_path_request, - build_get_required_global_query_request, - build_get_required_path_request, - build_put_optional_binary_body_request, - build_put_optional_body_request, - build_put_optional_header_request, - build_put_optional_query_request, -) - -T = TypeVar("T") +from ...operations._implicit_operations import build_get_optional_global_query_request, build_get_required_global_path_request, build_get_required_global_query_request, build_get_required_path_request, build_put_optional_binary_body_request, build_put_optional_body_request, build_put_optional_header_request, build_put_optional_query_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ImplicitOperations: """ImplicitOperations async operations. @@ -61,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: + async def get_required_path( + self, + path_parameter: str, + **kwargs: Any + ) -> None: """Test implicitly required path parameter. :param path_parameter: @@ -71,18 +57,25 @@ async def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_required_path_request( path_parameter=path_parameter, - template_url=self.get_required_path.metadata["url"], + template_url=self.get_required_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,10 +86,15 @@ async def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_required_path.metadata = {"url": "/reqopt/implicit/required/path/{pathParameter}"} # type: ignore + get_required_path.metadata = {'url': '/reqopt/implicit/required/path/{pathParameter}'} # type: ignore + @distributed_trace_async - async def put_optional_query(self, query_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def put_optional_query( + self, + query_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional query parameter. :param query_parameter: @@ -106,18 +104,25 @@ async def put_optional_query(self, query_parameter: Optional[str] = None, **kwar :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_optional_query_request( query_parameter=query_parameter, - template_url=self.put_optional_query.metadata["url"], + template_url=self.put_optional_query.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,10 +133,15 @@ async def put_optional_query(self, query_parameter: Optional[str] = None, **kwar if cls: return cls(pipeline_response, None, {}) - put_optional_query.metadata = {"url": "/reqopt/implicit/optional/query"} # type: ignore + put_optional_query.metadata = {'url': '/reqopt/implicit/optional/query'} # type: ignore + @distributed_trace_async - async def put_optional_header(self, query_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def put_optional_header( + self, + query_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional header parameter. :param query_parameter: @@ -141,18 +151,25 @@ async def put_optional_header(self, query_parameter: Optional[str] = None, **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_optional_header_request( query_parameter=query_parameter, - template_url=self.put_optional_header.metadata["url"], + template_url=self.put_optional_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,10 +180,15 @@ async def put_optional_header(self, query_parameter: Optional[str] = None, **kwa if cls: return cls(pipeline_response, None, {}) - put_optional_header.metadata = {"url": "/reqopt/implicit/optional/header"} # type: ignore + put_optional_header.metadata = {'url': '/reqopt/implicit/optional/header'} # type: ignore + @distributed_trace_async - async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def put_optional_body( + self, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional body parameter. :param body_parameter: @@ -176,26 +198,32 @@ async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "str") + _json = self._serialize.body(body_parameter, 'str') else: _json = None request = build_put_optional_body_request( content_type=content_type, json=_json, - template_url=self.put_optional_body.metadata["url"], + template_url=self.put_optional_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -206,10 +234,15 @@ async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs if cls: return cls(pipeline_response, None, {}) - put_optional_body.metadata = {"url": "/reqopt/implicit/optional/body"} # type: ignore + put_optional_body.metadata = {'url': '/reqopt/implicit/optional/body'} # type: ignore + @distributed_trace_async - async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs: Any) -> None: + async def put_optional_binary_body( + self, + body_parameter: Optional[IO] = None, + **kwargs: Any + ) -> None: """Test implicitly optional body parameter. :param body_parameter: @@ -219,23 +252,29 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter request = build_put_optional_binary_body_request( content_type=content_type, content=_content, - template_url=self.put_optional_binary_body.metadata["url"], + template_url=self.put_optional_binary_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -246,10 +285,14 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** if cls: return cls(pipeline_response, None, {}) - put_optional_binary_body.metadata = {"url": "/reqopt/implicit/optional/binary-body"} # type: ignore + put_optional_binary_body.metadata = {'url': '/reqopt/implicit/optional/binary-body'} # type: ignore + @distributed_trace_async - async def get_required_global_path(self, **kwargs: Any) -> None: + async def get_required_global_path( + self, + **kwargs: Any + ) -> None: """Test implicitly required path parameter. :keyword callable cls: A custom type or function that will be passed the direct response @@ -257,18 +300,25 @@ async def get_required_global_path(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_required_global_path_request( required_global_path=self._config.required_global_path, - template_url=self.get_required_global_path.metadata["url"], + template_url=self.get_required_global_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -279,10 +329,14 @@ async def get_required_global_path(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_required_global_path.metadata = {"url": "/reqopt/global/required/path/{required-global-path}"} # type: ignore + get_required_global_path.metadata = {'url': '/reqopt/global/required/path/{required-global-path}'} # type: ignore + @distributed_trace_async - async def get_required_global_query(self, **kwargs: Any) -> None: + async def get_required_global_query( + self, + **kwargs: Any + ) -> None: """Test implicitly required query parameter. :keyword callable cls: A custom type or function that will be passed the direct response @@ -290,18 +344,25 @@ async def get_required_global_query(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_required_global_query_request( required_global_query=self._config.required_global_query, - template_url=self.get_required_global_query.metadata["url"], + template_url=self.get_required_global_query.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -312,10 +373,14 @@ async def get_required_global_query(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_required_global_query.metadata = {"url": "/reqopt/global/required/query"} # type: ignore + get_required_global_query.metadata = {'url': '/reqopt/global/required/query'} # type: ignore + @distributed_trace_async - async def get_optional_global_query(self, **kwargs: Any) -> None: + async def get_optional_global_query( + self, + **kwargs: Any + ) -> None: """Test implicitly optional query parameter. :keyword callable cls: A custom type or function that will be passed the direct response @@ -323,18 +388,25 @@ async def get_optional_global_query(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_optional_global_query_request( optional_global_query=self._config.optional_global_query, - template_url=self.get_optional_global_query.metadata["url"], + template_url=self.get_optional_global_query.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -345,4 +417,5 @@ async def get_optional_global_query(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_optional_global_query.metadata = {"url": "/reqopt/global/optional/query"} # type: ignore + get_optional_global_query.metadata = {'url': '/reqopt/global/optional/query'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py index 98211135771..a668c29015a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py @@ -30,14 +30,14 @@ from ._models import StringWrapper # type: ignore __all__ = [ - "ArrayOptionalWrapper", - "ArrayWrapper", - "ClassOptionalWrapper", - "ClassWrapper", - "Error", - "IntOptionalWrapper", - "IntWrapper", - "Product", - "StringOptionalWrapper", - "StringWrapper", + 'ArrayOptionalWrapper', + 'ArrayWrapper', + 'ClassOptionalWrapper', + 'ClassWrapper', + 'Error', + 'IntOptionalWrapper', + 'IntWrapper', + 'Product', + 'StringOptionalWrapper', + 'StringWrapper', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models.py index f30d67081fe..5dd68026d92 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models.py @@ -18,16 +18,19 @@ class ArrayOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[str]"}, + 'value': {'key': 'value', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: :paramtype value: list[str] """ super(ArrayOptionalWrapper, self).__init__(**kwargs) - self.value = kwargs.get("value", None) + self.value = kwargs.get('value', None) class ArrayWrapper(msrest.serialization.Model): @@ -40,20 +43,23 @@ class ArrayWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "[str]"}, + 'value': {'key': 'value', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: Required. :paramtype value: list[str] """ super(ArrayWrapper, self).__init__(**kwargs) - self.value = kwargs["value"] + self.value = kwargs['value'] class ClassOptionalWrapper(msrest.serialization.Model): @@ -64,16 +70,19 @@ class ClassOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "Product"}, + 'value': {'key': 'value', 'type': 'Product'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: :paramtype value: ~requiredoptional.models.Product """ super(ClassOptionalWrapper, self).__init__(**kwargs) - self.value = kwargs.get("value", None) + self.value = kwargs.get('value', None) class ClassWrapper(msrest.serialization.Model): @@ -86,20 +95,23 @@ class ClassWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "Product"}, + 'value': {'key': 'value', 'type': 'Product'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: Required. :paramtype value: ~requiredoptional.models.Product """ super(ClassWrapper, self).__init__(**kwargs) - self.value = kwargs["value"] + self.value = kwargs['value'] class Error(msrest.serialization.Model): @@ -112,11 +124,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -124,8 +139,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class IntOptionalWrapper(msrest.serialization.Model): @@ -136,16 +151,19 @@ class IntOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "int"}, + 'value': {'key': 'value', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: :paramtype value: int """ super(IntOptionalWrapper, self).__init__(**kwargs) - self.value = kwargs.get("value", None) + self.value = kwargs.get('value', None) class IntWrapper(msrest.serialization.Model): @@ -158,20 +176,23 @@ class IntWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "int"}, + 'value': {'key': 'value', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: Required. :paramtype value: int """ super(IntWrapper, self).__init__(**kwargs) - self.value = kwargs["value"] + self.value = kwargs['value'] class Product(msrest.serialization.Model): @@ -186,15 +207,18 @@ class Product(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, + 'id': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: Required. :paramtype id: int @@ -202,8 +226,8 @@ def __init__(self, **kwargs): :paramtype name: str """ super(Product, self).__init__(**kwargs) - self.id = kwargs["id"] - self.name = kwargs.get("name", None) + self.id = kwargs['id'] + self.name = kwargs.get('name', None) class StringOptionalWrapper(msrest.serialization.Model): @@ -214,16 +238,19 @@ class StringOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: :paramtype value: str """ super(StringOptionalWrapper, self).__init__(**kwargs) - self.value = kwargs.get("value", None) + self.value = kwargs.get('value', None) class StringWrapper(msrest.serialization.Model): @@ -236,17 +263,20 @@ class StringWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword value: Required. :paramtype value: str """ super(StringWrapper, self).__init__(**kwargs) - self.value = kwargs["value"] + self.value = kwargs['value'] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models_py3.py index e3abe9ae705..386a07bdeaa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_models_py3.py @@ -20,10 +20,15 @@ class ArrayOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "[str]"}, + 'value': {'key': 'value', 'type': '[str]'}, } - def __init__(self, *, value: Optional[List[str]] = None, **kwargs): + def __init__( + self, + *, + value: Optional[List[str]] = None, + **kwargs + ): """ :keyword value: :paramtype value: list[str] @@ -42,14 +47,19 @@ class ArrayWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "[str]"}, + 'value': {'key': 'value', 'type': '[str]'}, } - def __init__(self, *, value: List[str], **kwargs): + def __init__( + self, + *, + value: List[str], + **kwargs + ): """ :keyword value: Required. :paramtype value: list[str] @@ -66,10 +76,15 @@ class ClassOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "Product"}, + 'value': {'key': 'value', 'type': 'Product'}, } - def __init__(self, *, value: Optional["Product"] = None, **kwargs): + def __init__( + self, + *, + value: Optional["Product"] = None, + **kwargs + ): """ :keyword value: :paramtype value: ~requiredoptional.models.Product @@ -88,14 +103,19 @@ class ClassWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "Product"}, + 'value': {'key': 'value', 'type': 'Product'}, } - def __init__(self, *, value: "Product", **kwargs): + def __init__( + self, + *, + value: "Product", + **kwargs + ): """ :keyword value: Required. :paramtype value: ~requiredoptional.models.Product @@ -114,11 +134,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -138,10 +164,15 @@ class IntOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "int"}, + 'value': {'key': 'value', 'type': 'int'}, } - def __init__(self, *, value: Optional[int] = None, **kwargs): + def __init__( + self, + *, + value: Optional[int] = None, + **kwargs + ): """ :keyword value: :paramtype value: int @@ -160,14 +191,19 @@ class IntWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "int"}, + 'value': {'key': 'value', 'type': 'int'}, } - def __init__(self, *, value: int, **kwargs): + def __init__( + self, + *, + value: int, + **kwargs + ): """ :keyword value: Required. :paramtype value: int @@ -188,15 +224,21 @@ class Product(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, + 'id': {'required': True}, } _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, id: int, name: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: int, + name: Optional[str] = None, + **kwargs + ): """ :keyword id: Required. :paramtype id: int @@ -216,10 +258,15 @@ class StringOptionalWrapper(msrest.serialization.Model): """ _attribute_map = { - "value": {"key": "value", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, value: Optional[str] = None, **kwargs): + def __init__( + self, + *, + value: Optional[str] = None, + **kwargs + ): """ :keyword value: :paramtype value: str @@ -238,14 +285,19 @@ class StringWrapper(msrest.serialization.Model): """ _validation = { - "value": {"required": True}, + 'value': {'required': True}, } _attribute_map = { - "value": {"key": "value", "type": "str"}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, value: str, **kwargs): + def __init__( + self, + *, + value: str, + **kwargs + ): """ :keyword value: Required. :paramtype value: str diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/__init__.py index 8bf716be8df..d145a1fba4e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/__init__.py @@ -10,6 +10,6 @@ from ._explicit_operations import ExplicitOperations __all__ = [ - "ImplicitOperations", - "ExplicitOperations", + 'ImplicitOperations', + 'ExplicitOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py index e5eb120db25..8941f47a261 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, IO, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -608,7 +600,7 @@ def build_post_optional_array_header_request( ) # fmt: on -class ExplicitOperations(object): +class ExplicitOperations(object): # pylint: disable=too-many-public-methods """ExplicitOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -646,23 +638,29 @@ def put_optional_binary_body( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter request = build_put_optional_binary_body_request( content_type=content_type, content=_content, - template_url=self.put_optional_binary_body.metadata["url"], + template_url=self.put_optional_binary_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -673,7 +671,8 @@ def put_optional_binary_body( if cls: return cls(pipeline_response, None, {}) - put_optional_binary_body.metadata = {"url": "/reqopt/explicit/optional/binary-body"} # type: ignore + put_optional_binary_body.metadata = {'url': '/reqopt/explicit/optional/binary-body'} # type: ignore + @distributed_trace def put_required_binary_body( @@ -691,23 +690,29 @@ def put_required_binary_body( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter request = build_put_required_binary_body_request( content_type=content_type, content=_content, - template_url=self.put_required_binary_body.metadata["url"], + template_url=self.put_required_binary_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -718,7 +723,8 @@ def put_required_binary_body( if cls: return cls(pipeline_response, None, {}) - put_required_binary_body.metadata = {"url": "/reqopt/explicit/required/binary-body"} # type: ignore + put_required_binary_body.metadata = {'url': '/reqopt/explicit/required/binary-body'} # type: ignore + @distributed_trace def post_required_integer_parameter( @@ -737,23 +743,29 @@ def post_required_integer_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "int") + _json = self._serialize.body(body_parameter, 'int') request = build_post_required_integer_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_integer_parameter.metadata["url"], + template_url=self.post_required_integer_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -764,7 +776,8 @@ def post_required_integer_parameter( if cls: return cls(pipeline_response, None, {}) - post_required_integer_parameter.metadata = {"url": "/reqopt/requied/integer/parameter"} # type: ignore + post_required_integer_parameter.metadata = {'url': '/reqopt/requied/integer/parameter'} # type: ignore + @distributed_trace def post_optional_integer_parameter( @@ -782,26 +795,32 @@ def post_optional_integer_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "int") + _json = self._serialize.body(body_parameter, 'int') else: _json = None request = build_post_optional_integer_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_integer_parameter.metadata["url"], + template_url=self.post_optional_integer_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -812,7 +831,8 @@ def post_optional_integer_parameter( if cls: return cls(pipeline_response, None, {}) - post_optional_integer_parameter.metadata = {"url": "/reqopt/optional/integer/parameter"} # type: ignore + post_optional_integer_parameter.metadata = {'url': '/reqopt/optional/integer/parameter'} # type: ignore + @distributed_trace def post_required_integer_property( @@ -831,24 +851,30 @@ def post_required_integer_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.IntWrapper(value=value) - _json = self._serialize.body(_body_parameter, "IntWrapper") + _json = self._serialize.body(_body_parameter, 'IntWrapper') request = build_post_required_integer_property_request( content_type=content_type, json=_json, - template_url=self.post_required_integer_property.metadata["url"], + template_url=self.post_required_integer_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -859,7 +885,8 @@ def post_required_integer_property( if cls: return cls(pipeline_response, None, {}) - post_required_integer_property.metadata = {"url": "/reqopt/requied/integer/property"} # type: ignore + post_required_integer_property.metadata = {'url': '/reqopt/requied/integer/property'} # type: ignore + @distributed_trace def post_optional_integer_property( @@ -877,27 +904,33 @@ def post_optional_integer_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.IntOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "IntOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'IntOptionalWrapper') else: _json = None request = build_post_optional_integer_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_integer_property.metadata["url"], + template_url=self.post_optional_integer_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -908,7 +941,8 @@ def post_optional_integer_property( if cls: return cls(pipeline_response, None, {}) - post_optional_integer_property.metadata = {"url": "/reqopt/optional/integer/property"} # type: ignore + post_optional_integer_property.metadata = {'url': '/reqopt/optional/integer/property'} # type: ignore + @distributed_trace def post_required_integer_header( @@ -927,18 +961,25 @@ def post_required_integer_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_required_integer_header_request( header_parameter=header_parameter, - template_url=self.post_required_integer_header.metadata["url"], + template_url=self.post_required_integer_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -949,7 +990,8 @@ def post_required_integer_header( if cls: return cls(pipeline_response, None, {}) - post_required_integer_header.metadata = {"url": "/reqopt/requied/integer/header"} # type: ignore + post_required_integer_header.metadata = {'url': '/reqopt/requied/integer/header'} # type: ignore + @distributed_trace def post_optional_integer_header( @@ -967,18 +1009,25 @@ def post_optional_integer_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_optional_integer_header_request( header_parameter=header_parameter, - template_url=self.post_optional_integer_header.metadata["url"], + template_url=self.post_optional_integer_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -989,7 +1038,8 @@ def post_optional_integer_header( if cls: return cls(pipeline_response, None, {}) - post_optional_integer_header.metadata = {"url": "/reqopt/optional/integer/header"} # type: ignore + post_optional_integer_header.metadata = {'url': '/reqopt/optional/integer/header'} # type: ignore + @distributed_trace def post_required_string_parameter( @@ -1008,23 +1058,29 @@ def post_required_string_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "str") + _json = self._serialize.body(body_parameter, 'str') request = build_post_required_string_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_string_parameter.metadata["url"], + template_url=self.post_required_string_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1035,7 +1091,8 @@ def post_required_string_parameter( if cls: return cls(pipeline_response, None, {}) - post_required_string_parameter.metadata = {"url": "/reqopt/requied/string/parameter"} # type: ignore + post_required_string_parameter.metadata = {'url': '/reqopt/requied/string/parameter'} # type: ignore + @distributed_trace def post_optional_string_parameter( @@ -1053,26 +1110,32 @@ def post_optional_string_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "str") + _json = self._serialize.body(body_parameter, 'str') else: _json = None request = build_post_optional_string_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_string_parameter.metadata["url"], + template_url=self.post_optional_string_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1083,7 +1146,8 @@ def post_optional_string_parameter( if cls: return cls(pipeline_response, None, {}) - post_optional_string_parameter.metadata = {"url": "/reqopt/optional/string/parameter"} # type: ignore + post_optional_string_parameter.metadata = {'url': '/reqopt/optional/string/parameter'} # type: ignore + @distributed_trace def post_required_string_property( @@ -1102,24 +1166,30 @@ def post_required_string_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.StringWrapper(value=value) - _json = self._serialize.body(_body_parameter, "StringWrapper") + _json = self._serialize.body(_body_parameter, 'StringWrapper') request = build_post_required_string_property_request( content_type=content_type, json=_json, - template_url=self.post_required_string_property.metadata["url"], + template_url=self.post_required_string_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1130,7 +1200,8 @@ def post_required_string_property( if cls: return cls(pipeline_response, None, {}) - post_required_string_property.metadata = {"url": "/reqopt/requied/string/property"} # type: ignore + post_required_string_property.metadata = {'url': '/reqopt/requied/string/property'} # type: ignore + @distributed_trace def post_optional_string_property( @@ -1148,27 +1219,33 @@ def post_optional_string_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.StringOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "StringOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'StringOptionalWrapper') else: _json = None request = build_post_optional_string_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_string_property.metadata["url"], + template_url=self.post_optional_string_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1179,7 +1256,8 @@ def post_optional_string_property( if cls: return cls(pipeline_response, None, {}) - post_optional_string_property.metadata = {"url": "/reqopt/optional/string/property"} # type: ignore + post_optional_string_property.metadata = {'url': '/reqopt/optional/string/property'} # type: ignore + @distributed_trace def post_required_string_header( @@ -1198,18 +1276,25 @@ def post_required_string_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_required_string_header_request( header_parameter=header_parameter, - template_url=self.post_required_string_header.metadata["url"], + template_url=self.post_required_string_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1220,7 +1305,8 @@ def post_required_string_header( if cls: return cls(pipeline_response, None, {}) - post_required_string_header.metadata = {"url": "/reqopt/requied/string/header"} # type: ignore + post_required_string_header.metadata = {'url': '/reqopt/requied/string/header'} # type: ignore + @distributed_trace def post_optional_string_header( @@ -1238,18 +1324,25 @@ def post_optional_string_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_optional_string_header_request( body_parameter=body_parameter, - template_url=self.post_optional_string_header.metadata["url"], + template_url=self.post_optional_string_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1260,7 +1353,8 @@ def post_optional_string_header( if cls: return cls(pipeline_response, None, {}) - post_optional_string_header.metadata = {"url": "/reqopt/optional/string/header"} # type: ignore + post_optional_string_header.metadata = {'url': '/reqopt/optional/string/header'} # type: ignore + @distributed_trace def post_required_class_parameter( @@ -1279,23 +1373,29 @@ def post_required_class_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "Product") + _json = self._serialize.body(body_parameter, 'Product') request = build_post_required_class_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_class_parameter.metadata["url"], + template_url=self.post_required_class_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1306,7 +1406,8 @@ def post_required_class_parameter( if cls: return cls(pipeline_response, None, {}) - post_required_class_parameter.metadata = {"url": "/reqopt/requied/class/parameter"} # type: ignore + post_required_class_parameter.metadata = {'url': '/reqopt/requied/class/parameter'} # type: ignore + @distributed_trace def post_optional_class_parameter( @@ -1324,26 +1425,32 @@ def post_optional_class_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "Product") + _json = self._serialize.body(body_parameter, 'Product') else: _json = None request = build_post_optional_class_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_class_parameter.metadata["url"], + template_url=self.post_optional_class_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1354,7 +1461,8 @@ def post_optional_class_parameter( if cls: return cls(pipeline_response, None, {}) - post_optional_class_parameter.metadata = {"url": "/reqopt/optional/class/parameter"} # type: ignore + post_optional_class_parameter.metadata = {'url': '/reqopt/optional/class/parameter'} # type: ignore + @distributed_trace def post_required_class_property( @@ -1373,24 +1481,30 @@ def post_required_class_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ClassWrapper(value=value) - _json = self._serialize.body(_body_parameter, "ClassWrapper") + _json = self._serialize.body(_body_parameter, 'ClassWrapper') request = build_post_required_class_property_request( content_type=content_type, json=_json, - template_url=self.post_required_class_property.metadata["url"], + template_url=self.post_required_class_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1401,7 +1515,8 @@ def post_required_class_property( if cls: return cls(pipeline_response, None, {}) - post_required_class_property.metadata = {"url": "/reqopt/requied/class/property"} # type: ignore + post_required_class_property.metadata = {'url': '/reqopt/requied/class/property'} # type: ignore + @distributed_trace def post_optional_class_property( @@ -1419,27 +1534,33 @@ def post_optional_class_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ClassOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "ClassOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'ClassOptionalWrapper') else: _json = None request = build_post_optional_class_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_class_property.metadata["url"], + template_url=self.post_optional_class_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1450,7 +1571,8 @@ def post_optional_class_property( if cls: return cls(pipeline_response, None, {}) - post_optional_class_property.metadata = {"url": "/reqopt/optional/class/property"} # type: ignore + post_optional_class_property.metadata = {'url': '/reqopt/optional/class/property'} # type: ignore + @distributed_trace def post_required_array_parameter( @@ -1469,23 +1591,29 @@ def post_required_array_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(body_parameter, "[str]") + _json = self._serialize.body(body_parameter, '[str]') request = build_post_required_array_parameter_request( content_type=content_type, json=_json, - template_url=self.post_required_array_parameter.metadata["url"], + template_url=self.post_required_array_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1496,7 +1624,8 @@ def post_required_array_parameter( if cls: return cls(pipeline_response, None, {}) - post_required_array_parameter.metadata = {"url": "/reqopt/requied/array/parameter"} # type: ignore + post_required_array_parameter.metadata = {'url': '/reqopt/requied/array/parameter'} # type: ignore + @distributed_trace def post_optional_array_parameter( @@ -1514,26 +1643,32 @@ def post_optional_array_parameter( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "[str]") + _json = self._serialize.body(body_parameter, '[str]') else: _json = None request = build_post_optional_array_parameter_request( content_type=content_type, json=_json, - template_url=self.post_optional_array_parameter.metadata["url"], + template_url=self.post_optional_array_parameter.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1544,7 +1679,8 @@ def post_optional_array_parameter( if cls: return cls(pipeline_response, None, {}) - post_optional_array_parameter.metadata = {"url": "/reqopt/optional/array/parameter"} # type: ignore + post_optional_array_parameter.metadata = {'url': '/reqopt/optional/array/parameter'} # type: ignore + @distributed_trace def post_required_array_property( @@ -1563,24 +1699,30 @@ def post_required_array_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ArrayWrapper(value=value) - _json = self._serialize.body(_body_parameter, "ArrayWrapper") + _json = self._serialize.body(_body_parameter, 'ArrayWrapper') request = build_post_required_array_property_request( content_type=content_type, json=_json, - template_url=self.post_required_array_property.metadata["url"], + template_url=self.post_required_array_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1591,7 +1733,8 @@ def post_required_array_property( if cls: return cls(pipeline_response, None, {}) - post_required_array_property.metadata = {"url": "/reqopt/requied/array/property"} # type: ignore + post_required_array_property.metadata = {'url': '/reqopt/requied/array/property'} # type: ignore + @distributed_trace def post_optional_array_property( @@ -1609,27 +1752,33 @@ def post_optional_array_property( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _body_parameter = _models.ArrayOptionalWrapper(value=value) if _body_parameter is not None: - _json = self._serialize.body(_body_parameter, "ArrayOptionalWrapper") + _json = self._serialize.body(_body_parameter, 'ArrayOptionalWrapper') else: _json = None request = build_post_optional_array_property_request( content_type=content_type, json=_json, - template_url=self.post_optional_array_property.metadata["url"], + template_url=self.post_optional_array_property.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1640,7 +1789,8 @@ def post_optional_array_property( if cls: return cls(pipeline_response, None, {}) - post_optional_array_property.metadata = {"url": "/reqopt/optional/array/property"} # type: ignore + post_optional_array_property.metadata = {'url': '/reqopt/optional/array/property'} # type: ignore + @distributed_trace def post_required_array_header( @@ -1659,18 +1809,25 @@ def post_required_array_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_required_array_header_request( header_parameter=header_parameter, - template_url=self.post_required_array_header.metadata["url"], + template_url=self.post_required_array_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1681,7 +1838,8 @@ def post_required_array_header( if cls: return cls(pipeline_response, None, {}) - post_required_array_header.metadata = {"url": "/reqopt/requied/array/header"} # type: ignore + post_required_array_header.metadata = {'url': '/reqopt/requied/array/header'} # type: ignore + @distributed_trace def post_optional_array_header( @@ -1699,18 +1857,25 @@ def post_optional_array_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_post_optional_array_header_request( header_parameter=header_parameter, - template_url=self.post_optional_array_header.metadata["url"], + template_url=self.post_optional_array_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1721,4 +1886,5 @@ def post_optional_array_header( if cls: return cls(pipeline_response, None, {}) - post_optional_array_header.metadata = {"url": "/reqopt/optional/array/header"} # type: ignore + post_optional_array_header.metadata = {'url': '/reqopt/optional/array/header'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py index 8fb2f9c7498..0b9a11f5501 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, IO, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -280,18 +272,25 @@ def get_required_path( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_required_path_request( path_parameter=path_parameter, - template_url=self.get_required_path.metadata["url"], + template_url=self.get_required_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -302,7 +301,8 @@ def get_required_path( if cls: return cls(pipeline_response, None, {}) - get_required_path.metadata = {"url": "/reqopt/implicit/required/path/{pathParameter}"} # type: ignore + get_required_path.metadata = {'url': '/reqopt/implicit/required/path/{pathParameter}'} # type: ignore + @distributed_trace def put_optional_query( @@ -320,18 +320,25 @@ def put_optional_query( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_optional_query_request( query_parameter=query_parameter, - template_url=self.put_optional_query.metadata["url"], + template_url=self.put_optional_query.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -342,7 +349,8 @@ def put_optional_query( if cls: return cls(pipeline_response, None, {}) - put_optional_query.metadata = {"url": "/reqopt/implicit/optional/query"} # type: ignore + put_optional_query.metadata = {'url': '/reqopt/implicit/optional/query'} # type: ignore + @distributed_trace def put_optional_header( @@ -360,18 +368,25 @@ def put_optional_header( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_put_optional_header_request( query_parameter=query_parameter, - template_url=self.put_optional_header.metadata["url"], + template_url=self.put_optional_header.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -382,7 +397,8 @@ def put_optional_header( if cls: return cls(pipeline_response, None, {}) - put_optional_header.metadata = {"url": "/reqopt/implicit/optional/header"} # type: ignore + put_optional_header.metadata = {'url': '/reqopt/implicit/optional/header'} # type: ignore + @distributed_trace def put_optional_body( @@ -400,26 +416,32 @@ def put_optional_body( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: - _json = self._serialize.body(body_parameter, "str") + _json = self._serialize.body(body_parameter, 'str') else: _json = None request = build_put_optional_body_request( content_type=content_type, json=_json, - template_url=self.put_optional_body.metadata["url"], + template_url=self.put_optional_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -430,7 +452,8 @@ def put_optional_body( if cls: return cls(pipeline_response, None, {}) - put_optional_body.metadata = {"url": "/reqopt/implicit/optional/body"} # type: ignore + put_optional_body.metadata = {'url': '/reqopt/implicit/optional/body'} # type: ignore + @distributed_trace def put_optional_binary_body( @@ -448,23 +471,29 @@ def put_optional_binary_body( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter request = build_put_optional_binary_body_request( content_type=content_type, content=_content, - template_url=self.put_optional_binary_body.metadata["url"], + template_url=self.put_optional_binary_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -475,11 +504,13 @@ def put_optional_binary_body( if cls: return cls(pipeline_response, None, {}) - put_optional_binary_body.metadata = {"url": "/reqopt/implicit/optional/binary-body"} # type: ignore + put_optional_binary_body.metadata = {'url': '/reqopt/implicit/optional/binary-body'} # type: ignore + @distributed_trace def get_required_global_path( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Test implicitly required path parameter. @@ -489,18 +520,25 @@ def get_required_global_path( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_required_global_path_request( required_global_path=self._config.required_global_path, - template_url=self.get_required_global_path.metadata["url"], + template_url=self.get_required_global_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -511,11 +549,13 @@ def get_required_global_path( if cls: return cls(pipeline_response, None, {}) - get_required_global_path.metadata = {"url": "/reqopt/global/required/path/{required-global-path}"} # type: ignore + get_required_global_path.metadata = {'url': '/reqopt/global/required/path/{required-global-path}'} # type: ignore + @distributed_trace def get_required_global_query( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Test implicitly required query parameter. @@ -525,18 +565,25 @@ def get_required_global_query( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_required_global_query_request( required_global_query=self._config.required_global_query, - template_url=self.get_required_global_query.metadata["url"], + template_url=self.get_required_global_query.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -547,11 +594,13 @@ def get_required_global_query( if cls: return cls(pipeline_response, None, {}) - get_required_global_query.metadata = {"url": "/reqopt/global/required/query"} # type: ignore + get_required_global_query.metadata = {'url': '/reqopt/global/required/query'} # type: ignore + @distributed_trace def get_optional_global_query( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Test implicitly optional query parameter. @@ -561,18 +610,25 @@ def get_optional_global_query( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_optional_global_query_request( optional_global_query=self._config.optional_global_query, - template_url=self.get_optional_global_query.metadata["url"], + template_url=self.get_optional_global_query.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -583,4 +639,5 @@ def get_optional_global_query( if cls: return cls(pipeline_response, None, {}) - get_optional_global_query.metadata = {"url": "/reqopt/global/optional/query"} # type: ignore + get_optional_global_query.metadata = {'url': '/reqopt/global/optional/query'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py index b6d2db16006..835a295dbfa 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/__init__.py index eaeb1bc5c6d..db01ca1ca8b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ReservedWordsClient"] +__all__ = ['ReservedWordsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_configuration.py index 015bcabd8e4..8b205f9682c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class ReservedWordsClientConfiguration(Configuration): +class ReservedWordsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ReservedWordsClient. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class ReservedWordsClientConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(ReservedWordsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "reservedwordsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'reservedwordsclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py index fc7791871ad..3f8636fa4de 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class ReservedWordsClient(ReservedWordsClientOperationsMixin): """Swagger that has operation groups etc. with reserved words. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.import_operations = ImportOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/__init__.py index fc28320f86d..b05173059c0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._reserved_words_client import ReservedWordsClient - -__all__ = ["ReservedWordsClient"] +__all__ = ['ReservedWordsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_configuration.py index b3c39889d49..3219c3ec4f5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class ReservedWordsClientConfiguration(Configuration): +class ReservedWordsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ReservedWordsClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ReservedWordsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "reservedwordsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'reservedwordsclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py index 77194b3e593..03667b81781 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import ReservedWordsClientConfiguration from .operations import ImportOperations, ReservedWordsClientOperationsMixin - class ReservedWordsClient(ReservedWordsClientOperationsMixin): """Swagger that has operation groups etc. with reserved words. @@ -27,7 +26,11 @@ class ReservedWordsClient(ReservedWordsClientOperationsMixin): :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = ReservedWordsClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.import_operations = ImportOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/__init__.py index 2c4a557f7fc..3d7a4d49afc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._reserved_words_client_operations import ReservedWordsClientOperationsMixin __all__ = [ - "ImportOperations", - "ReservedWordsClientOperationsMixin", + 'ImportOperations', + 'ReservedWordsClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py index cebd76368a7..b62ab670ff7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,11 +17,9 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._import_operations_operations import build_operation_one_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ImportOperations: """ImportOperations async operations. @@ -52,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def operation_one(self, parameter1: str, **kwargs: Any) -> Any: + async def operation_one( + self, + parameter1: str, + **kwargs: Any + ) -> Any: """Operation in operation group import, a reserved word. :param parameter1: Pass in 'foo' to pass this test. @@ -62,29 +57,37 @@ async def operation_one(self, parameter1: str, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_operation_one_request( parameter1=parameter1, - template_url=self.operation_one.metadata["url"], + template_url=self.operation_one.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_one.metadata = {"url": "/reservedWords/operationGroup/import"} # type: ignore + operation_one.metadata = {'url': '/reservedWords/operationGroup/import'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py index 04d6b1b64cc..dfde04267f5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, IO, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,20 +16,18 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._reserved_words_client_operations import ( - build_operation_with_content_param_request, - build_operation_with_data_param_request, - build_operation_with_files_param_request, - build_operation_with_json_param_request, -) - -T = TypeVar("T") +from ...operations._reserved_words_client_operations import build_operation_with_content_param_request, build_operation_with_data_param_request, build_operation_with_files_param_request, build_operation_with_json_param_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ReservedWordsClientOperationsMixin: + @distributed_trace_async - async def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: + async def operation_with_content_param( + self, + content: IO, + **kwargs: Any + ) -> Any: """Operation with body param called content. Pass in b'hello, world'. :param content: Pass in b'hello, world'. @@ -46,40 +37,51 @@ async def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = content request = build_operation_with_content_param_request( content_type=content_type, content=_content, - template_url=self.operation_with_content_param.metadata["url"], + template_url=self.operation_with_content_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_content_param.metadata = {"url": "/reservedWords/operation/content"} # type: ignore + operation_with_content_param.metadata = {'url': '/reservedWords/operation/content'} # type: ignore + @distributed_trace_async - async def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: + async def operation_with_json_param( + self, + json: Any, + **kwargs: Any + ) -> Any: """Operation with body param called 'json'. Pass in {'hello': 'world'}. :param json: Pass in {'hello': 'world'}. @@ -89,40 +91,52 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(json, "object") + _json = self._serialize.body(json, 'object') request = build_operation_with_json_param_request( content_type=content_type, json=_json, - template_url=self.operation_with_json_param.metadata["url"], + template_url=self.operation_with_json_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_json_param.metadata = {"url": "/reservedWords/operation/json"} # type: ignore + operation_with_json_param.metadata = {'url': '/reservedWords/operation/json'} # type: ignore + @distributed_trace_async - async def operation_with_data_param(self, data: str, world: str, **kwargs: Any) -> Any: + async def operation_with_data_param( + self, + data: str, + world: str, + **kwargs: Any + ) -> Any: """Operation with urlencoded body param called 'data'. :param data: Pass in 'hello'. @@ -134,11 +148,13 @@ async def operation_with_data_param(self, data: str, world: str, **kwargs: Any) :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] # Construct form data _data = { @@ -149,29 +165,39 @@ async def operation_with_data_param(self, data: str, world: str, **kwargs: Any) request = build_operation_with_data_param_request( content_type=content_type, data=_data, - template_url=self.operation_with_data_param.metadata["url"], + template_url=self.operation_with_data_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_data_param.metadata = {"url": "/reservedWords/operation/data"} # type: ignore + operation_with_data_param.metadata = {'url': '/reservedWords/operation/data'} # type: ignore + @distributed_trace_async - async def operation_with_files_param(self, files: IO, file_name: str, **kwargs: Any) -> Any: + async def operation_with_files_param( + self, + files: IO, + file_name: str, + **kwargs: Any + ) -> Any: """Operation with multipart body param called 'files'. :param files: Files to upload. Pass in list of input streams. @@ -183,11 +209,13 @@ async def operation_with_files_param(self, files: IO, file_name: str, **kwargs: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct form data _files = { @@ -198,23 +226,28 @@ async def operation_with_files_param(self, files: IO, file_name: str, **kwargs: request = build_operation_with_files_param_request( content_type=content_type, files=_files, - template_url=self.operation_with_files_param.metadata["url"], + template_url=self.operation_with_files_param.metadata['url'], ) request = _convert_request(request, _files) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_files_param.metadata = {"url": "/reservedWords/operation/files"} # type: ignore + operation_with_files_param.metadata = {'url': '/reservedWords/operation/files'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py index 11d80a08b78..b4b62e0a68c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py @@ -7,15 +7,13 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import ( - PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema, - ) + from ._models_py3 import PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema from ._models_py3 import PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema except (SyntaxError, ImportError): from ._models import PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema # type: ignore from ._models import PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema # type: ignore __all__ = [ - "PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema", - "PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema", + 'PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema', + 'PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models.py index 488762e9e25..df24385f42f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models.py @@ -9,9 +9,7 @@ import msrest.serialization -class PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema( - msrest.serialization.Model -): +class PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema(msrest.serialization.Model): """PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema. All required parameters must be populated in order to send to Azure. @@ -23,27 +21,28 @@ class PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwF """ _validation = { - "data": {"required": True}, - "world": {"required": True}, + 'data': {'required': True}, + 'world': {'required': True}, } _attribute_map = { - "data": {"key": "data", "type": "str"}, - "world": {"key": "world", "type": "str"}, + 'data': {'key': 'data', 'type': 'str'}, + 'world': {'key': 'world', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword data: Required. Pass in 'hello'. :paramtype data: str :keyword world: Required. Pass in 'world'. :paramtype world: str """ - super( - PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema, self - ).__init__(**kwargs) - self.data = kwargs["data"] - self.world = kwargs["world"] + super(PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema, self).__init__(**kwargs) + self.data = kwargs['data'] + self.world = kwargs['world'] class PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema(msrest.serialization.Model): @@ -58,24 +57,25 @@ class PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDa """ _validation = { - "files": {"required": True}, - "file_name": {"required": True}, + 'files': {'required': True}, + 'file_name': {'required': True}, } _attribute_map = { - "files": {"key": "files", "type": "IO"}, - "file_name": {"key": "fileName", "type": "str"}, + 'files': {'key': 'files', 'type': 'IO'}, + 'file_name': {'key': 'fileName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword files: Required. Files to upload. Pass in list of input streams. :paramtype files: IO :keyword file_name: Required. File name to upload. Pass in 'my.txt'. :paramtype file_name: str """ - super(PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema, self).__init__( - **kwargs - ) - self.files = kwargs["files"] - self.file_name = kwargs["file_name"] + super(PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema, self).__init__(**kwargs) + self.files = kwargs['files'] + self.file_name = kwargs['file_name'] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models_py3.py index 980d72ac758..81ebe0f1c61 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_models_py3.py @@ -11,9 +11,7 @@ import msrest.serialization -class PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema( - msrest.serialization.Model -): +class PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema(msrest.serialization.Model): """PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema. All required parameters must be populated in order to send to Azure. @@ -25,25 +23,29 @@ class PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwF """ _validation = { - "data": {"required": True}, - "world": {"required": True}, + 'data': {'required': True}, + 'world': {'required': True}, } _attribute_map = { - "data": {"key": "data", "type": "str"}, - "world": {"key": "world", "type": "str"}, + 'data': {'key': 'data', 'type': 'str'}, + 'world': {'key': 'world', 'type': 'str'}, } - def __init__(self, *, data: str, world: str, **kwargs): + def __init__( + self, + *, + data: str, + world: str, + **kwargs + ): """ :keyword data: Required. Pass in 'hello'. :paramtype data: str :keyword world: Required. Pass in 'world'. :paramtype world: str """ - super( - PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema, self - ).__init__(**kwargs) + super(PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema, self).__init__(**kwargs) self.data = data self.world = world @@ -60,24 +62,28 @@ class PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDa """ _validation = { - "files": {"required": True}, - "file_name": {"required": True}, + 'files': {'required': True}, + 'file_name': {'required': True}, } _attribute_map = { - "files": {"key": "files", "type": "IO"}, - "file_name": {"key": "fileName", "type": "str"}, + 'files': {'key': 'files', 'type': 'IO'}, + 'file_name': {'key': 'fileName', 'type': 'str'}, } - def __init__(self, *, files: IO, file_name: str, **kwargs): + def __init__( + self, + *, + files: IO, + file_name: str, + **kwargs + ): """ :keyword files: Required. Files to upload. Pass in list of input streams. :paramtype files: IO :keyword file_name: Required. File name to upload. Pass in 'my.txt'. :paramtype file_name: str """ - super(PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema, self).__init__( - **kwargs - ) + super(PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema, self).__init__(**kwargs) self.files = files self.file_name = file_name diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/__init__.py index 2c4a557f7fc..3d7a4d49afc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/__init__.py @@ -10,6 +10,6 @@ from ._reserved_words_client_operations import ReservedWordsClientOperationsMixin __all__ = [ - "ImportOperations", - "ReservedWordsClientOperationsMixin", + 'ImportOperations', + 'ReservedWordsClientOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py index 06e67723cc9..4961716e914 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -101,29 +93,37 @@ def operation_one( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_operation_one_request( parameter1=parameter1, - template_url=self.operation_one.metadata["url"], + template_url=self.operation_one.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_one.metadata = {"url": "/reservedWords/operationGroup/import"} # type: ignore + operation_one.metadata = {'url': '/reservedWords/operationGroup/import'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py index c2a19b9125b..41c42dbc9e3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, IO, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -133,6 +125,7 @@ def build_operation_with_files_param_request( # fmt: on class ReservedWordsClientOperationsMixin(object): + @distributed_trace def operation_with_content_param( self, @@ -149,37 +142,44 @@ def operation_with_content_param( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = content request = build_operation_with_content_param_request( content_type=content_type, content=_content, - template_url=self.operation_with_content_param.metadata["url"], + template_url=self.operation_with_content_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_content_param.metadata = {"url": "/reservedWords/operation/content"} # type: ignore + operation_with_content_param.metadata = {'url': '/reservedWords/operation/content'} # type: ignore + @distributed_trace def operation_with_json_param( @@ -197,37 +197,44 @@ def operation_with_json_param( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - _json = self._serialize.body(json, "object") + _json = self._serialize.body(json, 'object') request = build_operation_with_json_param_request( content_type=content_type, json=_json, - template_url=self.operation_with_json_param.metadata["url"], + template_url=self.operation_with_json_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_json_param.metadata = {"url": "/reservedWords/operation/json"} # type: ignore + operation_with_json_param.metadata = {'url': '/reservedWords/operation/json'} # type: ignore + @distributed_trace def operation_with_data_param( @@ -248,11 +255,13 @@ def operation_with_data_param( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] # Construct form data _data = { @@ -263,26 +272,31 @@ def operation_with_data_param( request = build_operation_with_data_param_request( content_type=content_type, data=_data, - template_url=self.operation_with_data_param.metadata["url"], + template_url=self.operation_with_data_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_data_param.metadata = {"url": "/reservedWords/operation/data"} # type: ignore + operation_with_data_param.metadata = {'url': '/reservedWords/operation/data'} # type: ignore + @distributed_trace def operation_with_files_param( @@ -303,11 +317,13 @@ def operation_with_files_param( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct form data _files = { @@ -318,23 +334,28 @@ def operation_with_files_param( request = build_operation_with_files_param_request( content_type=content_type, files=_files, - template_url=self.operation_with_files_param.metadata["url"], + template_url=self.operation_with_files_param.metadata['url'], ) request = _convert_request(request, _files) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - operation_with_files_param.metadata = {"url": "/reservedWords/operation/files"} # type: ignore + operation_with_files_param.metadata = {'url': '/reservedWords/operation/files'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py index 938b1069b30..f2973a2700c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Swagger that has operation groups etc. with reserved words. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py index 3eeeb1be90b..7b354e37d86 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/__init__.py index 56522eab3d5..e9117c1dd2d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestUrlTestService"] +__all__ = ['AutoRestUrlTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py index 43d40fdf904..16477e983d9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py @@ -22,7 +22,6 @@ from azure.core.rest import HttpRequest, HttpResponse - class AutoRestUrlTestService(object): """Test Infrastructure for AutoRest. @@ -48,9 +47,7 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - self._config = AutoRestUrlTestServiceConfiguration( - global_string_path=global_string_path, global_string_query=global_string_query, **kwargs - ) + self._config = AutoRestUrlTestServiceConfiguration(global_string_path=global_string_path, global_string_query=global_string_query, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -60,6 +57,7 @@ def __init__( self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) self.path_items = PathItemsOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_configuration.py index 80e0a0fd1a9..36766a53073 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_configuration.py @@ -18,7 +18,7 @@ from typing import Any, Optional -class AutoRestUrlTestServiceConfiguration(Configuration): +class AutoRestUrlTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlTestService. Note that all parameters used to create this instance are saved as instance @@ -43,19 +43,20 @@ def __init__( self.global_string_path = global_string_path self.global_string_query = global_string_query - kwargs.setdefault("sdk_moniker", "autoresturltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/__init__.py index 451dfcc7fc1..a9ed709fa25 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_url_test_service import AutoRestUrlTestService - -__all__ = ["AutoRestUrlTestService"] +__all__ = ['AutoRestUrlTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py index f3aef87663d..d0e067cccda 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py @@ -17,7 +17,6 @@ from ._configuration import AutoRestUrlTestServiceConfiguration from .operations import PathItemsOperations, PathsOperations, QueriesOperations - class AutoRestUrlTestService: """Test Infrastructure for AutoRest. @@ -42,9 +41,7 @@ def __init__( base_url: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestUrlTestServiceConfiguration( - global_string_path=global_string_path, global_string_query=global_string_query, **kwargs - ) + self._config = AutoRestUrlTestServiceConfiguration(global_string_path=global_string_path, global_string_query=global_string_query, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -54,7 +51,12 @@ def __init__( self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) self.path_items = PathItemsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_configuration.py index e5a929b5629..2fa1227f947 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestUrlTestServiceConfiguration(Configuration): +class AutoRestUrlTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlTestService. Note that all parameters used to create this instance are saved as instance @@ -26,23 +26,31 @@ class AutoRestUrlTestServiceConfiguration(Configuration): :type global_string_query: str """ - def __init__(self, global_string_path: str, global_string_query: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + global_string_path: str, + global_string_query: Optional[str] = None, + **kwargs: Any + ) -> None: super(AutoRestUrlTestServiceConfiguration, self).__init__(**kwargs) if global_string_path is None: raise ValueError("Parameter 'global_string_path' must not be None.") self.global_string_path = global_string_path self.global_string_query = global_string_query - kwargs.setdefault("sdk_moniker", "autoresturltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/__init__.py index 293199669de..8d46687d7c1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._path_items_operations import PathItemsOperations __all__ = [ - "PathsOperations", - "QueriesOperations", - "PathItemsOperations", + 'PathsOperations', + 'QueriesOperations', + 'PathItemsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py index 65711910f38..1550bb64a63 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,17 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._path_items_operations import ( - build_get_all_with_values_request, - build_get_global_and_local_query_null_request, - build_get_global_query_null_request, - build_get_local_path_item_query_null_request, -) - -T = TypeVar("T") +from ...operations._path_items_operations import build_get_all_with_values_request, build_get_global_and_local_query_null_request, build_get_global_query_null_request, build_get_local_path_item_query_null_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathItemsOperations: """PathItemsOperations async operations. @@ -83,10 +69,13 @@ async def get_all_with_values( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_all_with_values_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -94,12 +83,16 @@ async def get_all_with_values( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_all_with_values.metadata["url"], + template_url=self.get_all_with_values.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,7 +103,8 @@ async def get_all_with_values( if cls: return cls(pipeline_response, None, {}) - get_all_with_values.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery"} # type: ignore + get_all_with_values.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery'} # type: ignore + @distributed_trace_async async def get_global_query_null( @@ -139,10 +133,13 @@ async def get_global_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_global_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -150,12 +147,16 @@ async def get_global_query_null( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_global_query_null.metadata["url"], + template_url=self.get_global_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -166,7 +167,8 @@ async def get_global_query_null( if cls: return cls(pipeline_response, None, {}) - get_global_query_null.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery"} # type: ignore + get_global_query_null.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery'} # type: ignore + @distributed_trace_async async def get_global_and_local_query_null( @@ -195,10 +197,13 @@ async def get_global_and_local_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_global_and_local_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -206,12 +211,16 @@ async def get_global_and_local_query_null( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_global_and_local_query_null.metadata["url"], + template_url=self.get_global_and_local_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -222,7 +231,8 @@ async def get_global_and_local_query_null( if cls: return cls(pipeline_response, None, {}) - get_global_and_local_query_null.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null"} # type: ignore + get_global_and_local_query_null.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null'} # type: ignore + @distributed_trace_async async def get_local_path_item_query_null( @@ -250,10 +260,13 @@ async def get_local_path_item_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_path_item_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -261,12 +274,16 @@ async def get_local_path_item_query_null( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_local_path_item_query_null.metadata["url"], + template_url=self.get_local_path_item_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -277,4 +294,5 @@ async def get_local_path_item_query_null( if cls: return cls(pipeline_response, None, {}) - get_local_path_item_query_null.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null"} # type: ignore + get_local_path_item_query_null.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py index bf2e170f022..37bd9745bef 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,41 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._paths_operations import ( - build_array_csv_in_path_request, - build_base64_url_request, - build_byte_empty_request, - build_byte_multi_byte_request, - build_byte_null_request, - build_date_null_request, - build_date_time_null_request, - build_date_time_valid_request, - build_date_valid_request, - build_double_decimal_negative_request, - build_double_decimal_positive_request, - build_enum_null_request, - build_enum_valid_request, - build_float_scientific_negative_request, - build_float_scientific_positive_request, - build_get_boolean_false_request, - build_get_boolean_true_request, - build_get_int_negative_one_million_request, - build_get_int_one_million_request, - build_get_negative_ten_billion_request, - build_get_ten_billion_request, - build_string_empty_request, - build_string_null_request, - build_string_unicode_request, - build_string_url_encoded_request, - build_string_url_non_encoded_request, - build_unix_time_url_request, -) - -T = TypeVar("T") +from ...operations._paths_operations import build_array_csv_in_path_request, build_base64_url_request, build_byte_empty_request, build_byte_multi_byte_request, build_byte_null_request, build_date_null_request, build_date_time_null_request, build_date_time_valid_request, build_date_valid_request, build_double_decimal_negative_request, build_double_decimal_positive_request, build_enum_null_request, build_enum_valid_request, build_float_scientific_negative_request, build_float_scientific_positive_request, build_get_boolean_false_request, build_get_boolean_true_request, build_get_int_negative_one_million_request, build_get_int_one_million_request, build_get_negative_ten_billion_request, build_get_ten_billion_request, build_string_empty_request, build_string_null_request, build_string_unicode_request, build_string_url_encoded_request, build_string_url_non_encoded_request, build_unix_time_url_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class PathsOperations: +class PathsOperations: # pylint: disable=too-many-public-methods """PathsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -81,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_boolean_true(self, **kwargs: Any) -> None: + async def get_boolean_true( + self, + **kwargs: Any + ) -> None: """Get true Boolean value on path. :keyword bool_path: true boolean value. The default value is True. Note that overriding this @@ -92,20 +58,27 @@ async def get_boolean_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", True) # type: bool + bool_path = kwargs.pop('bool_path', True) # type: bool + request = build_get_boolean_true_request( bool_path=bool_path, - template_url=self.get_boolean_true.metadata["url"], + template_url=self.get_boolean_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -116,10 +89,14 @@ async def get_boolean_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_boolean_true.metadata = {"url": "/paths/bool/true/{boolPath}"} # type: ignore + get_boolean_true.metadata = {'url': '/paths/bool/true/{boolPath}'} # type: ignore + @distributed_trace_async - async def get_boolean_false(self, **kwargs: Any) -> None: + async def get_boolean_false( + self, + **kwargs: Any + ) -> None: """Get false Boolean value on path. :keyword bool_path: false boolean value. The default value is False. Note that overriding this @@ -130,20 +107,27 @@ async def get_boolean_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", False) # type: bool + bool_path = kwargs.pop('bool_path', False) # type: bool + request = build_get_boolean_false_request( bool_path=bool_path, - template_url=self.get_boolean_false.metadata["url"], + template_url=self.get_boolean_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -154,10 +138,14 @@ async def get_boolean_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_boolean_false.metadata = {"url": "/paths/bool/false/{boolPath}"} # type: ignore + get_boolean_false.metadata = {'url': '/paths/bool/false/{boolPath}'} # type: ignore + @distributed_trace_async - async def get_int_one_million(self, **kwargs: Any) -> None: + async def get_int_one_million( + self, + **kwargs: Any + ) -> None: """Get '1000000' integer value. :keyword int_path: '1000000' integer value. The default value is 1000000. Note that overriding @@ -168,20 +156,27 @@ async def get_int_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", 1000000) # type: int + int_path = kwargs.pop('int_path', 1000000) # type: int + request = build_get_int_one_million_request( int_path=int_path, - template_url=self.get_int_one_million.metadata["url"], + template_url=self.get_int_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -192,10 +187,14 @@ async def get_int_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_int_one_million.metadata = {"url": "/paths/int/1000000/{intPath}"} # type: ignore + get_int_one_million.metadata = {'url': '/paths/int/1000000/{intPath}'} # type: ignore + @distributed_trace_async - async def get_int_negative_one_million(self, **kwargs: Any) -> None: + async def get_int_negative_one_million( + self, + **kwargs: Any + ) -> None: """Get '-1000000' integer value. :keyword int_path: '-1000000' integer value. The default value is -1000000. Note that @@ -206,20 +205,27 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", -1000000) # type: int + int_path = kwargs.pop('int_path', -1000000) # type: int + request = build_get_int_negative_one_million_request( int_path=int_path, - template_url=self.get_int_negative_one_million.metadata["url"], + template_url=self.get_int_negative_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -230,10 +236,14 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_int_negative_one_million.metadata = {"url": "/paths/int/-1000000/{intPath}"} # type: ignore + get_int_negative_one_million.metadata = {'url': '/paths/int/-1000000/{intPath}'} # type: ignore + @distributed_trace_async - async def get_ten_billion(self, **kwargs: Any) -> None: + async def get_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '10000000000' 64 bit integer value. :keyword long_path: '10000000000' 64 bit integer value. The default value is 10000000000. Note @@ -244,20 +254,27 @@ async def get_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", 10000000000) # type: int + long_path = kwargs.pop('long_path', 10000000000) # type: int + request = build_get_ten_billion_request( long_path=long_path, - template_url=self.get_ten_billion.metadata["url"], + template_url=self.get_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,10 +285,14 @@ async def get_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_ten_billion.metadata = {"url": "/paths/long/10000000000/{longPath}"} # type: ignore + get_ten_billion.metadata = {'url': '/paths/long/10000000000/{longPath}'} # type: ignore + @distributed_trace_async - async def get_negative_ten_billion(self, **kwargs: Any) -> None: + async def get_negative_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '-10000000000' 64 bit integer value. :keyword long_path: '-10000000000' 64 bit integer value. The default value is -10000000000. @@ -282,20 +303,27 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", -10000000000) # type: int + long_path = kwargs.pop('long_path', -10000000000) # type: int + request = build_get_negative_ten_billion_request( long_path=long_path, - template_url=self.get_negative_ten_billion.metadata["url"], + template_url=self.get_negative_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -306,10 +334,14 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_negative_ten_billion.metadata = {"url": "/paths/long/-10000000000/{longPath}"} # type: ignore + get_negative_ten_billion.metadata = {'url': '/paths/long/-10000000000/{longPath}'} # type: ignore + @distributed_trace_async - async def float_scientific_positive(self, **kwargs: Any) -> None: + async def float_scientific_positive( + self, + **kwargs: Any + ) -> None: """Get '1.034E+20' numeric value. :keyword float_path: '1.034E+20'numeric value. The default value is 103400000000000000000. Note @@ -320,20 +352,27 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", 103400000000000000000) # type: float + float_path = kwargs.pop('float_path', 103400000000000000000) # type: float + request = build_float_scientific_positive_request( float_path=float_path, - template_url=self.float_scientific_positive.metadata["url"], + template_url=self.float_scientific_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,10 +383,14 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - float_scientific_positive.metadata = {"url": "/paths/float/1.034E+20/{floatPath}"} # type: ignore + float_scientific_positive.metadata = {'url': '/paths/float/1.034E+20/{floatPath}'} # type: ignore + @distributed_trace_async - async def float_scientific_negative(self, **kwargs: Any) -> None: + async def float_scientific_negative( + self, + **kwargs: Any + ) -> None: """Get '-1.034E-20' numeric value. :keyword float_path: '-1.034E-20'numeric value. The default value is -1.034e-20. Note that @@ -358,20 +401,27 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", -1.034e-20) # type: float + float_path = kwargs.pop('float_path', -1.034e-20) # type: float + request = build_float_scientific_negative_request( float_path=float_path, - template_url=self.float_scientific_negative.metadata["url"], + template_url=self.float_scientific_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -382,10 +432,14 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - float_scientific_negative.metadata = {"url": "/paths/float/-1.034E-20/{floatPath}"} # type: ignore + float_scientific_negative.metadata = {'url': '/paths/float/-1.034E-20/{floatPath}'} # type: ignore + @distributed_trace_async - async def double_decimal_positive(self, **kwargs: Any) -> None: + async def double_decimal_positive( + self, + **kwargs: Any + ) -> None: """Get '9999999.999' numeric value. :keyword double_path: '9999999.999'numeric value. The default value is 9999999.999. Note that @@ -396,20 +450,27 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", 9999999.999) # type: float + double_path = kwargs.pop('double_path', 9999999.999) # type: float + request = build_double_decimal_positive_request( double_path=double_path, - template_url=self.double_decimal_positive.metadata["url"], + template_url=self.double_decimal_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -420,10 +481,14 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - double_decimal_positive.metadata = {"url": "/paths/double/9999999.999/{doublePath}"} # type: ignore + double_decimal_positive.metadata = {'url': '/paths/double/9999999.999/{doublePath}'} # type: ignore + @distributed_trace_async - async def double_decimal_negative(self, **kwargs: Any) -> None: + async def double_decimal_negative( + self, + **kwargs: Any + ) -> None: """Get '-9999999.999' numeric value. :keyword double_path: '-9999999.999'numeric value. The default value is -9999999.999. Note that @@ -434,20 +499,27 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", -9999999.999) # type: float + double_path = kwargs.pop('double_path', -9999999.999) # type: float + request = build_double_decimal_negative_request( double_path=double_path, - template_url=self.double_decimal_negative.metadata["url"], + template_url=self.double_decimal_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,10 +530,14 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - double_decimal_negative.metadata = {"url": "/paths/double/-9999999.999/{doublePath}"} # type: ignore + double_decimal_negative.metadata = {'url': '/paths/double/-9999999.999/{doublePath}'} # type: ignore + @distributed_trace_async - async def string_unicode(self, **kwargs: Any) -> None: + async def string_unicode( + self, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. :keyword string_path: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. The default value is "啊齄丂狛狜隣郎隣兀﨩". @@ -472,20 +548,27 @@ async def string_unicode(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_string_unicode_request( string_path=string_path, - template_url=self.string_unicode.metadata["url"], + template_url=self.string_unicode.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -496,10 +579,14 @@ async def string_unicode(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_unicode.metadata = {"url": "/paths/string/unicode/{stringPath}"} # type: ignore + string_unicode.metadata = {'url': '/paths/string/unicode/{stringPath}'} # type: ignore + @distributed_trace_async - async def string_url_encoded(self, **kwargs: Any) -> None: + async def string_url_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@ &=+$,/?#[]end. :keyword string_path: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. The default value @@ -511,20 +598,27 @@ async def string_url_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_string_url_encoded_request( string_path=string_path, - template_url=self.string_url_encoded.metadata["url"], + template_url=self.string_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -535,10 +629,14 @@ async def string_url_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_url_encoded.metadata = {"url": "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}"} # type: ignore + string_url_encoded.metadata = {'url': '/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}'} # type: ignore + @distributed_trace_async - async def string_url_non_encoded(self, **kwargs: Any) -> None: + async def string_url_non_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@&=+$,end. https://tools.ietf.org/html/rfc3986#appendix-A 'path' accept any 'pchar' not encoded. @@ -552,20 +650,27 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@&=+$,end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str + request = build_string_url_non_encoded_request( string_path=string_path, - template_url=self.string_url_non_encoded.metadata["url"], + template_url=self.string_url_non_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,10 +681,14 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_url_non_encoded.metadata = {"url": "/paths/string/begin!*'();:@&=+$,end/{stringPath}"} # type: ignore + string_url_non_encoded.metadata = {'url': '/paths/string/begin!*\'();:@&=+$,end/{stringPath}'} # type: ignore + @distributed_trace_async - async def string_empty(self, **kwargs: Any) -> None: + async def string_empty( + self, + **kwargs: Any + ) -> None: """Get ''. :keyword string_path: '' string value. The default value is "". Note that overriding this @@ -590,20 +699,27 @@ async def string_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "") # type: str + string_path = kwargs.pop('string_path', "") # type: str + request = build_string_empty_request( string_path=string_path, - template_url=self.string_empty.metadata["url"], + template_url=self.string_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -614,10 +730,15 @@ async def string_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_empty.metadata = {"url": "/paths/string/empty/{stringPath}"} # type: ignore + string_empty.metadata = {'url': '/paths/string/empty/{stringPath}'} # type: ignore + @distributed_trace_async - async def string_null(self, string_path: str, **kwargs: Any) -> None: + async def string_null( + self, + string_path: str, + **kwargs: Any + ) -> None: """Get null (should throw). :param string_path: null string value. @@ -627,18 +748,25 @@ async def string_null(self, string_path: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_string_null_request( string_path=string_path, - template_url=self.string_null.metadata["url"], + template_url=self.string_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -649,10 +777,15 @@ async def string_null(self, string_path: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_null.metadata = {"url": "/paths/string/null/{stringPath}"} # type: ignore + string_null.metadata = {'url': '/paths/string/null/{stringPath}'} # type: ignore + @distributed_trace_async - async def enum_valid(self, enum_path: Union[str, "_models.UriColor"], **kwargs: Any) -> None: + async def enum_valid( + self, + enum_path: Union[str, "_models.UriColor"], + **kwargs: Any + ) -> None: """Get using uri with 'green color' in path parameter. :param enum_path: send the value green. @@ -662,18 +795,25 @@ async def enum_valid(self, enum_path: Union[str, "_models.UriColor"], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_valid_request( enum_path=enum_path, - template_url=self.enum_valid.metadata["url"], + template_url=self.enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -684,10 +824,15 @@ async def enum_valid(self, enum_path: Union[str, "_models.UriColor"], **kwargs: if cls: return cls(pipeline_response, None, {}) - enum_valid.metadata = {"url": "/paths/enum/green%20color/{enumPath}"} # type: ignore + enum_valid.metadata = {'url': '/paths/enum/green%20color/{enumPath}'} # type: ignore + @distributed_trace_async - async def enum_null(self, enum_path: Union[str, "_models.UriColor"], **kwargs: Any) -> None: + async def enum_null( + self, + enum_path: Union[str, "_models.UriColor"], + **kwargs: Any + ) -> None: """Get null (should throw on the client before the request is sent on wire). :param enum_path: send null should throw. @@ -697,18 +842,25 @@ async def enum_null(self, enum_path: Union[str, "_models.UriColor"], **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_null_request( enum_path=enum_path, - template_url=self.enum_null.metadata["url"], + template_url=self.enum_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -719,10 +871,15 @@ async def enum_null(self, enum_path: Union[str, "_models.UriColor"], **kwargs: A if cls: return cls(pipeline_response, None, {}) - enum_null.metadata = {"url": "/paths/string/null/{enumPath}"} # type: ignore + enum_null.metadata = {'url': '/paths/string/null/{enumPath}'} # type: ignore + @distributed_trace_async - async def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: + async def byte_multi_byte( + self, + byte_path: bytearray, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. :param byte_path: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. @@ -732,18 +889,25 @@ async def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_multi_byte_request( byte_path=byte_path, - template_url=self.byte_multi_byte.metadata["url"], + template_url=self.byte_multi_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -754,10 +918,14 @@ async def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - byte_multi_byte.metadata = {"url": "/paths/byte/multibyte/{bytePath}"} # type: ignore + byte_multi_byte.metadata = {'url': '/paths/byte/multibyte/{bytePath}'} # type: ignore + @distributed_trace_async - async def byte_empty(self, **kwargs: Any) -> None: + async def byte_empty( + self, + **kwargs: Any + ) -> None: """Get '' as byte array. :keyword byte_path: '' as byte array. The default value is bytearray("", encoding="utf-8"). @@ -768,20 +936,27 @@ async def byte_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_path = kwargs.pop("byte_path", bytearray("", encoding="utf-8")) # type: bytearray + byte_path = kwargs.pop('byte_path', bytearray("", encoding="utf-8")) # type: bytearray + request = build_byte_empty_request( byte_path=byte_path, - template_url=self.byte_empty.metadata["url"], + template_url=self.byte_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -792,10 +967,15 @@ async def byte_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - byte_empty.metadata = {"url": "/paths/byte/empty/{bytePath}"} # type: ignore + byte_empty.metadata = {'url': '/paths/byte/empty/{bytePath}'} # type: ignore + @distributed_trace_async - async def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: + async def byte_null( + self, + byte_path: bytearray, + **kwargs: Any + ) -> None: """Get null as byte array (should throw). :param byte_path: null as byte array (should throw). @@ -805,18 +985,25 @@ async def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_null_request( byte_path=byte_path, - template_url=self.byte_null.metadata["url"], + template_url=self.byte_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -827,10 +1014,14 @@ async def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - byte_null.metadata = {"url": "/paths/byte/null/{bytePath}"} # type: ignore + byte_null.metadata = {'url': '/paths/byte/null/{bytePath}'} # type: ignore + @distributed_trace_async - async def date_valid(self, **kwargs: Any) -> None: + async def date_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01' as date. :keyword date_path: '2012-01-01' as date. The default value is "2012-01-01". Note that @@ -841,20 +1032,27 @@ async def date_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_path = kwargs.pop("date_path", "2012-01-01") # type: datetime.date + date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date + request = build_date_valid_request( date_path=date_path, - template_url=self.date_valid.metadata["url"], + template_url=self.date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -865,10 +1063,15 @@ async def date_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - date_valid.metadata = {"url": "/paths/date/2012-01-01/{datePath}"} # type: ignore + date_valid.metadata = {'url': '/paths/date/2012-01-01/{datePath}'} # type: ignore + @distributed_trace_async - async def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: + async def date_null( + self, + date_path: datetime.date, + **kwargs: Any + ) -> None: """Get null as date - this should throw or be unusable on the client side, depending on date representation. @@ -879,18 +1082,25 @@ async def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_null_request( date_path=date_path, - template_url=self.date_null.metadata["url"], + template_url=self.date_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -901,10 +1111,14 @@ async def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - date_null.metadata = {"url": "/paths/date/null/{datePath}"} # type: ignore + date_null.metadata = {'url': '/paths/date/null/{datePath}'} # type: ignore + @distributed_trace_async - async def date_time_valid(self, **kwargs: Any) -> None: + async def date_time_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01T01:01:01Z' as date-time. :keyword date_time_path: '2012-01-01T01:01:01Z' as date-time. The default value is @@ -916,20 +1130,27 @@ async def date_time_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_path = kwargs.pop("date_time_path", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_date_time_valid_request( date_time_path=date_time_path, - template_url=self.date_time_valid.metadata["url"], + template_url=self.date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -940,10 +1161,15 @@ async def date_time_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - date_time_valid.metadata = {"url": "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}"} # type: ignore + date_time_valid.metadata = {'url': '/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}'} # type: ignore + @distributed_trace_async - async def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) -> None: + async def date_time_null( + self, + date_time_path: datetime.datetime, + **kwargs: Any + ) -> None: """Get null as date-time, should be disallowed or throw depending on representation of date-time. :param date_time_path: null as date-time. @@ -953,18 +1179,25 @@ async def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_time_null_request( date_time_path=date_time_path, - template_url=self.date_time_null.metadata["url"], + template_url=self.date_time_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -975,10 +1208,15 @@ async def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - date_time_null.metadata = {"url": "/paths/datetime/null/{dateTimePath}"} # type: ignore + date_time_null.metadata = {'url': '/paths/datetime/null/{dateTimePath}'} # type: ignore + @distributed_trace_async - async def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: + async def base64_url( + self, + base64_url_path: bytes, + **kwargs: Any + ) -> None: """Get 'lorem' encoded value as 'bG9yZW0' (base64url). :param base64_url_path: base64url encoded value. @@ -988,18 +1226,25 @@ async def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_base64_url_request( base64_url_path=base64_url_path, - template_url=self.base64_url.metadata["url"], + template_url=self.base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1010,10 +1255,15 @@ async def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - base64_url.metadata = {"url": "/paths/string/bG9yZW0/{base64UrlPath}"} # type: ignore + base64_url.metadata = {'url': '/paths/string/bG9yZW0/{base64UrlPath}'} # type: ignore + @distributed_trace_async - async def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: + async def array_csv_in_path( + self, + array_path: List[str], + **kwargs: Any + ) -> None: """Get an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -1025,18 +1275,25 @@ async def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_csv_in_path_request( array_path=array_path, - template_url=self.array_csv_in_path.metadata["url"], + template_url=self.array_csv_in_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1047,10 +1304,15 @@ async def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - array_csv_in_path.metadata = {"url": "/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}"} # type: ignore + array_csv_in_path.metadata = {'url': '/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}'} # type: ignore + @distributed_trace_async - async def unix_time_url(self, unix_time_url_path: datetime.datetime, **kwargs: Any) -> None: + async def unix_time_url( + self, + unix_time_url_path: datetime.datetime, + **kwargs: Any + ) -> None: """Get the date 2016-04-13 encoded value as '1460505600' (Unix time). :param unix_time_url_path: Unix time encoded value. @@ -1060,18 +1322,25 @@ async def unix_time_url(self, unix_time_url_path: datetime.datetime, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_unix_time_url_request( unix_time_url_path=unix_time_url_path, - template_url=self.unix_time_url.metadata["url"], + template_url=self.unix_time_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1082,4 +1351,5 @@ async def unix_time_url(self, unix_time_url_path: datetime.datetime, **kwargs: A if cls: return cls(pipeline_response, None, {}) - unix_time_url.metadata = {"url": "/paths/int/1460505600/{unixTimeUrlPath}"} # type: ignore + unix_time_url.metadata = {'url': '/paths/int/1460505600/{unixTimeUrlPath}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py index 93680752fbf..c80376d8332 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -24,49 +17,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queries_operations import ( - build_array_string_csv_empty_request, - build_array_string_csv_null_request, - build_array_string_csv_valid_request, - build_array_string_no_collection_format_empty_request, - build_array_string_pipes_valid_request, - build_array_string_ssv_valid_request, - build_array_string_tsv_valid_request, - build_byte_empty_request, - build_byte_multi_byte_request, - build_byte_null_request, - build_date_null_request, - build_date_time_null_request, - build_date_time_valid_request, - build_date_valid_request, - build_double_decimal_negative_request, - build_double_decimal_positive_request, - build_double_null_request, - build_enum_null_request, - build_enum_valid_request, - build_float_null_request, - build_float_scientific_negative_request, - build_float_scientific_positive_request, - build_get_boolean_false_request, - build_get_boolean_null_request, - build_get_boolean_true_request, - build_get_int_negative_one_million_request, - build_get_int_null_request, - build_get_int_one_million_request, - build_get_long_null_request, - build_get_negative_ten_billion_request, - build_get_ten_billion_request, - build_string_empty_request, - build_string_null_request, - build_string_unicode_request, - build_string_url_encoded_request, -) - -T = TypeVar("T") +from ...operations._queries_operations import build_array_string_csv_empty_request, build_array_string_csv_null_request, build_array_string_csv_valid_request, build_array_string_no_collection_format_empty_request, build_array_string_pipes_valid_request, build_array_string_ssv_valid_request, build_array_string_tsv_valid_request, build_byte_empty_request, build_byte_multi_byte_request, build_byte_null_request, build_date_null_request, build_date_time_null_request, build_date_time_valid_request, build_date_valid_request, build_double_decimal_negative_request, build_double_decimal_positive_request, build_double_null_request, build_enum_null_request, build_enum_valid_request, build_float_null_request, build_float_scientific_negative_request, build_float_scientific_positive_request, build_get_boolean_false_request, build_get_boolean_null_request, build_get_boolean_true_request, build_get_int_negative_one_million_request, build_get_int_null_request, build_get_int_one_million_request, build_get_long_null_request, build_get_negative_ten_billion_request, build_get_ten_billion_request, build_string_empty_request, build_string_null_request, build_string_unicode_request, build_string_url_encoded_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class QueriesOperations: +class QueriesOperations: # pylint: disable=too-many-public-methods """QueriesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -89,7 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_boolean_true(self, **kwargs: Any) -> None: + async def get_boolean_true( + self, + **kwargs: Any + ) -> None: """Get true Boolean value on path. :keyword bool_query: true boolean value. The default value is True. Note that overriding this @@ -100,20 +58,27 @@ async def get_boolean_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", True) # type: bool + bool_query = kwargs.pop('bool_query', True) # type: bool + request = build_get_boolean_true_request( bool_query=bool_query, - template_url=self.get_boolean_true.metadata["url"], + template_url=self.get_boolean_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,10 +89,14 @@ async def get_boolean_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_boolean_true.metadata = {"url": "/queries/bool/true"} # type: ignore + get_boolean_true.metadata = {'url': '/queries/bool/true'} # type: ignore + @distributed_trace_async - async def get_boolean_false(self, **kwargs: Any) -> None: + async def get_boolean_false( + self, + **kwargs: Any + ) -> None: """Get false Boolean value on path. :keyword bool_query: false boolean value. The default value is False. Note that overriding this @@ -138,20 +107,27 @@ async def get_boolean_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", False) # type: bool + bool_query = kwargs.pop('bool_query', False) # type: bool + request = build_get_boolean_false_request( bool_query=bool_query, - template_url=self.get_boolean_false.metadata["url"], + template_url=self.get_boolean_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -162,10 +138,15 @@ async def get_boolean_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_boolean_false.metadata = {"url": "/queries/bool/false"} # type: ignore + get_boolean_false.metadata = {'url': '/queries/bool/false'} # type: ignore + @distributed_trace_async - async def get_boolean_null(self, bool_query: Optional[bool] = None, **kwargs: Any) -> None: + async def get_boolean_null( + self, + bool_query: Optional[bool] = None, + **kwargs: Any + ) -> None: """Get null Boolean value on query (query string should be absent). :param bool_query: null boolean value. @@ -175,18 +156,25 @@ async def get_boolean_null(self, bool_query: Optional[bool] = None, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_null_request( bool_query=bool_query, - template_url=self.get_boolean_null.metadata["url"], + template_url=self.get_boolean_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -197,10 +185,14 @@ async def get_boolean_null(self, bool_query: Optional[bool] = None, **kwargs: An if cls: return cls(pipeline_response, None, {}) - get_boolean_null.metadata = {"url": "/queries/bool/null"} # type: ignore + get_boolean_null.metadata = {'url': '/queries/bool/null'} # type: ignore + @distributed_trace_async - async def get_int_one_million(self, **kwargs: Any) -> None: + async def get_int_one_million( + self, + **kwargs: Any + ) -> None: """Get '1000000' integer value. :keyword int_query: '1000000' integer value. The default value is 1000000. Note that overriding @@ -211,20 +203,27 @@ async def get_int_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", 1000000) # type: int + int_query = kwargs.pop('int_query', 1000000) # type: int + request = build_get_int_one_million_request( int_query=int_query, - template_url=self.get_int_one_million.metadata["url"], + template_url=self.get_int_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,10 +234,14 @@ async def get_int_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_int_one_million.metadata = {"url": "/queries/int/1000000"} # type: ignore + get_int_one_million.metadata = {'url': '/queries/int/1000000'} # type: ignore + @distributed_trace_async - async def get_int_negative_one_million(self, **kwargs: Any) -> None: + async def get_int_negative_one_million( + self, + **kwargs: Any + ) -> None: """Get '-1000000' integer value. :keyword int_query: '-1000000' integer value. The default value is -1000000. Note that @@ -249,20 +252,27 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", -1000000) # type: int + int_query = kwargs.pop('int_query', -1000000) # type: int + request = build_get_int_negative_one_million_request( int_query=int_query, - template_url=self.get_int_negative_one_million.metadata["url"], + template_url=self.get_int_negative_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,10 +283,15 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_int_negative_one_million.metadata = {"url": "/queries/int/-1000000"} # type: ignore + get_int_negative_one_million.metadata = {'url': '/queries/int/-1000000'} # type: ignore + @distributed_trace_async - async def get_int_null(self, int_query: Optional[int] = None, **kwargs: Any) -> None: + async def get_int_null( + self, + int_query: Optional[int] = None, + **kwargs: Any + ) -> None: """Get null integer value (no query parameter). :param int_query: null integer value. @@ -286,18 +301,25 @@ async def get_int_null(self, int_query: Optional[int] = None, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_null_request( int_query=int_query, - template_url=self.get_int_null.metadata["url"], + template_url=self.get_int_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -308,10 +330,14 @@ async def get_int_null(self, int_query: Optional[int] = None, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - get_int_null.metadata = {"url": "/queries/int/null"} # type: ignore + get_int_null.metadata = {'url': '/queries/int/null'} # type: ignore + @distributed_trace_async - async def get_ten_billion(self, **kwargs: Any) -> None: + async def get_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '10000000000' 64 bit integer value. :keyword long_query: '10000000000' 64 bit integer value. The default value is 10000000000. Note @@ -322,20 +348,27 @@ async def get_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", 10000000000) # type: int + long_query = kwargs.pop('long_query', 10000000000) # type: int + request = build_get_ten_billion_request( long_query=long_query, - template_url=self.get_ten_billion.metadata["url"], + template_url=self.get_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -346,10 +379,14 @@ async def get_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_ten_billion.metadata = {"url": "/queries/long/10000000000"} # type: ignore + get_ten_billion.metadata = {'url': '/queries/long/10000000000'} # type: ignore + @distributed_trace_async - async def get_negative_ten_billion(self, **kwargs: Any) -> None: + async def get_negative_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '-10000000000' 64 bit integer value. :keyword long_query: '-10000000000' 64 bit integer value. The default value is -10000000000. @@ -360,20 +397,27 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", -10000000000) # type: int + long_query = kwargs.pop('long_query', -10000000000) # type: int + request = build_get_negative_ten_billion_request( long_query=long_query, - template_url=self.get_negative_ten_billion.metadata["url"], + template_url=self.get_negative_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -384,10 +428,15 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_negative_ten_billion.metadata = {"url": "/queries/long/-10000000000"} # type: ignore + get_negative_ten_billion.metadata = {'url': '/queries/long/-10000000000'} # type: ignore + @distributed_trace_async - async def get_long_null(self, long_query: Optional[int] = None, **kwargs: Any) -> None: + async def get_long_null( + self, + long_query: Optional[int] = None, + **kwargs: Any + ) -> None: """Get 'null 64 bit integer value (no query param in uri). :param long_query: null 64 bit integer value. @@ -397,18 +446,25 @@ async def get_long_null(self, long_query: Optional[int] = None, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_null_request( long_query=long_query, - template_url=self.get_long_null.metadata["url"], + template_url=self.get_long_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -419,10 +475,14 @@ async def get_long_null(self, long_query: Optional[int] = None, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - get_long_null.metadata = {"url": "/queries/long/null"} # type: ignore + get_long_null.metadata = {'url': '/queries/long/null'} # type: ignore + @distributed_trace_async - async def float_scientific_positive(self, **kwargs: Any) -> None: + async def float_scientific_positive( + self, + **kwargs: Any + ) -> None: """Get '1.034E+20' numeric value. :keyword float_query: '1.034E+20'numeric value. The default value is 103400000000000000000. @@ -433,20 +493,27 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", 103400000000000000000) # type: float + float_query = kwargs.pop('float_query', 103400000000000000000) # type: float + request = build_float_scientific_positive_request( float_query=float_query, - template_url=self.float_scientific_positive.metadata["url"], + template_url=self.float_scientific_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -457,10 +524,14 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - float_scientific_positive.metadata = {"url": "/queries/float/1.034E+20"} # type: ignore + float_scientific_positive.metadata = {'url': '/queries/float/1.034E+20'} # type: ignore + @distributed_trace_async - async def float_scientific_negative(self, **kwargs: Any) -> None: + async def float_scientific_negative( + self, + **kwargs: Any + ) -> None: """Get '-1.034E-20' numeric value. :keyword float_query: '-1.034E-20'numeric value. The default value is -1.034e-20. Note that @@ -471,20 +542,27 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", -1.034e-20) # type: float + float_query = kwargs.pop('float_query', -1.034e-20) # type: float + request = build_float_scientific_negative_request( float_query=float_query, - template_url=self.float_scientific_negative.metadata["url"], + template_url=self.float_scientific_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -495,10 +573,15 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - float_scientific_negative.metadata = {"url": "/queries/float/-1.034E-20"} # type: ignore + float_scientific_negative.metadata = {'url': '/queries/float/-1.034E-20'} # type: ignore + @distributed_trace_async - async def float_null(self, float_query: Optional[float] = None, **kwargs: Any) -> None: + async def float_null( + self, + float_query: Optional[float] = None, + **kwargs: Any + ) -> None: """Get null numeric value (no query parameter). :param float_query: null numeric value. @@ -508,18 +591,25 @@ async def float_null(self, float_query: Optional[float] = None, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_float_null_request( float_query=float_query, - template_url=self.float_null.metadata["url"], + template_url=self.float_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -530,10 +620,14 @@ async def float_null(self, float_query: Optional[float] = None, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - float_null.metadata = {"url": "/queries/float/null"} # type: ignore + float_null.metadata = {'url': '/queries/float/null'} # type: ignore + @distributed_trace_async - async def double_decimal_positive(self, **kwargs: Any) -> None: + async def double_decimal_positive( + self, + **kwargs: Any + ) -> None: """Get '9999999.999' numeric value. :keyword double_query: '9999999.999'numeric value. The default value is 9999999.999. Note that @@ -544,20 +638,27 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", 9999999.999) # type: float + double_query = kwargs.pop('double_query', 9999999.999) # type: float + request = build_double_decimal_positive_request( double_query=double_query, - template_url=self.double_decimal_positive.metadata["url"], + template_url=self.double_decimal_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -568,10 +669,14 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - double_decimal_positive.metadata = {"url": "/queries/double/9999999.999"} # type: ignore + double_decimal_positive.metadata = {'url': '/queries/double/9999999.999'} # type: ignore + @distributed_trace_async - async def double_decimal_negative(self, **kwargs: Any) -> None: + async def double_decimal_negative( + self, + **kwargs: Any + ) -> None: """Get '-9999999.999' numeric value. :keyword double_query: '-9999999.999'numeric value. The default value is -9999999.999. Note @@ -582,20 +687,27 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", -9999999.999) # type: float + double_query = kwargs.pop('double_query', -9999999.999) # type: float + request = build_double_decimal_negative_request( double_query=double_query, - template_url=self.double_decimal_negative.metadata["url"], + template_url=self.double_decimal_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,10 +718,15 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - double_decimal_negative.metadata = {"url": "/queries/double/-9999999.999"} # type: ignore + double_decimal_negative.metadata = {'url': '/queries/double/-9999999.999'} # type: ignore + @distributed_trace_async - async def double_null(self, double_query: Optional[float] = None, **kwargs: Any) -> None: + async def double_null( + self, + double_query: Optional[float] = None, + **kwargs: Any + ) -> None: """Get null numeric value (no query parameter). :param double_query: null numeric value. @@ -619,18 +736,25 @@ async def double_null(self, double_query: Optional[float] = None, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_double_null_request( double_query=double_query, - template_url=self.double_null.metadata["url"], + template_url=self.double_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,10 +765,14 @@ async def double_null(self, double_query: Optional[float] = None, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - double_null.metadata = {"url": "/queries/double/null"} # type: ignore + double_null.metadata = {'url': '/queries/double/null'} # type: ignore + @distributed_trace_async - async def string_unicode(self, **kwargs: Any) -> None: + async def string_unicode( + self, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. :keyword string_query: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. The default value is "啊齄丂狛狜隣郎隣兀﨩". @@ -655,20 +783,27 @@ async def string_unicode(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_query = kwargs.pop('string_query', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_string_unicode_request( string_query=string_query, - template_url=self.string_unicode.metadata["url"], + template_url=self.string_unicode.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -679,10 +814,14 @@ async def string_unicode(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_unicode.metadata = {"url": "/queries/string/unicode/"} # type: ignore + string_unicode.metadata = {'url': '/queries/string/unicode/'} # type: ignore + @distributed_trace_async - async def string_url_encoded(self, **kwargs: Any) -> None: + async def string_url_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@ &=+$,/?#[]end. :keyword string_query: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. The default @@ -694,20 +833,27 @@ async def string_url_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_query = kwargs.pop('string_query', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_string_url_encoded_request( string_query=string_query, - template_url=self.string_url_encoded.metadata["url"], + template_url=self.string_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -718,10 +864,14 @@ async def string_url_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_url_encoded.metadata = {"url": "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend"} # type: ignore + string_url_encoded.metadata = {'url': '/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend'} # type: ignore + @distributed_trace_async - async def string_empty(self, **kwargs: Any) -> None: + async def string_empty( + self, + **kwargs: Any + ) -> None: """Get ''. :keyword string_query: '' string value. The default value is "". Note that overriding this @@ -732,20 +882,27 @@ async def string_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "") # type: str + string_query = kwargs.pop('string_query', "") # type: str + request = build_string_empty_request( string_query=string_query, - template_url=self.string_empty.metadata["url"], + template_url=self.string_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -756,10 +913,15 @@ async def string_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - string_empty.metadata = {"url": "/queries/string/empty"} # type: ignore + string_empty.metadata = {'url': '/queries/string/empty'} # type: ignore + @distributed_trace_async - async def string_null(self, string_query: Optional[str] = None, **kwargs: Any) -> None: + async def string_null( + self, + string_query: Optional[str] = None, + **kwargs: Any + ) -> None: """Get null (no query parameter in url). :param string_query: null string value. @@ -769,18 +931,25 @@ async def string_null(self, string_query: Optional[str] = None, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_string_null_request( string_query=string_query, - template_url=self.string_null.metadata["url"], + template_url=self.string_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -791,10 +960,15 @@ async def string_null(self, string_query: Optional[str] = None, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) - string_null.metadata = {"url": "/queries/string/null"} # type: ignore + string_null.metadata = {'url': '/queries/string/null'} # type: ignore + @distributed_trace_async - async def enum_valid(self, enum_query: Optional[Union[str, "_models.UriColor"]] = None, **kwargs: Any) -> None: + async def enum_valid( + self, + enum_query: Optional[Union[str, "_models.UriColor"]] = None, + **kwargs: Any + ) -> None: """Get using uri with query parameter 'green color'. :param enum_query: 'green color' enum value. @@ -804,18 +978,25 @@ async def enum_valid(self, enum_query: Optional[Union[str, "_models.UriColor"]] :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_valid_request( enum_query=enum_query, - template_url=self.enum_valid.metadata["url"], + template_url=self.enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -826,10 +1007,15 @@ async def enum_valid(self, enum_query: Optional[Union[str, "_models.UriColor"]] if cls: return cls(pipeline_response, None, {}) - enum_valid.metadata = {"url": "/queries/enum/green%20color"} # type: ignore + enum_valid.metadata = {'url': '/queries/enum/green%20color'} # type: ignore + @distributed_trace_async - async def enum_null(self, enum_query: Optional[Union[str, "_models.UriColor"]] = None, **kwargs: Any) -> None: + async def enum_null( + self, + enum_query: Optional[Union[str, "_models.UriColor"]] = None, + **kwargs: Any + ) -> None: """Get null (no query parameter in url). :param enum_query: null string value. @@ -839,18 +1025,25 @@ async def enum_null(self, enum_query: Optional[Union[str, "_models.UriColor"]] = :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_null_request( enum_query=enum_query, - template_url=self.enum_null.metadata["url"], + template_url=self.enum_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -861,10 +1054,15 @@ async def enum_null(self, enum_query: Optional[Union[str, "_models.UriColor"]] = if cls: return cls(pipeline_response, None, {}) - enum_null.metadata = {"url": "/queries/enum/null"} # type: ignore + enum_null.metadata = {'url': '/queries/enum/null'} # type: ignore + @distributed_trace_async - async def byte_multi_byte(self, byte_query: Optional[bytearray] = None, **kwargs: Any) -> None: + async def byte_multi_byte( + self, + byte_query: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. :param byte_query: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. @@ -874,18 +1072,25 @@ async def byte_multi_byte(self, byte_query: Optional[bytearray] = None, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_multi_byte_request( byte_query=byte_query, - template_url=self.byte_multi_byte.metadata["url"], + template_url=self.byte_multi_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -896,10 +1101,14 @@ async def byte_multi_byte(self, byte_query: Optional[bytearray] = None, **kwargs if cls: return cls(pipeline_response, None, {}) - byte_multi_byte.metadata = {"url": "/queries/byte/multibyte"} # type: ignore + byte_multi_byte.metadata = {'url': '/queries/byte/multibyte'} # type: ignore + @distributed_trace_async - async def byte_empty(self, **kwargs: Any) -> None: + async def byte_empty( + self, + **kwargs: Any + ) -> None: """Get '' as byte array. :keyword byte_query: '' as byte array. The default value is bytearray("", encoding="utf-8"). @@ -910,20 +1119,27 @@ async def byte_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_query = kwargs.pop("byte_query", bytearray("", encoding="utf-8")) # type: bytearray + byte_query = kwargs.pop('byte_query', bytearray("", encoding="utf-8")) # type: bytearray + request = build_byte_empty_request( byte_query=byte_query, - template_url=self.byte_empty.metadata["url"], + template_url=self.byte_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -934,10 +1150,15 @@ async def byte_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - byte_empty.metadata = {"url": "/queries/byte/empty"} # type: ignore + byte_empty.metadata = {'url': '/queries/byte/empty'} # type: ignore + @distributed_trace_async - async def byte_null(self, byte_query: Optional[bytearray] = None, **kwargs: Any) -> None: + async def byte_null( + self, + byte_query: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Get null as byte array (no query parameters in uri). :param byte_query: null as byte array (no query parameters in uri). @@ -947,18 +1168,25 @@ async def byte_null(self, byte_query: Optional[bytearray] = None, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_null_request( byte_query=byte_query, - template_url=self.byte_null.metadata["url"], + template_url=self.byte_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -969,10 +1197,14 @@ async def byte_null(self, byte_query: Optional[bytearray] = None, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - byte_null.metadata = {"url": "/queries/byte/null"} # type: ignore + byte_null.metadata = {'url': '/queries/byte/null'} # type: ignore + @distributed_trace_async - async def date_valid(self, **kwargs: Any) -> None: + async def date_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01' as date. :keyword date_query: '2012-01-01' as date. The default value is "2012-01-01". Note that @@ -983,20 +1215,27 @@ async def date_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_query = kwargs.pop("date_query", "2012-01-01") # type: datetime.date + date_query = kwargs.pop('date_query', "2012-01-01") # type: datetime.date + request = build_date_valid_request( date_query=date_query, - template_url=self.date_valid.metadata["url"], + template_url=self.date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1007,10 +1246,15 @@ async def date_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - date_valid.metadata = {"url": "/queries/date/2012-01-01"} # type: ignore + date_valid.metadata = {'url': '/queries/date/2012-01-01'} # type: ignore + @distributed_trace_async - async def date_null(self, date_query: Optional[datetime.date] = None, **kwargs: Any) -> None: + async def date_null( + self, + date_query: Optional[datetime.date] = None, + **kwargs: Any + ) -> None: """Get null as date - this should result in no query parameters in uri. :param date_query: null as date (no query parameters in uri). @@ -1020,18 +1264,25 @@ async def date_null(self, date_query: Optional[datetime.date] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_null_request( date_query=date_query, - template_url=self.date_null.metadata["url"], + template_url=self.date_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1042,10 +1293,14 @@ async def date_null(self, date_query: Optional[datetime.date] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) - date_null.metadata = {"url": "/queries/date/null"} # type: ignore + date_null.metadata = {'url': '/queries/date/null'} # type: ignore + @distributed_trace_async - async def date_time_valid(self, **kwargs: Any) -> None: + async def date_time_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01T01:01:01Z' as date-time. :keyword date_time_query: '2012-01-01T01:01:01Z' as date-time. The default value is @@ -1057,20 +1312,27 @@ async def date_time_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_query = kwargs.pop("date_time_query", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_query = kwargs.pop('date_time_query', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_date_time_valid_request( date_time_query=date_time_query, - template_url=self.date_time_valid.metadata["url"], + template_url=self.date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1081,10 +1343,15 @@ async def date_time_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - date_time_valid.metadata = {"url": "/queries/datetime/2012-01-01T01%3A01%3A01Z"} # type: ignore + date_time_valid.metadata = {'url': '/queries/datetime/2012-01-01T01%3A01%3A01Z'} # type: ignore + @distributed_trace_async - async def date_time_null(self, date_time_query: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + async def date_time_null( + self, + date_time_query: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """Get null as date-time, should result in no query parameters in uri. :param date_time_query: null as date-time (no query parameters). @@ -1094,18 +1361,25 @@ async def date_time_null(self, date_time_query: Optional[datetime.datetime] = No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_time_null_request( date_time_query=date_time_query, - template_url=self.date_time_null.metadata["url"], + template_url=self.date_time_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1116,10 +1390,15 @@ async def date_time_null(self, date_time_query: Optional[datetime.datetime] = No if cls: return cls(pipeline_response, None, {}) - date_time_null.metadata = {"url": "/queries/datetime/null"} # type: ignore + date_time_null.metadata = {'url': '/queries/datetime/null'} # type: ignore + @distributed_trace_async - async def array_string_csv_valid(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_csv_valid( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -1131,18 +1410,25 @@ async def array_string_csv_valid(self, array_query: Optional[List[str]] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_csv_valid_request( array_query=array_query, - template_url=self.array_string_csv_valid.metadata["url"], + template_url=self.array_string_csv_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1153,10 +1439,15 @@ async def array_string_csv_valid(self, array_query: Optional[List[str]] = None, if cls: return cls(pipeline_response, None, {}) - array_string_csv_valid.metadata = {"url": "/queries/array/csv/string/valid"} # type: ignore + array_string_csv_valid.metadata = {'url': '/queries/array/csv/string/valid'} # type: ignore + @distributed_trace_async - async def array_string_csv_null(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_csv_null( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get a null array of string using the csv-array format. :param array_query: a null array of string using the csv-array format. @@ -1166,18 +1457,25 @@ async def array_string_csv_null(self, array_query: Optional[List[str]] = None, * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_csv_null_request( array_query=array_query, - template_url=self.array_string_csv_null.metadata["url"], + template_url=self.array_string_csv_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1188,10 +1486,15 @@ async def array_string_csv_null(self, array_query: Optional[List[str]] = None, * if cls: return cls(pipeline_response, None, {}) - array_string_csv_null.metadata = {"url": "/queries/array/csv/string/null"} # type: ignore + array_string_csv_null.metadata = {'url': '/queries/array/csv/string/null'} # type: ignore + @distributed_trace_async - async def array_string_csv_empty(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_csv_empty( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an empty array [] of string using the csv-array format. :param array_query: an empty array [] of string using the csv-array format. @@ -1201,18 +1504,25 @@ async def array_string_csv_empty(self, array_query: Optional[List[str]] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_csv_empty_request( array_query=array_query, - template_url=self.array_string_csv_empty.metadata["url"], + template_url=self.array_string_csv_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1223,11 +1533,14 @@ async def array_string_csv_empty(self, array_query: Optional[List[str]] = None, if cls: return cls(pipeline_response, None, {}) - array_string_csv_empty.metadata = {"url": "/queries/array/csv/string/empty"} # type: ignore + array_string_csv_empty.metadata = {'url': '/queries/array/csv/string/empty'} # type: ignore + @distributed_trace_async async def array_string_no_collection_format_empty( - self, array_query: Optional[List[str]] = None, **kwargs: Any + self, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> None: """Array query has no defined collection format, should default to csv. Pass in ['hello', 'nihao', 'bonjour'] for the 'arrayQuery' parameter to the service. @@ -1239,18 +1552,25 @@ async def array_string_no_collection_format_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_no_collection_format_empty_request( array_query=array_query, - template_url=self.array_string_no_collection_format_empty.metadata["url"], + template_url=self.array_string_no_collection_format_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1261,10 +1581,15 @@ async def array_string_no_collection_format_empty( if cls: return cls(pipeline_response, None, {}) - array_string_no_collection_format_empty.metadata = {"url": "/queries/array/none/string/empty"} # type: ignore + array_string_no_collection_format_empty.metadata = {'url': '/queries/array/none/string/empty'} # type: ignore + @distributed_trace_async - async def array_string_ssv_valid(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_ssv_valid( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format. @@ -1276,18 +1601,25 @@ async def array_string_ssv_valid(self, array_query: Optional[List[str]] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_ssv_valid_request( array_query=array_query, - template_url=self.array_string_ssv_valid.metadata["url"], + template_url=self.array_string_ssv_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1298,10 +1630,15 @@ async def array_string_ssv_valid(self, array_query: Optional[List[str]] = None, if cls: return cls(pipeline_response, None, {}) - array_string_ssv_valid.metadata = {"url": "/queries/array/ssv/string/valid"} # type: ignore + array_string_ssv_valid.metadata = {'url': '/queries/array/ssv/string/valid'} # type: ignore + @distributed_trace_async - async def array_string_tsv_valid(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_tsv_valid( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format. @@ -1313,18 +1650,25 @@ async def array_string_tsv_valid(self, array_query: Optional[List[str]] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_tsv_valid_request( array_query=array_query, - template_url=self.array_string_tsv_valid.metadata["url"], + template_url=self.array_string_tsv_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1335,10 +1679,15 @@ async def array_string_tsv_valid(self, array_query: Optional[List[str]] = None, if cls: return cls(pipeline_response, None, {}) - array_string_tsv_valid.metadata = {"url": "/queries/array/tsv/string/valid"} # type: ignore + array_string_tsv_valid.metadata = {'url': '/queries/array/tsv/string/valid'} # type: ignore + @distributed_trace_async - async def array_string_pipes_valid(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_pipes_valid( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format. @@ -1350,18 +1699,25 @@ async def array_string_pipes_valid(self, array_query: Optional[List[str]] = None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_pipes_valid_request( array_query=array_query, - template_url=self.array_string_pipes_valid.metadata["url"], + template_url=self.array_string_pipes_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1372,4 +1728,5 @@ async def array_string_pipes_valid(self, array_query: Optional[List[str]] = None if cls: return cls(pipeline_response, None, {}) - array_string_pipes_valid.metadata = {"url": "/queries/array/pipes/string/valid"} # type: ignore + array_string_pipes_valid.metadata = {'url': '/queries/array/pipes/string/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py index c8cf743232c..ca176faddf6 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py @@ -16,6 +16,6 @@ ) __all__ = [ - "Error", - "UriColor", + 'Error', + 'UriColor', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/__init__.py index 293199669de..8d46687d7c1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/__init__.py @@ -11,7 +11,7 @@ from ._path_items_operations import PathItemsOperations __all__ = [ - "PathsOperations", - "QueriesOperations", - "PathItemsOperations", + 'PathsOperations', + 'QueriesOperations', + 'PathItemsOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py index 1194ab13d99..74098b0536d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -48,7 +40,7 @@ def build_get_all_with_values_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery') + url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery') # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -92,7 +84,7 @@ def build_get_global_query_null_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery') + url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery') # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -136,7 +128,7 @@ def build_get_global_and_local_query_null_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null') + url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null') # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -180,7 +172,7 @@ def build_get_local_path_item_query_null_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null') + url = kwargs.pop("template_url", '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null') # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -261,10 +253,13 @@ def get_all_with_values( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_all_with_values_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -272,12 +267,16 @@ def get_all_with_values( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_all_with_values.metadata["url"], + template_url=self.get_all_with_values.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -288,7 +287,8 @@ def get_all_with_values( if cls: return cls(pipeline_response, None, {}) - get_all_with_values.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery"} # type: ignore + get_all_with_values.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery'} # type: ignore + @distributed_trace def get_global_query_null( @@ -318,10 +318,13 @@ def get_global_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_global_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -329,12 +332,16 @@ def get_global_query_null( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_global_query_null.metadata["url"], + template_url=self.get_global_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -345,7 +352,8 @@ def get_global_query_null( if cls: return cls(pipeline_response, None, {}) - get_global_query_null.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery"} # type: ignore + get_global_query_null.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery'} # type: ignore + @distributed_trace def get_global_and_local_query_null( @@ -375,10 +383,13 @@ def get_global_and_local_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_global_and_local_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -386,12 +397,16 @@ def get_global_and_local_query_null( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_global_and_local_query_null.metadata["url"], + template_url=self.get_global_and_local_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -402,7 +417,8 @@ def get_global_and_local_query_null( if cls: return cls(pipeline_response, None, {}) - get_global_and_local_query_null.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null"} # type: ignore + get_global_and_local_query_null.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null'} # type: ignore + @distributed_trace def get_local_path_item_query_null( @@ -431,10 +447,13 @@ def get_local_path_item_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_local_path_item_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -442,12 +461,16 @@ def get_local_path_item_query_null( path_item_string_query=path_item_string_query, global_string_query=self._config.global_string_query, local_string_query=local_string_query, - template_url=self.get_local_path_item_query_null.metadata["url"], + template_url=self.get_local_path_item_query_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,4 +481,5 @@ def get_local_path_item_query_null( if cls: return cls(pipeline_response, None, {}) - get_local_path_item_query_null.metadata = {"url": "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null"} # type: ignore + get_local_path_item_query_null.metadata = {'url': '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py index aa416f9a66f..b60b95b1da1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -341,7 +333,7 @@ def build_string_url_encoded_request( accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}') + url = kwargs.pop("template_url", '/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}') # pylint: disable=line-too-long path_format_arguments = { "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } @@ -710,7 +702,7 @@ def build_array_csv_in_path_request( # type: (...) -> HttpRequest accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}') + url = kwargs.pop("template_url", '/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}') # pylint: disable=line-too-long path_format_arguments = { "arrayPath": _SERIALIZER.url("array_path", array_path, '[str]', div=','), } @@ -755,7 +747,7 @@ def build_unix_time_url_request( ) # fmt: on -class PathsOperations(object): +class PathsOperations(object): # pylint: disable=too-many-public-methods """PathsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -779,7 +771,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_boolean_true( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get true Boolean value on path. @@ -792,20 +785,27 @@ def get_boolean_true( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", True) # type: bool + bool_path = kwargs.pop('bool_path', True) # type: bool + request = build_get_boolean_true_request( bool_path=bool_path, - template_url=self.get_boolean_true.metadata["url"], + template_url=self.get_boolean_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,11 +816,13 @@ def get_boolean_true( if cls: return cls(pipeline_response, None, {}) - get_boolean_true.metadata = {"url": "/paths/bool/true/{boolPath}"} # type: ignore + get_boolean_true.metadata = {'url': '/paths/bool/true/{boolPath}'} # type: ignore + @distributed_trace def get_boolean_false( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get false Boolean value on path. @@ -833,20 +835,27 @@ def get_boolean_false( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", False) # type: bool + bool_path = kwargs.pop('bool_path', False) # type: bool + request = build_get_boolean_false_request( bool_path=bool_path, - template_url=self.get_boolean_false.metadata["url"], + template_url=self.get_boolean_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -857,11 +866,13 @@ def get_boolean_false( if cls: return cls(pipeline_response, None, {}) - get_boolean_false.metadata = {"url": "/paths/bool/false/{boolPath}"} # type: ignore + get_boolean_false.metadata = {'url': '/paths/bool/false/{boolPath}'} # type: ignore + @distributed_trace def get_int_one_million( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '1000000' integer value. @@ -874,20 +885,27 @@ def get_int_one_million( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", 1000000) # type: int + int_path = kwargs.pop('int_path', 1000000) # type: int + request = build_get_int_one_million_request( int_path=int_path, - template_url=self.get_int_one_million.metadata["url"], + template_url=self.get_int_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -898,11 +916,13 @@ def get_int_one_million( if cls: return cls(pipeline_response, None, {}) - get_int_one_million.metadata = {"url": "/paths/int/1000000/{intPath}"} # type: ignore + get_int_one_million.metadata = {'url': '/paths/int/1000000/{intPath}'} # type: ignore + @distributed_trace def get_int_negative_one_million( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-1000000' integer value. @@ -915,20 +935,27 @@ def get_int_negative_one_million( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", -1000000) # type: int + int_path = kwargs.pop('int_path', -1000000) # type: int + request = build_get_int_negative_one_million_request( int_path=int_path, - template_url=self.get_int_negative_one_million.metadata["url"], + template_url=self.get_int_negative_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -939,11 +966,13 @@ def get_int_negative_one_million( if cls: return cls(pipeline_response, None, {}) - get_int_negative_one_million.metadata = {"url": "/paths/int/-1000000/{intPath}"} # type: ignore + get_int_negative_one_million.metadata = {'url': '/paths/int/-1000000/{intPath}'} # type: ignore + @distributed_trace def get_ten_billion( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '10000000000' 64 bit integer value. @@ -956,20 +985,27 @@ def get_ten_billion( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", 10000000000) # type: int + long_path = kwargs.pop('long_path', 10000000000) # type: int + request = build_get_ten_billion_request( long_path=long_path, - template_url=self.get_ten_billion.metadata["url"], + template_url=self.get_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -980,11 +1016,13 @@ def get_ten_billion( if cls: return cls(pipeline_response, None, {}) - get_ten_billion.metadata = {"url": "/paths/long/10000000000/{longPath}"} # type: ignore + get_ten_billion.metadata = {'url': '/paths/long/10000000000/{longPath}'} # type: ignore + @distributed_trace def get_negative_ten_billion( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-10000000000' 64 bit integer value. @@ -997,20 +1035,27 @@ def get_negative_ten_billion( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", -10000000000) # type: int + long_path = kwargs.pop('long_path', -10000000000) # type: int + request = build_get_negative_ten_billion_request( long_path=long_path, - template_url=self.get_negative_ten_billion.metadata["url"], + template_url=self.get_negative_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1021,11 +1066,13 @@ def get_negative_ten_billion( if cls: return cls(pipeline_response, None, {}) - get_negative_ten_billion.metadata = {"url": "/paths/long/-10000000000/{longPath}"} # type: ignore + get_negative_ten_billion.metadata = {'url': '/paths/long/-10000000000/{longPath}'} # type: ignore + @distributed_trace def float_scientific_positive( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '1.034E+20' numeric value. @@ -1038,20 +1085,27 @@ def float_scientific_positive( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", 103400000000000000000) # type: float + float_path = kwargs.pop('float_path', 103400000000000000000) # type: float + request = build_float_scientific_positive_request( float_path=float_path, - template_url=self.float_scientific_positive.metadata["url"], + template_url=self.float_scientific_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1062,11 +1116,13 @@ def float_scientific_positive( if cls: return cls(pipeline_response, None, {}) - float_scientific_positive.metadata = {"url": "/paths/float/1.034E+20/{floatPath}"} # type: ignore + float_scientific_positive.metadata = {'url': '/paths/float/1.034E+20/{floatPath}'} # type: ignore + @distributed_trace def float_scientific_negative( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-1.034E-20' numeric value. @@ -1079,20 +1135,27 @@ def float_scientific_negative( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", -1.034e-20) # type: float + float_path = kwargs.pop('float_path', -1.034e-20) # type: float + request = build_float_scientific_negative_request( float_path=float_path, - template_url=self.float_scientific_negative.metadata["url"], + template_url=self.float_scientific_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1103,11 +1166,13 @@ def float_scientific_negative( if cls: return cls(pipeline_response, None, {}) - float_scientific_negative.metadata = {"url": "/paths/float/-1.034E-20/{floatPath}"} # type: ignore + float_scientific_negative.metadata = {'url': '/paths/float/-1.034E-20/{floatPath}'} # type: ignore + @distributed_trace def double_decimal_positive( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '9999999.999' numeric value. @@ -1120,20 +1185,27 @@ def double_decimal_positive( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", 9999999.999) # type: float + double_path = kwargs.pop('double_path', 9999999.999) # type: float + request = build_double_decimal_positive_request( double_path=double_path, - template_url=self.double_decimal_positive.metadata["url"], + template_url=self.double_decimal_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1144,11 +1216,13 @@ def double_decimal_positive( if cls: return cls(pipeline_response, None, {}) - double_decimal_positive.metadata = {"url": "/paths/double/9999999.999/{doublePath}"} # type: ignore + double_decimal_positive.metadata = {'url': '/paths/double/9999999.999/{doublePath}'} # type: ignore + @distributed_trace def double_decimal_negative( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-9999999.999' numeric value. @@ -1161,20 +1235,27 @@ def double_decimal_negative( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", -9999999.999) # type: float + double_path = kwargs.pop('double_path', -9999999.999) # type: float + request = build_double_decimal_negative_request( double_path=double_path, - template_url=self.double_decimal_negative.metadata["url"], + template_url=self.double_decimal_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1185,11 +1266,13 @@ def double_decimal_negative( if cls: return cls(pipeline_response, None, {}) - double_decimal_negative.metadata = {"url": "/paths/double/-9999999.999/{doublePath}"} # type: ignore + double_decimal_negative.metadata = {'url': '/paths/double/-9999999.999/{doublePath}'} # type: ignore + @distributed_trace def string_unicode( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. @@ -1202,20 +1285,27 @@ def string_unicode( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_string_unicode_request( string_path=string_path, - template_url=self.string_unicode.metadata["url"], + template_url=self.string_unicode.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1226,11 +1316,13 @@ def string_unicode( if cls: return cls(pipeline_response, None, {}) - string_unicode.metadata = {"url": "/paths/string/unicode/{stringPath}"} # type: ignore + string_unicode.metadata = {'url': '/paths/string/unicode/{stringPath}'} # type: ignore + @distributed_trace def string_url_encoded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get 'begin!*'();:@ &=+$,/?#[]end. @@ -1244,20 +1336,27 @@ def string_url_encoded( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_string_url_encoded_request( string_path=string_path, - template_url=self.string_url_encoded.metadata["url"], + template_url=self.string_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1268,11 +1367,13 @@ def string_url_encoded( if cls: return cls(pipeline_response, None, {}) - string_url_encoded.metadata = {"url": "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}"} # type: ignore + string_url_encoded.metadata = {'url': '/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}'} # type: ignore + @distributed_trace def string_url_non_encoded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get 'begin!*'();:@&=+$,end. @@ -1288,20 +1389,27 @@ def string_url_non_encoded( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@&=+$,end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str + request = build_string_url_non_encoded_request( string_path=string_path, - template_url=self.string_url_non_encoded.metadata["url"], + template_url=self.string_url_non_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1312,11 +1420,13 @@ def string_url_non_encoded( if cls: return cls(pipeline_response, None, {}) - string_url_non_encoded.metadata = {"url": "/paths/string/begin!*'();:@&=+$,end/{stringPath}"} # type: ignore + string_url_non_encoded.metadata = {'url': '/paths/string/begin!*\'();:@&=+$,end/{stringPath}'} # type: ignore + @distributed_trace def string_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get ''. @@ -1329,20 +1439,27 @@ def string_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "") # type: str + string_path = kwargs.pop('string_path', "") # type: str + request = build_string_empty_request( string_path=string_path, - template_url=self.string_empty.metadata["url"], + template_url=self.string_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1353,7 +1470,8 @@ def string_empty( if cls: return cls(pipeline_response, None, {}) - string_empty.metadata = {"url": "/paths/string/empty/{stringPath}"} # type: ignore + string_empty.metadata = {'url': '/paths/string/empty/{stringPath}'} # type: ignore + @distributed_trace def string_null( @@ -1371,18 +1489,25 @@ def string_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_string_null_request( string_path=string_path, - template_url=self.string_null.metadata["url"], + template_url=self.string_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -1393,7 +1518,8 @@ def string_null( if cls: return cls(pipeline_response, None, {}) - string_null.metadata = {"url": "/paths/string/null/{stringPath}"} # type: ignore + string_null.metadata = {'url': '/paths/string/null/{stringPath}'} # type: ignore + @distributed_trace def enum_valid( @@ -1411,18 +1537,25 @@ def enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_valid_request( enum_path=enum_path, - template_url=self.enum_valid.metadata["url"], + template_url=self.enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1433,7 +1566,8 @@ def enum_valid( if cls: return cls(pipeline_response, None, {}) - enum_valid.metadata = {"url": "/paths/enum/green%20color/{enumPath}"} # type: ignore + enum_valid.metadata = {'url': '/paths/enum/green%20color/{enumPath}'} # type: ignore + @distributed_trace def enum_null( @@ -1451,18 +1585,25 @@ def enum_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_null_request( enum_path=enum_path, - template_url=self.enum_null.metadata["url"], + template_url=self.enum_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -1473,7 +1614,8 @@ def enum_null( if cls: return cls(pipeline_response, None, {}) - enum_null.metadata = {"url": "/paths/string/null/{enumPath}"} # type: ignore + enum_null.metadata = {'url': '/paths/string/null/{enumPath}'} # type: ignore + @distributed_trace def byte_multi_byte( @@ -1491,18 +1633,25 @@ def byte_multi_byte( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_multi_byte_request( byte_path=byte_path, - template_url=self.byte_multi_byte.metadata["url"], + template_url=self.byte_multi_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1513,11 +1662,13 @@ def byte_multi_byte( if cls: return cls(pipeline_response, None, {}) - byte_multi_byte.metadata = {"url": "/paths/byte/multibyte/{bytePath}"} # type: ignore + byte_multi_byte.metadata = {'url': '/paths/byte/multibyte/{bytePath}'} # type: ignore + @distributed_trace def byte_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '' as byte array. @@ -1530,20 +1681,27 @@ def byte_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_path = kwargs.pop("byte_path", bytearray("", encoding="utf-8")) # type: bytearray + byte_path = kwargs.pop('byte_path', bytearray("", encoding="utf-8")) # type: bytearray + request = build_byte_empty_request( byte_path=byte_path, - template_url=self.byte_empty.metadata["url"], + template_url=self.byte_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1554,7 +1712,8 @@ def byte_empty( if cls: return cls(pipeline_response, None, {}) - byte_empty.metadata = {"url": "/paths/byte/empty/{bytePath}"} # type: ignore + byte_empty.metadata = {'url': '/paths/byte/empty/{bytePath}'} # type: ignore + @distributed_trace def byte_null( @@ -1572,18 +1731,25 @@ def byte_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_null_request( byte_path=byte_path, - template_url=self.byte_null.metadata["url"], + template_url=self.byte_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -1594,11 +1760,13 @@ def byte_null( if cls: return cls(pipeline_response, None, {}) - byte_null.metadata = {"url": "/paths/byte/null/{bytePath}"} # type: ignore + byte_null.metadata = {'url': '/paths/byte/null/{bytePath}'} # type: ignore + @distributed_trace def date_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '2012-01-01' as date. @@ -1611,20 +1779,27 @@ def date_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_path = kwargs.pop("date_path", "2012-01-01") # type: datetime.date + date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date + request = build_date_valid_request( date_path=date_path, - template_url=self.date_valid.metadata["url"], + template_url=self.date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1635,7 +1810,8 @@ def date_valid( if cls: return cls(pipeline_response, None, {}) - date_valid.metadata = {"url": "/paths/date/2012-01-01/{datePath}"} # type: ignore + date_valid.metadata = {'url': '/paths/date/2012-01-01/{datePath}'} # type: ignore + @distributed_trace def date_null( @@ -1654,18 +1830,25 @@ def date_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_null_request( date_path=date_path, - template_url=self.date_null.metadata["url"], + template_url=self.date_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -1676,11 +1859,13 @@ def date_null( if cls: return cls(pipeline_response, None, {}) - date_null.metadata = {"url": "/paths/date/null/{datePath}"} # type: ignore + date_null.metadata = {'url': '/paths/date/null/{datePath}'} # type: ignore + @distributed_trace def date_time_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '2012-01-01T01:01:01Z' as date-time. @@ -1694,20 +1879,27 @@ def date_time_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_path = kwargs.pop("date_time_path", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_date_time_valid_request( date_time_path=date_time_path, - template_url=self.date_time_valid.metadata["url"], + template_url=self.date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1718,7 +1910,8 @@ def date_time_valid( if cls: return cls(pipeline_response, None, {}) - date_time_valid.metadata = {"url": "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}"} # type: ignore + date_time_valid.metadata = {'url': '/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}'} # type: ignore + @distributed_trace def date_time_null( @@ -1736,18 +1929,25 @@ def date_time_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_time_null_request( date_time_path=date_time_path, - template_url=self.date_time_null.metadata["url"], + template_url=self.date_time_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [400]: @@ -1758,7 +1958,8 @@ def date_time_null( if cls: return cls(pipeline_response, None, {}) - date_time_null.metadata = {"url": "/paths/datetime/null/{dateTimePath}"} # type: ignore + date_time_null.metadata = {'url': '/paths/datetime/null/{dateTimePath}'} # type: ignore + @distributed_trace def base64_url( @@ -1776,18 +1977,25 @@ def base64_url( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_base64_url_request( base64_url_path=base64_url_path, - template_url=self.base64_url.metadata["url"], + template_url=self.base64_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1798,7 +2006,8 @@ def base64_url( if cls: return cls(pipeline_response, None, {}) - base64_url.metadata = {"url": "/paths/string/bG9yZW0/{base64UrlPath}"} # type: ignore + base64_url.metadata = {'url': '/paths/string/bG9yZW0/{base64UrlPath}'} # type: ignore + @distributed_trace def array_csv_in_path( @@ -1818,18 +2027,25 @@ def array_csv_in_path( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_csv_in_path_request( array_path=array_path, - template_url=self.array_csv_in_path.metadata["url"], + template_url=self.array_csv_in_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1840,7 +2056,8 @@ def array_csv_in_path( if cls: return cls(pipeline_response, None, {}) - array_csv_in_path.metadata = {"url": "/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}"} # type: ignore + array_csv_in_path.metadata = {'url': '/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}'} # type: ignore + @distributed_trace def unix_time_url( @@ -1858,18 +2075,25 @@ def unix_time_url( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_unix_time_url_request( unix_time_url_path=unix_time_url_path, - template_url=self.unix_time_url.metadata["url"], + template_url=self.unix_time_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1880,4 +2104,5 @@ def unix_time_url( if cls: return cls(pipeline_response, None, {}) - unix_time_url.metadata = {"url": "/paths/int/1460505600/{unixTimeUrlPath}"} # type: ignore + unix_time_url.metadata = {'url': '/paths/int/1460505600/{unixTimeUrlPath}'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py index 60d7929188a..43244f70c14 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,17 +7,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -28,9 +21,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -1000,7 +992,7 @@ def build_array_string_pipes_valid_request( ) # fmt: on -class QueriesOperations(object): +class QueriesOperations(object): # pylint: disable=too-many-public-methods """QueriesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -1024,7 +1016,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_boolean_true( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get true Boolean value on path. @@ -1037,20 +1030,27 @@ def get_boolean_true( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", True) # type: bool + bool_query = kwargs.pop('bool_query', True) # type: bool + request = build_get_boolean_true_request( bool_query=bool_query, - template_url=self.get_boolean_true.metadata["url"], + template_url=self.get_boolean_true.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1061,11 +1061,13 @@ def get_boolean_true( if cls: return cls(pipeline_response, None, {}) - get_boolean_true.metadata = {"url": "/queries/bool/true"} # type: ignore + get_boolean_true.metadata = {'url': '/queries/bool/true'} # type: ignore + @distributed_trace def get_boolean_false( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get false Boolean value on path. @@ -1078,20 +1080,27 @@ def get_boolean_false( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", False) # type: bool + bool_query = kwargs.pop('bool_query', False) # type: bool + request = build_get_boolean_false_request( bool_query=bool_query, - template_url=self.get_boolean_false.metadata["url"], + template_url=self.get_boolean_false.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1102,7 +1111,8 @@ def get_boolean_false( if cls: return cls(pipeline_response, None, {}) - get_boolean_false.metadata = {"url": "/queries/bool/false"} # type: ignore + get_boolean_false.metadata = {'url': '/queries/bool/false'} # type: ignore + @distributed_trace def get_boolean_null( @@ -1120,18 +1130,25 @@ def get_boolean_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_boolean_null_request( bool_query=bool_query, - template_url=self.get_boolean_null.metadata["url"], + template_url=self.get_boolean_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1142,11 +1159,13 @@ def get_boolean_null( if cls: return cls(pipeline_response, None, {}) - get_boolean_null.metadata = {"url": "/queries/bool/null"} # type: ignore + get_boolean_null.metadata = {'url': '/queries/bool/null'} # type: ignore + @distributed_trace def get_int_one_million( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '1000000' integer value. @@ -1159,20 +1178,27 @@ def get_int_one_million( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", 1000000) # type: int + int_query = kwargs.pop('int_query', 1000000) # type: int + request = build_get_int_one_million_request( int_query=int_query, - template_url=self.get_int_one_million.metadata["url"], + template_url=self.get_int_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1183,11 +1209,13 @@ def get_int_one_million( if cls: return cls(pipeline_response, None, {}) - get_int_one_million.metadata = {"url": "/queries/int/1000000"} # type: ignore + get_int_one_million.metadata = {'url': '/queries/int/1000000'} # type: ignore + @distributed_trace def get_int_negative_one_million( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-1000000' integer value. @@ -1200,20 +1228,27 @@ def get_int_negative_one_million( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", -1000000) # type: int + int_query = kwargs.pop('int_query', -1000000) # type: int + request = build_get_int_negative_one_million_request( int_query=int_query, - template_url=self.get_int_negative_one_million.metadata["url"], + template_url=self.get_int_negative_one_million.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1224,7 +1259,8 @@ def get_int_negative_one_million( if cls: return cls(pipeline_response, None, {}) - get_int_negative_one_million.metadata = {"url": "/queries/int/-1000000"} # type: ignore + get_int_negative_one_million.metadata = {'url': '/queries/int/-1000000'} # type: ignore + @distributed_trace def get_int_null( @@ -1242,18 +1278,25 @@ def get_int_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_int_null_request( int_query=int_query, - template_url=self.get_int_null.metadata["url"], + template_url=self.get_int_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1264,11 +1307,13 @@ def get_int_null( if cls: return cls(pipeline_response, None, {}) - get_int_null.metadata = {"url": "/queries/int/null"} # type: ignore + get_int_null.metadata = {'url': '/queries/int/null'} # type: ignore + @distributed_trace def get_ten_billion( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '10000000000' 64 bit integer value. @@ -1281,20 +1326,27 @@ def get_ten_billion( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", 10000000000) # type: int + long_query = kwargs.pop('long_query', 10000000000) # type: int + request = build_get_ten_billion_request( long_query=long_query, - template_url=self.get_ten_billion.metadata["url"], + template_url=self.get_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1305,11 +1357,13 @@ def get_ten_billion( if cls: return cls(pipeline_response, None, {}) - get_ten_billion.metadata = {"url": "/queries/long/10000000000"} # type: ignore + get_ten_billion.metadata = {'url': '/queries/long/10000000000'} # type: ignore + @distributed_trace def get_negative_ten_billion( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-10000000000' 64 bit integer value. @@ -1322,20 +1376,27 @@ def get_negative_ten_billion( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", -10000000000) # type: int + long_query = kwargs.pop('long_query', -10000000000) # type: int + request = build_get_negative_ten_billion_request( long_query=long_query, - template_url=self.get_negative_ten_billion.metadata["url"], + template_url=self.get_negative_ten_billion.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1346,7 +1407,8 @@ def get_negative_ten_billion( if cls: return cls(pipeline_response, None, {}) - get_negative_ten_billion.metadata = {"url": "/queries/long/-10000000000"} # type: ignore + get_negative_ten_billion.metadata = {'url': '/queries/long/-10000000000'} # type: ignore + @distributed_trace def get_long_null( @@ -1364,18 +1426,25 @@ def get_long_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_long_null_request( long_query=long_query, - template_url=self.get_long_null.metadata["url"], + template_url=self.get_long_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1386,11 +1455,13 @@ def get_long_null( if cls: return cls(pipeline_response, None, {}) - get_long_null.metadata = {"url": "/queries/long/null"} # type: ignore + get_long_null.metadata = {'url': '/queries/long/null'} # type: ignore + @distributed_trace def float_scientific_positive( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '1.034E+20' numeric value. @@ -1403,20 +1474,27 @@ def float_scientific_positive( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", 103400000000000000000) # type: float + float_query = kwargs.pop('float_query', 103400000000000000000) # type: float + request = build_float_scientific_positive_request( float_query=float_query, - template_url=self.float_scientific_positive.metadata["url"], + template_url=self.float_scientific_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1427,11 +1505,13 @@ def float_scientific_positive( if cls: return cls(pipeline_response, None, {}) - float_scientific_positive.metadata = {"url": "/queries/float/1.034E+20"} # type: ignore + float_scientific_positive.metadata = {'url': '/queries/float/1.034E+20'} # type: ignore + @distributed_trace def float_scientific_negative( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-1.034E-20' numeric value. @@ -1444,20 +1524,27 @@ def float_scientific_negative( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", -1.034e-20) # type: float + float_query = kwargs.pop('float_query', -1.034e-20) # type: float + request = build_float_scientific_negative_request( float_query=float_query, - template_url=self.float_scientific_negative.metadata["url"], + template_url=self.float_scientific_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1468,7 +1555,8 @@ def float_scientific_negative( if cls: return cls(pipeline_response, None, {}) - float_scientific_negative.metadata = {"url": "/queries/float/-1.034E-20"} # type: ignore + float_scientific_negative.metadata = {'url': '/queries/float/-1.034E-20'} # type: ignore + @distributed_trace def float_null( @@ -1486,18 +1574,25 @@ def float_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_float_null_request( float_query=float_query, - template_url=self.float_null.metadata["url"], + template_url=self.float_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1508,11 +1603,13 @@ def float_null( if cls: return cls(pipeline_response, None, {}) - float_null.metadata = {"url": "/queries/float/null"} # type: ignore + float_null.metadata = {'url': '/queries/float/null'} # type: ignore + @distributed_trace def double_decimal_positive( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '9999999.999' numeric value. @@ -1525,20 +1622,27 @@ def double_decimal_positive( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", 9999999.999) # type: float + double_query = kwargs.pop('double_query', 9999999.999) # type: float + request = build_double_decimal_positive_request( double_query=double_query, - template_url=self.double_decimal_positive.metadata["url"], + template_url=self.double_decimal_positive.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1549,11 +1653,13 @@ def double_decimal_positive( if cls: return cls(pipeline_response, None, {}) - double_decimal_positive.metadata = {"url": "/queries/double/9999999.999"} # type: ignore + double_decimal_positive.metadata = {'url': '/queries/double/9999999.999'} # type: ignore + @distributed_trace def double_decimal_negative( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '-9999999.999' numeric value. @@ -1566,20 +1672,27 @@ def double_decimal_negative( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", -9999999.999) # type: float + double_query = kwargs.pop('double_query', -9999999.999) # type: float + request = build_double_decimal_negative_request( double_query=double_query, - template_url=self.double_decimal_negative.metadata["url"], + template_url=self.double_decimal_negative.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1590,7 +1703,8 @@ def double_decimal_negative( if cls: return cls(pipeline_response, None, {}) - double_decimal_negative.metadata = {"url": "/queries/double/-9999999.999"} # type: ignore + double_decimal_negative.metadata = {'url': '/queries/double/-9999999.999'} # type: ignore + @distributed_trace def double_null( @@ -1608,18 +1722,25 @@ def double_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_double_null_request( double_query=double_query, - template_url=self.double_null.metadata["url"], + template_url=self.double_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1630,11 +1751,13 @@ def double_null( if cls: return cls(pipeline_response, None, {}) - double_null.metadata = {"url": "/queries/double/null"} # type: ignore + double_null.metadata = {'url': '/queries/double/null'} # type: ignore + @distributed_trace def string_unicode( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. @@ -1647,20 +1770,27 @@ def string_unicode( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_query = kwargs.pop('string_query', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_string_unicode_request( string_query=string_query, - template_url=self.string_unicode.metadata["url"], + template_url=self.string_unicode.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1671,11 +1801,13 @@ def string_unicode( if cls: return cls(pipeline_response, None, {}) - string_unicode.metadata = {"url": "/queries/string/unicode/"} # type: ignore + string_unicode.metadata = {'url': '/queries/string/unicode/'} # type: ignore + @distributed_trace def string_url_encoded( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get 'begin!*'();:@ &=+$,/?#[]end. @@ -1689,20 +1821,27 @@ def string_url_encoded( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_query = kwargs.pop('string_query', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_string_url_encoded_request( string_query=string_query, - template_url=self.string_url_encoded.metadata["url"], + template_url=self.string_url_encoded.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1713,11 +1852,13 @@ def string_url_encoded( if cls: return cls(pipeline_response, None, {}) - string_url_encoded.metadata = {"url": "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend"} # type: ignore + string_url_encoded.metadata = {'url': '/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend'} # type: ignore + @distributed_trace def string_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get ''. @@ -1730,20 +1871,27 @@ def string_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "") # type: str + string_query = kwargs.pop('string_query', "") # type: str + request = build_string_empty_request( string_query=string_query, - template_url=self.string_empty.metadata["url"], + template_url=self.string_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1754,7 +1902,8 @@ def string_empty( if cls: return cls(pipeline_response, None, {}) - string_empty.metadata = {"url": "/queries/string/empty"} # type: ignore + string_empty.metadata = {'url': '/queries/string/empty'} # type: ignore + @distributed_trace def string_null( @@ -1772,18 +1921,25 @@ def string_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_string_null_request( string_query=string_query, - template_url=self.string_null.metadata["url"], + template_url=self.string_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1794,7 +1950,8 @@ def string_null( if cls: return cls(pipeline_response, None, {}) - string_null.metadata = {"url": "/queries/string/null"} # type: ignore + string_null.metadata = {'url': '/queries/string/null'} # type: ignore + @distributed_trace def enum_valid( @@ -1812,18 +1969,25 @@ def enum_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_valid_request( enum_query=enum_query, - template_url=self.enum_valid.metadata["url"], + template_url=self.enum_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1834,7 +1998,8 @@ def enum_valid( if cls: return cls(pipeline_response, None, {}) - enum_valid.metadata = {"url": "/queries/enum/green%20color"} # type: ignore + enum_valid.metadata = {'url': '/queries/enum/green%20color'} # type: ignore + @distributed_trace def enum_null( @@ -1852,18 +2017,25 @@ def enum_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_enum_null_request( enum_query=enum_query, - template_url=self.enum_null.metadata["url"], + template_url=self.enum_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1874,7 +2046,8 @@ def enum_null( if cls: return cls(pipeline_response, None, {}) - enum_null.metadata = {"url": "/queries/enum/null"} # type: ignore + enum_null.metadata = {'url': '/queries/enum/null'} # type: ignore + @distributed_trace def byte_multi_byte( @@ -1892,18 +2065,25 @@ def byte_multi_byte( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_multi_byte_request( byte_query=byte_query, - template_url=self.byte_multi_byte.metadata["url"], + template_url=self.byte_multi_byte.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1914,11 +2094,13 @@ def byte_multi_byte( if cls: return cls(pipeline_response, None, {}) - byte_multi_byte.metadata = {"url": "/queries/byte/multibyte"} # type: ignore + byte_multi_byte.metadata = {'url': '/queries/byte/multibyte'} # type: ignore + @distributed_trace def byte_empty( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '' as byte array. @@ -1931,20 +2113,27 @@ def byte_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_query = kwargs.pop("byte_query", bytearray("", encoding="utf-8")) # type: bytearray + byte_query = kwargs.pop('byte_query', bytearray("", encoding="utf-8")) # type: bytearray + request = build_byte_empty_request( byte_query=byte_query, - template_url=self.byte_empty.metadata["url"], + template_url=self.byte_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1955,7 +2144,8 @@ def byte_empty( if cls: return cls(pipeline_response, None, {}) - byte_empty.metadata = {"url": "/queries/byte/empty"} # type: ignore + byte_empty.metadata = {'url': '/queries/byte/empty'} # type: ignore + @distributed_trace def byte_null( @@ -1973,18 +2163,25 @@ def byte_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_byte_null_request( byte_query=byte_query, - template_url=self.byte_null.metadata["url"], + template_url=self.byte_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1995,11 +2192,13 @@ def byte_null( if cls: return cls(pipeline_response, None, {}) - byte_null.metadata = {"url": "/queries/byte/null"} # type: ignore + byte_null.metadata = {'url': '/queries/byte/null'} # type: ignore + @distributed_trace def date_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '2012-01-01' as date. @@ -2012,20 +2211,27 @@ def date_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_query = kwargs.pop("date_query", "2012-01-01") # type: datetime.date + date_query = kwargs.pop('date_query', "2012-01-01") # type: datetime.date + request = build_date_valid_request( date_query=date_query, - template_url=self.date_valid.metadata["url"], + template_url=self.date_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2036,7 +2242,8 @@ def date_valid( if cls: return cls(pipeline_response, None, {}) - date_valid.metadata = {"url": "/queries/date/2012-01-01"} # type: ignore + date_valid.metadata = {'url': '/queries/date/2012-01-01'} # type: ignore + @distributed_trace def date_null( @@ -2054,18 +2261,25 @@ def date_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_null_request( date_query=date_query, - template_url=self.date_null.metadata["url"], + template_url=self.date_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2076,11 +2290,13 @@ def date_null( if cls: return cls(pipeline_response, None, {}) - date_null.metadata = {"url": "/queries/date/null"} # type: ignore + date_null.metadata = {'url': '/queries/date/null'} # type: ignore + @distributed_trace def date_time_valid( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get '2012-01-01T01:01:01Z' as date-time. @@ -2094,20 +2310,27 @@ def date_time_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_query = kwargs.pop("date_time_query", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_query = kwargs.pop('date_time_query', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_date_time_valid_request( date_time_query=date_time_query, - template_url=self.date_time_valid.metadata["url"], + template_url=self.date_time_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2118,7 +2341,8 @@ def date_time_valid( if cls: return cls(pipeline_response, None, {}) - date_time_valid.metadata = {"url": "/queries/datetime/2012-01-01T01%3A01%3A01Z"} # type: ignore + date_time_valid.metadata = {'url': '/queries/datetime/2012-01-01T01%3A01%3A01Z'} # type: ignore + @distributed_trace def date_time_null( @@ -2136,18 +2360,25 @@ def date_time_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_date_time_null_request( date_time_query=date_time_query, - template_url=self.date_time_null.metadata["url"], + template_url=self.date_time_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2158,7 +2389,8 @@ def date_time_null( if cls: return cls(pipeline_response, None, {}) - date_time_null.metadata = {"url": "/queries/datetime/null"} # type: ignore + date_time_null.metadata = {'url': '/queries/datetime/null'} # type: ignore + @distributed_trace def array_string_csv_valid( @@ -2178,18 +2410,25 @@ def array_string_csv_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_csv_valid_request( array_query=array_query, - template_url=self.array_string_csv_valid.metadata["url"], + template_url=self.array_string_csv_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2200,7 +2439,8 @@ def array_string_csv_valid( if cls: return cls(pipeline_response, None, {}) - array_string_csv_valid.metadata = {"url": "/queries/array/csv/string/valid"} # type: ignore + array_string_csv_valid.metadata = {'url': '/queries/array/csv/string/valid'} # type: ignore + @distributed_trace def array_string_csv_null( @@ -2218,18 +2458,25 @@ def array_string_csv_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_csv_null_request( array_query=array_query, - template_url=self.array_string_csv_null.metadata["url"], + template_url=self.array_string_csv_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2240,7 +2487,8 @@ def array_string_csv_null( if cls: return cls(pipeline_response, None, {}) - array_string_csv_null.metadata = {"url": "/queries/array/csv/string/null"} # type: ignore + array_string_csv_null.metadata = {'url': '/queries/array/csv/string/null'} # type: ignore + @distributed_trace def array_string_csv_empty( @@ -2258,18 +2506,25 @@ def array_string_csv_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_csv_empty_request( array_query=array_query, - template_url=self.array_string_csv_empty.metadata["url"], + template_url=self.array_string_csv_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2280,7 +2535,8 @@ def array_string_csv_empty( if cls: return cls(pipeline_response, None, {}) - array_string_csv_empty.metadata = {"url": "/queries/array/csv/string/empty"} # type: ignore + array_string_csv_empty.metadata = {'url': '/queries/array/csv/string/empty'} # type: ignore + @distributed_trace def array_string_no_collection_format_empty( @@ -2299,18 +2555,25 @@ def array_string_no_collection_format_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_no_collection_format_empty_request( array_query=array_query, - template_url=self.array_string_no_collection_format_empty.metadata["url"], + template_url=self.array_string_no_collection_format_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2321,7 +2584,8 @@ def array_string_no_collection_format_empty( if cls: return cls(pipeline_response, None, {}) - array_string_no_collection_format_empty.metadata = {"url": "/queries/array/none/string/empty"} # type: ignore + array_string_no_collection_format_empty.metadata = {'url': '/queries/array/none/string/empty'} # type: ignore + @distributed_trace def array_string_ssv_valid( @@ -2341,18 +2605,25 @@ def array_string_ssv_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_ssv_valid_request( array_query=array_query, - template_url=self.array_string_ssv_valid.metadata["url"], + template_url=self.array_string_ssv_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2363,7 +2634,8 @@ def array_string_ssv_valid( if cls: return cls(pipeline_response, None, {}) - array_string_ssv_valid.metadata = {"url": "/queries/array/ssv/string/valid"} # type: ignore + array_string_ssv_valid.metadata = {'url': '/queries/array/ssv/string/valid'} # type: ignore + @distributed_trace def array_string_tsv_valid( @@ -2383,18 +2655,25 @@ def array_string_tsv_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_tsv_valid_request( array_query=array_query, - template_url=self.array_string_tsv_valid.metadata["url"], + template_url=self.array_string_tsv_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2405,7 +2684,8 @@ def array_string_tsv_valid( if cls: return cls(pipeline_response, None, {}) - array_string_tsv_valid.metadata = {"url": "/queries/array/tsv/string/valid"} # type: ignore + array_string_tsv_valid.metadata = {'url': '/queries/array/tsv/string/valid'} # type: ignore + @distributed_trace def array_string_pipes_valid( @@ -2425,18 +2705,25 @@ def array_string_pipes_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_pipes_valid_request( array_query=array_query, - template_url=self.array_string_pipes_valid.metadata["url"], + template_url=self.array_string_pipes_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2447,4 +2734,5 @@ def array_string_pipes_valid( if cls: return cls(pipeline_response, None, {}) - array_string_pipes_valid.metadata = {"url": "/queries/array/pipes/string/valid"} # type: ignore + array_string_pipes_valid.metadata = {'url': '/queries/array/pipes/string/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py index 8c5a64d2402..1a1b2e567d4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/__init__.py index 4126273e3d8..4681c978cb1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestUrlMutliCollectionFormatTestService"] +__all__ = ['AutoRestUrlMutliCollectionFormatTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py index bc4fae2f2c3..85d8694965d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestUrlMutliCollectionFormatTestService(object): """Test Infrastructure for AutoRest. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_configuration.py index 3ea2f6ac0ac..6ce48d7c956 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): +class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlMutliCollectionFormatTestService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestUrlMutliCollectionFormatTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresturlmutlicollectionformattestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturlmutlicollectionformattestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/__init__.py index dc51912a904..2116fb21264 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_url_mutli_collection_format_test_service import AutoRestUrlMutliCollectionFormatTestService - -__all__ = ["AutoRestUrlMutliCollectionFormatTestService"] +__all__ = ['AutoRestUrlMutliCollectionFormatTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py index 8f688943313..7e5a7f9dcde 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestUrlMutliCollectionFormatTestServiceConfiguration from .operations import QueriesOperations - class AutoRestUrlMutliCollectionFormatTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,11 @@ class AutoRestUrlMutliCollectionFormatTestService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestUrlMutliCollectionFormatTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_configuration.py index 30b9cb9fe74..2e326f2c85b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): +class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlMutliCollectionFormatTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestUrlMutliCollectionFormatTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresturlmutlicollectionformattestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturlmutlicollectionformattestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/__init__.py index a639d2fb628..0c8a12ca6b5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._queries_operations import QueriesOperations __all__ = [ - "QueriesOperations", + 'QueriesOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py index 8605f3803ea..bc0d77a6ac9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,16 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._queries_operations import ( - build_array_string_multi_empty_request, - build_array_string_multi_null_request, - build_array_string_multi_valid_request, -) - -T = TypeVar("T") +from ...operations._queries_operations import build_array_string_multi_empty_request, build_array_string_multi_null_request, build_array_string_multi_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class QueriesOperations: """QueriesOperations async operations. @@ -56,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def array_string_multi_null(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_multi_null( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get a null array of string using the multi-array format. :param array_query: a null array of string using the multi-array format. @@ -66,18 +57,25 @@ async def array_string_multi_null(self, array_query: Optional[List[str]] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_multi_null_request( array_query=array_query, - template_url=self.array_string_multi_null.metadata["url"], + template_url=self.array_string_multi_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,10 +86,15 @@ async def array_string_multi_null(self, array_query: Optional[List[str]] = None, if cls: return cls(pipeline_response, None, {}) - array_string_multi_null.metadata = {"url": "/queries/array/multi/string/null"} # type: ignore + array_string_multi_null.metadata = {'url': '/queries/array/multi/string/null'} # type: ignore + @distributed_trace_async - async def array_string_multi_empty(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_multi_empty( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an empty array [] of string using the multi-array format. :param array_query: an empty array [] of string using the multi-array format. @@ -101,18 +104,25 @@ async def array_string_multi_empty(self, array_query: Optional[List[str]] = None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_multi_empty_request( array_query=array_query, - template_url=self.array_string_multi_empty.metadata["url"], + template_url=self.array_string_multi_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -123,10 +133,15 @@ async def array_string_multi_empty(self, array_query: Optional[List[str]] = None if cls: return cls(pipeline_response, None, {}) - array_string_multi_empty.metadata = {"url": "/queries/array/multi/string/empty"} # type: ignore + array_string_multi_empty.metadata = {'url': '/queries/array/multi/string/empty'} # type: ignore + @distributed_trace_async - async def array_string_multi_valid(self, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_multi_valid( + self, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the mult-array format. @@ -138,18 +153,25 @@ async def array_string_multi_valid(self, array_query: Optional[List[str]] = None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_multi_valid_request( array_query=array_query, - template_url=self.array_string_multi_valid.metadata["url"], + template_url=self.array_string_multi_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -160,4 +182,5 @@ async def array_string_multi_valid(self, array_query: Optional[List[str]] = None if cls: return cls(pipeline_response, None, {}) - array_string_multi_valid.metadata = {"url": "/queries/array/multi/string/valid"} # type: ignore + array_string_multi_valid.metadata = {'url': '/queries/array/multi/string/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py index 424e7043f8b..9c7dad4f9d3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py @@ -12,5 +12,5 @@ from ._models import Error # type: ignore __all__ = [ - "Error", + 'Error', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models.py index 88a28ca1bb6..0b51526ea38 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models.py @@ -20,11 +20,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -32,5 +35,5 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models_py3.py index 9a0e0c2f754..3b0013904e2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_models_py3.py @@ -22,11 +22,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/__init__.py index a639d2fb628..0c8a12ca6b5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/__init__.py @@ -9,5 +9,5 @@ from ._queries_operations import QueriesOperations __all__ = [ - "QueriesOperations", + 'QueriesOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py index 8b947823358..447b2347009 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -158,18 +150,25 @@ def array_string_multi_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_multi_null_request( array_query=array_query, - template_url=self.array_string_multi_null.metadata["url"], + template_url=self.array_string_multi_null.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -180,7 +179,8 @@ def array_string_multi_null( if cls: return cls(pipeline_response, None, {}) - array_string_multi_null.metadata = {"url": "/queries/array/multi/string/null"} # type: ignore + array_string_multi_null.metadata = {'url': '/queries/array/multi/string/null'} # type: ignore + @distributed_trace def array_string_multi_empty( @@ -198,18 +198,25 @@ def array_string_multi_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_multi_empty_request( array_query=array_query, - template_url=self.array_string_multi_empty.metadata["url"], + template_url=self.array_string_multi_empty.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -220,7 +227,8 @@ def array_string_multi_empty( if cls: return cls(pipeline_response, None, {}) - array_string_multi_empty.metadata = {"url": "/queries/array/multi/string/empty"} # type: ignore + array_string_multi_empty.metadata = {'url': '/queries/array/multi/string/empty'} # type: ignore + @distributed_trace def array_string_multi_valid( @@ -240,18 +248,25 @@ def array_string_multi_valid( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_array_string_multi_valid_request( array_query=array_query, - template_url=self.array_string_multi_valid.metadata["url"], + template_url=self.array_string_multi_valid.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -262,4 +277,5 @@ def array_string_multi_valid( if cls: return cls(pipeline_response, None, {}) - array_string_multi_valid.metadata = {"url": "/queries/array/multi/string/valid"} # type: ignore + array_string_multi_valid.metadata = {'url': '/queries/array/multi/string/valid'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py index 1ec830f56e0..05d986a5b18 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. No server backend exists for these tests. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/__init__.py index c8dbba243f7..a7fe6d7f4b4 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestValidationTest"] +__all__ = ['AutoRestValidationTest'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py index 9b8fec305b8..30b086fcbd5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestValidationTest(AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. @@ -49,6 +48,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_configuration.py index 600b4f10c5b..c1b27bafc15 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestValidationTestConfiguration(Configuration): +class AutoRestValidationTestConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestValidationTest. Note that all parameters used to create this instance are saved as instance @@ -26,7 +26,8 @@ class AutoRestValidationTestConfiguration(Configuration): :param subscription_id: Subscription ID. :type subscription_id: str - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ @@ -37,26 +38,27 @@ def __init__( ): # type: (...) -> None super(AutoRestValidationTestConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.subscription_id = subscription_id self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestvalidationtest/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestvalidationtest/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/__init__.py index e0ac5945ea6..ca3a949b63f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_validation_test import AutoRestValidationTest - -__all__ = ["AutoRestValidationTest"] +__all__ = ['AutoRestValidationTest'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py index 55fea7ae5ca..aa7b1c1670c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestValidationTestConfiguration from .operations import AutoRestValidationTestOperationsMixin - class AutoRestValidationTest(AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. @@ -30,7 +29,12 @@ class AutoRestValidationTest(AutoRestValidationTestOperationsMixin): :paramtype api_version: str """ - def __init__(self, subscription_id: str, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestValidationTestConfiguration(subscription_id=subscription_id, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -38,7 +42,12 @@ def __init__(self, subscription_id: str, base_url: str = "http://localhost:3000" self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_configuration.py index b94ec5a513f..745dd7740e0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestValidationTestConfiguration(Configuration): +class AutoRestValidationTestConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestValidationTest. Note that all parameters used to create this instance are saved as instance @@ -22,29 +22,37 @@ class AutoRestValidationTestConfiguration(Configuration): :param subscription_id: Subscription ID. :type subscription_id: str - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + **kwargs: Any + ) -> None: super(AutoRestValidationTestConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.subscription_id = subscription_id self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestvalidationtest/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestvalidationtest/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/__init__.py index edf563e7584..aeac9b918e7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_validation_test_operations import AutoRestValidationTestOperationsMixin __all__ = [ - "AutoRestValidationTestOperationsMixin", + 'AutoRestValidationTestOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py index 622e0494e3e..72766d09d81 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,21 +16,18 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._auto_rest_validation_test_operations import ( - build_get_with_constant_in_path_request, - build_post_with_constant_in_body_request, - build_validation_of_body_request, - build_validation_of_method_parameters_request, -) - -T = TypeVar("T") +from ...operations._auto_rest_validation_test_operations import build_get_with_constant_in_path_request, build_post_with_constant_in_body_request, build_validation_of_body_request, build_validation_of_method_parameters_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestValidationTestOperationsMixin: + @distributed_trace_async async def validation_of_method_parameters( - self, resource_group_name: str, id: int, **kwargs: Any + self, + resource_group_name: str, + id: int, + **kwargs: Any ) -> "_models.Product": """Validates input parameters on the method. See swagger for details. @@ -50,23 +40,30 @@ async def validation_of_method_parameters( :rtype: ~validation.models.Product :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str + request = build_validation_of_method_parameters_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, id=id, api_version=api_version, - template_url=self.validation_of_method_parameters.metadata["url"], + template_url=self.validation_of_method_parameters.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -74,18 +71,23 @@ async def validation_of_method_parameters( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validation_of_method_parameters.metadata = {"url": "/fakepath/{subscriptionId}/{resourceGroupName}/{id}"} # type: ignore + validation_of_method_parameters.metadata = {'url': '/fakepath/{subscriptionId}/{resourceGroupName}/{id}'} # type: ignore + @distributed_trace_async async def validation_of_body( - self, resource_group_name: str, id: int, body: Optional["_models.Product"] = None, **kwargs: Any + self, + resource_group_name: str, + id: int, + body: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": """Validates body parameters on the method. See swagger for details. @@ -100,15 +102,17 @@ async def validation_of_body( :rtype: ~validation.models.Product :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "1.0.0") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: - _json = self._serialize.body(body, "Product") + _json = self._serialize.body(body, 'Product') else: _json = None @@ -119,12 +123,16 @@ async def validation_of_body( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validation_of_body.metadata["url"], + template_url=self.validation_of_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,17 +140,21 @@ async def validation_of_body( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validation_of_body.metadata = {"url": "/fakepath/{subscriptionId}/{resourceGroupName}/{id}"} # type: ignore + validation_of_body.metadata = {'url': '/fakepath/{subscriptionId}/{resourceGroupName}/{id}'} # type: ignore + @distributed_trace_async - async def get_with_constant_in_path(self, **kwargs: Any) -> None: + async def get_with_constant_in_path( + self, + **kwargs: Any + ) -> None: """get_with_constant_in_path. :keyword constant_param: The default value is "constant". Note that overriding this default @@ -153,20 +165,27 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str + constant_param = kwargs.pop('constant_param', "constant") # type: str + request = build_get_with_constant_in_path_request( constant_param=constant_param, - template_url=self.get_with_constant_in_path.metadata["url"], + template_url=self.get_with_constant_in_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,11 +195,14 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - get_with_constant_in_path.metadata = {"url": "/validation/constantsInPath/{constantParam}/value"} # type: ignore + get_with_constant_in_path.metadata = {'url': '/validation/constantsInPath/{constantParam}/value'} # type: ignore + @distributed_trace_async async def post_with_constant_in_body( - self, body: Optional["_models.Product"] = None, **kwargs: Any + self, + body: Optional["_models.Product"] = None, + **kwargs: Any ) -> "_models.Product": """post_with_constant_in_body. @@ -194,15 +216,17 @@ async def post_with_constant_in_body( :rtype: ~validation.models.Product :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + constant_param = kwargs.pop('constant_param', "constant") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: - _json = self._serialize.body(body, "Product") + _json = self._serialize.body(body, 'Product') else: _json = None @@ -210,23 +234,28 @@ async def post_with_constant_in_body( constant_param=constant_param, content_type=content_type, json=_json, - template_url=self.post_with_constant_in_body.metadata["url"], + template_url=self.post_with_constant_in_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_with_constant_in_body.metadata = {"url": "/validation/constantsInPath/{constantParam}/value"} # type: ignore + post_with_constant_in_body.metadata = {'url': '/validation/constantsInPath/{constantParam}/value'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py index cb9c83855de..a4615f9b8f0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py @@ -18,8 +18,8 @@ from ._models import Product # type: ignore __all__ = [ - "ChildProduct", - "ConstantProduct", - "Error", - "Product", + 'ChildProduct', + 'ConstantProduct', + 'Error', + 'Product', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models.py index 90ee2134fca..c96c1dc3356 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models.py @@ -24,23 +24,26 @@ class ChildProduct(msrest.serialization.Model): """ _validation = { - "const_property": {"required": True, "constant": True}, + 'const_property': {'required': True, 'constant': True}, } _attribute_map = { - "const_property": {"key": "constProperty", "type": "str"}, - "count": {"key": "count", "type": "int"}, + 'const_property': {'key': 'constProperty', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, } const_property = "constant" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword count: Count. :paramtype count: int """ super(ChildProduct, self).__init__(**kwargs) - self.count = kwargs.get("count", None) + self.count = kwargs.get('count', None) class ConstantProduct(msrest.serialization.Model): @@ -57,20 +60,24 @@ class ConstantProduct(msrest.serialization.Model): """ _validation = { - "const_property": {"required": True, "constant": True}, - "const_property2": {"required": True, "constant": True}, + 'const_property': {'required': True, 'constant': True}, + 'const_property2': {'required': True, 'constant': True}, } _attribute_map = { - "const_property": {"key": "constProperty", "type": "str"}, - "const_property2": {"key": "constProperty2", "type": "str"}, + 'const_property': {'key': 'constProperty', 'type': 'str'}, + 'const_property2': {'key': 'constProperty2', 'type': 'str'}, } const_property = "constant" const_property2 = "constant2" - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(ConstantProduct, self).__init__(**kwargs) @@ -86,12 +93,15 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "code": {"key": "code", "type": "int"}, - "message": {"key": "message", "type": "str"}, - "fields": {"key": "fields", "type": "str"}, + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + 'fields': {'key': 'fields', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword code: :paramtype code: int @@ -101,9 +111,9 @@ def __init__(self, **kwargs): :paramtype fields: str """ super(Error, self).__init__(**kwargs) - self.code = kwargs.get("code", None) - self.message = kwargs.get("message", None) - self.fields = kwargs.get("fields", None) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.fields = kwargs.get('fields', None) class Product(msrest.serialization.Model): @@ -133,30 +143,33 @@ class Product(msrest.serialization.Model): """ _validation = { - "display_names": {"max_items": 6, "min_items": 0, "unique": True}, - "capacity": {"maximum_ex": 100, "minimum_ex": 0}, - "image": {"pattern": r"http://\w+"}, - "child": {"required": True}, - "const_child": {"required": True}, - "const_int": {"required": True, "constant": True}, - "const_string": {"required": True, "constant": True}, + 'display_names': {'max_items': 6, 'min_items': 0, 'unique': True}, + 'capacity': {'maximum_ex': 100, 'minimum_ex': 0}, + 'image': {'pattern': r'http://\w+'}, + 'child': {'required': True}, + 'const_child': {'required': True}, + 'const_int': {'required': True, 'constant': True}, + 'const_string': {'required': True, 'constant': True}, } _attribute_map = { - "display_names": {"key": "display_names", "type": "[str]"}, - "capacity": {"key": "capacity", "type": "int"}, - "image": {"key": "image", "type": "str"}, - "child": {"key": "child", "type": "ChildProduct"}, - "const_child": {"key": "constChild", "type": "ConstantProduct"}, - "const_int": {"key": "constInt", "type": "int"}, - "const_string": {"key": "constString", "type": "str"}, - "const_string_as_enum": {"key": "constStringAsEnum", "type": "str"}, + 'display_names': {'key': 'display_names', 'type': '[str]'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'image': {'key': 'image', 'type': 'str'}, + 'child': {'key': 'child', 'type': 'ChildProduct'}, + 'const_child': {'key': 'constChild', 'type': 'ConstantProduct'}, + 'const_int': {'key': 'constInt', 'type': 'int'}, + 'const_string': {'key': 'constString', 'type': 'str'}, + 'const_string_as_enum': {'key': 'constStringAsEnum', 'type': 'str'}, } const_int = 0 const_string = "constant" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword display_names: Non required array of unique items from 0 to 6 elements. :paramtype display_names: list[str] @@ -173,9 +186,9 @@ def __init__(self, **kwargs): :paramtype const_string_as_enum: str """ super(Product, self).__init__(**kwargs) - self.display_names = kwargs.get("display_names", None) - self.capacity = kwargs.get("capacity", None) - self.image = kwargs.get("image", None) - self.child = kwargs["child"] - self.const_child = kwargs["const_child"] - self.const_string_as_enum = kwargs.get("const_string_as_enum", None) + self.display_names = kwargs.get('display_names', None) + self.capacity = kwargs.get('capacity', None) + self.image = kwargs.get('image', None) + self.child = kwargs['child'] + self.const_child = kwargs['const_child'] + self.const_string_as_enum = kwargs.get('const_string_as_enum', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py index 2317ca81f13..f10e98c561d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_models_py3.py @@ -26,17 +26,22 @@ class ChildProduct(msrest.serialization.Model): """ _validation = { - "const_property": {"required": True, "constant": True}, + 'const_property': {'required': True, 'constant': True}, } _attribute_map = { - "const_property": {"key": "constProperty", "type": "str"}, - "count": {"key": "count", "type": "int"}, + 'const_property': {'key': 'constProperty', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, } const_property = "constant" - def __init__(self, *, count: Optional[int] = None, **kwargs): + def __init__( + self, + *, + count: Optional[int] = None, + **kwargs + ): """ :keyword count: Count. :paramtype count: int @@ -59,20 +64,24 @@ class ConstantProduct(msrest.serialization.Model): """ _validation = { - "const_property": {"required": True, "constant": True}, - "const_property2": {"required": True, "constant": True}, + 'const_property': {'required': True, 'constant': True}, + 'const_property2': {'required': True, 'constant': True}, } _attribute_map = { - "const_property": {"key": "constProperty", "type": "str"}, - "const_property2": {"key": "constProperty2", "type": "str"}, + 'const_property': {'key': 'constProperty', 'type': 'str'}, + 'const_property2': {'key': 'constProperty2', 'type': 'str'}, } const_property = "constant" const_property2 = "constant2" - def __init__(self, **kwargs): - """ """ + def __init__( + self, + **kwargs + ): + """ + """ super(ConstantProduct, self).__init__(**kwargs) @@ -88,13 +97,18 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "code": {"key": "code", "type": "int"}, - "message": {"key": "message", "type": "str"}, - "fields": {"key": "fields", "type": "str"}, + 'code': {'key': 'code', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + 'fields': {'key': 'fields', 'type': 'str'}, } def __init__( - self, *, code: Optional[int] = None, message: Optional[str] = None, fields: Optional[str] = None, **kwargs + self, + *, + code: Optional[int] = None, + message: Optional[str] = None, + fields: Optional[str] = None, + **kwargs ): """ :keyword code: @@ -137,24 +151,24 @@ class Product(msrest.serialization.Model): """ _validation = { - "display_names": {"max_items": 6, "min_items": 0, "unique": True}, - "capacity": {"maximum_ex": 100, "minimum_ex": 0}, - "image": {"pattern": r"http://\w+"}, - "child": {"required": True}, - "const_child": {"required": True}, - "const_int": {"required": True, "constant": True}, - "const_string": {"required": True, "constant": True}, + 'display_names': {'max_items': 6, 'min_items': 0, 'unique': True}, + 'capacity': {'maximum_ex': 100, 'minimum_ex': 0}, + 'image': {'pattern': r'http://\w+'}, + 'child': {'required': True}, + 'const_child': {'required': True}, + 'const_int': {'required': True, 'constant': True}, + 'const_string': {'required': True, 'constant': True}, } _attribute_map = { - "display_names": {"key": "display_names", "type": "[str]"}, - "capacity": {"key": "capacity", "type": "int"}, - "image": {"key": "image", "type": "str"}, - "child": {"key": "child", "type": "ChildProduct"}, - "const_child": {"key": "constChild", "type": "ConstantProduct"}, - "const_int": {"key": "constInt", "type": "int"}, - "const_string": {"key": "constString", "type": "str"}, - "const_string_as_enum": {"key": "constStringAsEnum", "type": "str"}, + 'display_names': {'key': 'display_names', 'type': '[str]'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'image': {'key': 'image', 'type': 'str'}, + 'child': {'key': 'child', 'type': 'ChildProduct'}, + 'const_child': {'key': 'constChild', 'type': 'ConstantProduct'}, + 'const_int': {'key': 'constInt', 'type': 'int'}, + 'const_string': {'key': 'constString', 'type': 'str'}, + 'const_string_as_enum': {'key': 'constStringAsEnum', 'type': 'str'}, } const_int = 0 diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/__init__.py index edf563e7584..aeac9b918e7 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/__init__.py @@ -9,5 +9,5 @@ from ._auto_rest_validation_test_operations import AutoRestValidationTestOperationsMixin __all__ = [ - "AutoRestValidationTestOperationsMixin", + 'AutoRestValidationTestOperationsMixin', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py index 72bf8f07f6b..2c3452587f0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -164,6 +156,7 @@ def build_post_with_constant_in_body_request( # fmt: on class AutoRestValidationTestOperationsMixin(object): + @distributed_trace def validation_of_method_parameters( self, @@ -183,23 +176,30 @@ def validation_of_method_parameters( :rtype: ~validation.models.Product :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str + request = build_validation_of_method_parameters_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, id=id, api_version=api_version, - template_url=self.validation_of_method_parameters.metadata["url"], + template_url=self.validation_of_method_parameters.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -207,14 +207,15 @@ def validation_of_method_parameters( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validation_of_method_parameters.metadata = {"url": "/fakepath/{subscriptionId}/{resourceGroupName}/{id}"} # type: ignore + validation_of_method_parameters.metadata = {'url': '/fakepath/{subscriptionId}/{resourceGroupName}/{id}'} # type: ignore + @distributed_trace def validation_of_body( @@ -238,15 +239,17 @@ def validation_of_body( :rtype: ~validation.models.Product :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "1.0.0") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: - _json = self._serialize.body(body, "Product") + _json = self._serialize.body(body, 'Product') else: _json = None @@ -257,12 +260,16 @@ def validation_of_body( api_version=api_version, content_type=content_type, json=_json, - template_url=self.validation_of_body.metadata["url"], + template_url=self.validation_of_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,18 +277,20 @@ def validation_of_body( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - validation_of_body.metadata = {"url": "/fakepath/{subscriptionId}/{resourceGroupName}/{id}"} # type: ignore + validation_of_body.metadata = {'url': '/fakepath/{subscriptionId}/{resourceGroupName}/{id}'} # type: ignore + @distributed_trace def get_with_constant_in_path( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """get_with_constant_in_path. @@ -294,20 +303,27 @@ def get_with_constant_in_path( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str + constant_param = kwargs.pop('constant_param', "constant") # type: str + request = build_get_with_constant_in_path_request( constant_param=constant_param, - template_url=self.get_with_constant_in_path.metadata["url"], + template_url=self.get_with_constant_in_path.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -317,7 +333,8 @@ def get_with_constant_in_path( if cls: return cls(pipeline_response, None, {}) - get_with_constant_in_path.metadata = {"url": "/validation/constantsInPath/{constantParam}/value"} # type: ignore + get_with_constant_in_path.metadata = {'url': '/validation/constantsInPath/{constantParam}/value'} # type: ignore + @distributed_trace def post_with_constant_in_body( @@ -338,15 +355,17 @@ def post_with_constant_in_body( :rtype: ~validation.models.Product :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Product"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Product"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + constant_param = kwargs.pop('constant_param', "constant") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: - _json = self._serialize.body(body, "Product") + _json = self._serialize.body(body, 'Product') else: _json = None @@ -354,23 +373,28 @@ def post_with_constant_in_body( constant_param=constant_param, content_type=content_type, json=_json, - template_url=self.post_with_constant_in_body.metadata["url"], + template_url=self.post_with_constant_in_body.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Product", pipeline_response) + deserialized = self._deserialize('Product', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - post_with_constant_in_body.metadata = {"url": "/validation/constantsInPath/{constantParam}/value"} # type: ignore + post_with_constant_in_body.metadata = {'url': '/validation/constantsInPath/{constantParam}/value'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py index 08f2e587366..0336771b01f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/__init__.py index 314965dfed4..947d93c2fb2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATXMLService"] +__all__ = ['AutoRestSwaggerBATXMLService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py index 333e08c62b4..0757a23a5bc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class AutoRestSwaggerBATXMLService(object): """Test Infrastructure for AutoRest Swagger BAT. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.xml = XmlOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_configuration.py index d8887a241fe..8f5d579737c 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): +class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATXMLService. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(AutoRestSwaggerBATXMLServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatxmlservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatxmlservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_vendor.py index 0dafe0e287f..9a223d15524 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/__init__.py index 135889b0d43..6625d429aa0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_batxml_service import AutoRestSwaggerBATXMLService - -__all__ = ["AutoRestSwaggerBATXMLService"] +__all__ = ['AutoRestSwaggerBATXMLService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py index b91c0fb8964..401de40464a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import AutoRestSwaggerBATXMLServiceConfiguration from .operations import XmlOperations - class AutoRestSwaggerBATXMLService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,11 @@ class AutoRestSwaggerBATXMLService: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATXMLServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.xml = XmlOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_configuration.py index 8cd31cae2e5..0284a42a242 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): +class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATXMLService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATXMLServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatxmlservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatxmlservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/__init__.py index 6c29f204a33..0189b1d89ef 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._xml_operations import XmlOperations __all__ = [ - "XmlOperations", + 'XmlOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py index 0ae6288615b..874db529f32 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,48 +16,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._xml_operations import ( - build_get_acls_request, - build_get_bytes_request, - build_get_complex_type_ref_no_meta_request, - build_get_complex_type_ref_with_meta_request, - build_get_empty_child_element_request, - build_get_empty_list_request, - build_get_empty_root_list_request, - build_get_empty_wrapped_lists_request, - build_get_headers_request, - build_get_root_list_request, - build_get_root_list_single_item_request, - build_get_service_properties_request, - build_get_simple_request, - build_get_uri_request, - build_get_wrapped_lists_request, - build_get_xms_text_request, - build_json_input_request, - build_json_output_request, - build_list_blobs_request, - build_list_containers_request, - build_put_acls_request, - build_put_binary_request, - build_put_complex_type_ref_no_meta_request, - build_put_complex_type_ref_with_meta_request, - build_put_empty_child_element_request, - build_put_empty_list_request, - build_put_empty_root_list_request, - build_put_empty_wrapped_lists_request, - build_put_root_list_request, - build_put_root_list_single_item_request, - build_put_service_properties_request, - build_put_simple_request, - build_put_uri_request, - build_put_wrapped_lists_request, -) - -T = TypeVar("T") +from ...operations._xml_operations import build_get_acls_request, build_get_bytes_request, build_get_complex_type_ref_no_meta_request, build_get_complex_type_ref_with_meta_request, build_get_empty_child_element_request, build_get_empty_list_request, build_get_empty_root_list_request, build_get_empty_wrapped_lists_request, build_get_headers_request, build_get_root_list_request, build_get_root_list_single_item_request, build_get_service_properties_request, build_get_simple_request, build_get_uri_request, build_get_wrapped_lists_request, build_get_xms_text_request, build_json_input_request, build_json_output_request, build_list_blobs_request, build_list_containers_request, build_put_acls_request, build_put_binary_request, build_put_complex_type_ref_no_meta_request, build_put_complex_type_ref_with_meta_request, build_put_empty_child_element_request, build_put_empty_list_request, build_put_empty_root_list_request, build_put_empty_wrapped_lists_request, build_put_root_list_request, build_put_root_list_single_item_request, build_put_service_properties_request, build_put_simple_request, build_put_uri_request, build_put_wrapped_lists_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class XmlOperations: +class XmlOperations: # pylint: disable=too-many-public-methods """XmlOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -87,7 +43,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> "_models.RootWithRefAndNoMeta": + async def get_complex_type_ref_no_meta( + self, + **kwargs: Any + ) -> "_models.RootWithRefAndNoMeta": """Get a complex type that has a ref to a complex type with no XML node. :keyword callable cls: A custom type or function that will be passed the direct response @@ -95,34 +54,46 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> "_models.RootWith :rtype: ~xmlservice.models.RootWithRefAndNoMeta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.RootWithRefAndNoMeta"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.RootWithRefAndNoMeta"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_type_ref_no_meta_request( - template_url=self.get_complex_type_ref_no_meta.metadata["url"], + template_url=self.get_complex_type_ref_no_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("RootWithRefAndNoMeta", pipeline_response) + deserialized = self._deserialize('RootWithRefAndNoMeta', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_type_ref_no_meta.metadata = {"url": "/xml/complex-type-ref-no-meta"} # type: ignore + get_complex_type_ref_no_meta.metadata = {'url': '/xml/complex-type-ref-no-meta'} # type: ignore + @distributed_trace_async - async def put_complex_type_ref_no_meta(self, model: "_models.RootWithRefAndNoMeta", **kwargs: Any) -> None: + async def put_complex_type_ref_no_meta( + self, + model: "_models.RootWithRefAndNoMeta", + **kwargs: Any + ) -> None: """Puts a complex type that has a ref to a complex type with no XML node. :param model: @@ -132,23 +103,29 @@ async def put_complex_type_ref_no_meta(self, model: "_models.RootWithRefAndNoMet :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(model, "RootWithRefAndNoMeta", is_xml=True) + _content = self._serialize.body(model, 'RootWithRefAndNoMeta', is_xml=True) request = build_put_complex_type_ref_no_meta_request( content_type=content_type, content=_content, - template_url=self.put_complex_type_ref_no_meta.metadata["url"], + template_url=self.put_complex_type_ref_no_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -158,10 +135,14 @@ async def put_complex_type_ref_no_meta(self, model: "_models.RootWithRefAndNoMet if cls: return cls(pipeline_response, None, {}) - put_complex_type_ref_no_meta.metadata = {"url": "/xml/complex-type-ref-no-meta"} # type: ignore + put_complex_type_ref_no_meta.metadata = {'url': '/xml/complex-type-ref-no-meta'} # type: ignore + @distributed_trace_async - async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> "_models.RootWithRefAndMeta": + async def get_complex_type_ref_with_meta( + self, + **kwargs: Any + ) -> "_models.RootWithRefAndMeta": """Get a complex type that has a ref to a complex type with XML node. :keyword callable cls: A custom type or function that will be passed the direct response @@ -169,34 +150,46 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> "_models.RootWi :rtype: ~xmlservice.models.RootWithRefAndMeta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.RootWithRefAndMeta"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.RootWithRefAndMeta"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_type_ref_with_meta_request( - template_url=self.get_complex_type_ref_with_meta.metadata["url"], + template_url=self.get_complex_type_ref_with_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("RootWithRefAndMeta", pipeline_response) + deserialized = self._deserialize('RootWithRefAndMeta', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_type_ref_with_meta.metadata = {"url": "/xml/complex-type-ref-with-meta"} # type: ignore + get_complex_type_ref_with_meta.metadata = {'url': '/xml/complex-type-ref-with-meta'} # type: ignore + @distributed_trace_async - async def put_complex_type_ref_with_meta(self, model: "_models.RootWithRefAndMeta", **kwargs: Any) -> None: + async def put_complex_type_ref_with_meta( + self, + model: "_models.RootWithRefAndMeta", + **kwargs: Any + ) -> None: """Puts a complex type that has a ref to a complex type with XML node. :param model: @@ -206,23 +199,29 @@ async def put_complex_type_ref_with_meta(self, model: "_models.RootWithRefAndMet :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(model, "RootWithRefAndMeta", is_xml=True) + _content = self._serialize.body(model, 'RootWithRefAndMeta', is_xml=True) request = build_put_complex_type_ref_with_meta_request( content_type=content_type, content=_content, - template_url=self.put_complex_type_ref_with_meta.metadata["url"], + template_url=self.put_complex_type_ref_with_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -232,10 +231,14 @@ async def put_complex_type_ref_with_meta(self, model: "_models.RootWithRefAndMet if cls: return cls(pipeline_response, None, {}) - put_complex_type_ref_with_meta.metadata = {"url": "/xml/complex-type-ref-with-meta"} # type: ignore + put_complex_type_ref_with_meta.metadata = {'url': '/xml/complex-type-ref-with-meta'} # type: ignore + @distributed_trace_async - async def get_simple(self, **kwargs: Any) -> "_models.Slideshow": + async def get_simple( + self, + **kwargs: Any + ) -> "_models.Slideshow": """Get a simple XML document. :keyword callable cls: A custom type or function that will be passed the direct response @@ -243,17 +246,24 @@ async def get_simple(self, **kwargs: Any) -> "_models.Slideshow": :rtype: ~xmlservice.models.Slideshow :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Slideshow"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Slideshow"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_simple_request( - template_url=self.get_simple.metadata["url"], + template_url=self.get_simple.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -261,17 +271,22 @@ async def get_simple(self, **kwargs: Any) -> "_models.Slideshow": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Slideshow", pipeline_response) + deserialized = self._deserialize('Slideshow', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_simple.metadata = {"url": "/xml/simple"} # type: ignore + get_simple.metadata = {'url': '/xml/simple'} # type: ignore + @distributed_trace_async - async def put_simple(self, slideshow: "_models.Slideshow", **kwargs: Any) -> None: + async def put_simple( + self, + slideshow: "_models.Slideshow", + **kwargs: Any + ) -> None: """Put a simple XML document. :param slideshow: @@ -281,23 +296,29 @@ async def put_simple(self, slideshow: "_models.Slideshow", **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(slideshow, "Slideshow", is_xml=True) + _content = self._serialize.body(slideshow, 'Slideshow', is_xml=True) request = build_put_simple_request( content_type=content_type, content=_content, - template_url=self.put_simple.metadata["url"], + template_url=self.put_simple.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -308,10 +329,14 @@ async def put_simple(self, slideshow: "_models.Slideshow", **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) - put_simple.metadata = {"url": "/xml/simple"} # type: ignore + put_simple.metadata = {'url': '/xml/simple'} # type: ignore + @distributed_trace_async - async def get_wrapped_lists(self, **kwargs: Any) -> "_models.AppleBarrel": + async def get_wrapped_lists( + self, + **kwargs: Any + ) -> "_models.AppleBarrel": """Get an XML document with multiple wrapped lists. :keyword callable cls: A custom type or function that will be passed the direct response @@ -319,34 +344,46 @@ async def get_wrapped_lists(self, **kwargs: Any) -> "_models.AppleBarrel": :rtype: ~xmlservice.models.AppleBarrel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AppleBarrel"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppleBarrel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_wrapped_lists_request( - template_url=self.get_wrapped_lists.metadata["url"], + template_url=self.get_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("AppleBarrel", pipeline_response) + deserialized = self._deserialize('AppleBarrel', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_wrapped_lists.metadata = {"url": "/xml/wrapped-lists"} # type: ignore + get_wrapped_lists.metadata = {'url': '/xml/wrapped-lists'} # type: ignore + @distributed_trace_async - async def put_wrapped_lists(self, wrapped_lists: "_models.AppleBarrel", **kwargs: Any) -> None: + async def put_wrapped_lists( + self, + wrapped_lists: "_models.AppleBarrel", + **kwargs: Any + ) -> None: """Put an XML document with multiple wrapped lists. :param wrapped_lists: @@ -356,23 +393,29 @@ async def put_wrapped_lists(self, wrapped_lists: "_models.AppleBarrel", **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(wrapped_lists, "AppleBarrel", is_xml=True) + _content = self._serialize.body(wrapped_lists, 'AppleBarrel', is_xml=True) request = build_put_wrapped_lists_request( content_type=content_type, content=_content, - template_url=self.put_wrapped_lists.metadata["url"], + template_url=self.put_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -383,10 +426,14 @@ async def put_wrapped_lists(self, wrapped_lists: "_models.AppleBarrel", **kwargs if cls: return cls(pipeline_response, None, {}) - put_wrapped_lists.metadata = {"url": "/xml/wrapped-lists"} # type: ignore + put_wrapped_lists.metadata = {'url': '/xml/wrapped-lists'} # type: ignore + @distributed_trace_async - async def get_headers(self, **kwargs: Any) -> None: + async def get_headers( + self, + **kwargs: Any + ) -> None: """Get strongly-typed response headers. :keyword callable cls: A custom type or function that will be passed the direct response @@ -394,17 +441,24 @@ async def get_headers(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_headers_request( - template_url=self.get_headers.metadata["url"], + template_url=self.get_headers.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -412,15 +466,20 @@ async def get_headers(self, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["Custom-Header"] = self._deserialize("str", response.headers.get("Custom-Header")) + response_headers['Custom-Header']=self._deserialize('str', response.headers.get('Custom-Header')) + if cls: return cls(pipeline_response, None, response_headers) - get_headers.metadata = {"url": "/xml/headers"} # type: ignore + get_headers.metadata = {'url': '/xml/headers'} # type: ignore + @distributed_trace_async - async def get_empty_list(self, **kwargs: Any) -> "_models.Slideshow": + async def get_empty_list( + self, + **kwargs: Any + ) -> "_models.Slideshow": """Get an empty list. :keyword callable cls: A custom type or function that will be passed the direct response @@ -428,34 +487,46 @@ async def get_empty_list(self, **kwargs: Any) -> "_models.Slideshow": :rtype: ~xmlservice.models.Slideshow :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Slideshow"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Slideshow"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_list_request( - template_url=self.get_empty_list.metadata["url"], + template_url=self.get_empty_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Slideshow", pipeline_response) + deserialized = self._deserialize('Slideshow', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_list.metadata = {"url": "/xml/empty-list"} # type: ignore + get_empty_list.metadata = {'url': '/xml/empty-list'} # type: ignore + @distributed_trace_async - async def put_empty_list(self, slideshow: "_models.Slideshow", **kwargs: Any) -> None: + async def put_empty_list( + self, + slideshow: "_models.Slideshow", + **kwargs: Any + ) -> None: """Puts an empty list. :param slideshow: @@ -465,23 +536,29 @@ async def put_empty_list(self, slideshow: "_models.Slideshow", **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(slideshow, "Slideshow", is_xml=True) + _content = self._serialize.body(slideshow, 'Slideshow', is_xml=True) request = build_put_empty_list_request( content_type=content_type, content=_content, - template_url=self.put_empty_list.metadata["url"], + template_url=self.put_empty_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -491,10 +568,14 @@ async def put_empty_list(self, slideshow: "_models.Slideshow", **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_empty_list.metadata = {"url": "/xml/empty-list"} # type: ignore + put_empty_list.metadata = {'url': '/xml/empty-list'} # type: ignore + @distributed_trace_async - async def get_empty_wrapped_lists(self, **kwargs: Any) -> "_models.AppleBarrel": + async def get_empty_wrapped_lists( + self, + **kwargs: Any + ) -> "_models.AppleBarrel": """Gets some empty wrapped lists. :keyword callable cls: A custom type or function that will be passed the direct response @@ -502,34 +583,46 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> "_models.AppleBarrel": :rtype: ~xmlservice.models.AppleBarrel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AppleBarrel"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppleBarrel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_wrapped_lists_request( - template_url=self.get_empty_wrapped_lists.metadata["url"], + template_url=self.get_empty_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("AppleBarrel", pipeline_response) + deserialized = self._deserialize('AppleBarrel', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_wrapped_lists.metadata = {"url": "/xml/empty-wrapped-lists"} # type: ignore + get_empty_wrapped_lists.metadata = {'url': '/xml/empty-wrapped-lists'} # type: ignore + @distributed_trace_async - async def put_empty_wrapped_lists(self, apple_barrel: "_models.AppleBarrel", **kwargs: Any) -> None: + async def put_empty_wrapped_lists( + self, + apple_barrel: "_models.AppleBarrel", + **kwargs: Any + ) -> None: """Puts some empty wrapped lists. :param apple_barrel: @@ -539,23 +632,29 @@ async def put_empty_wrapped_lists(self, apple_barrel: "_models.AppleBarrel", **k :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(apple_barrel, "AppleBarrel", is_xml=True) + _content = self._serialize.body(apple_barrel, 'AppleBarrel', is_xml=True) request = build_put_empty_wrapped_lists_request( content_type=content_type, content=_content, - template_url=self.put_empty_wrapped_lists.metadata["url"], + template_url=self.put_empty_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -565,10 +664,14 @@ async def put_empty_wrapped_lists(self, apple_barrel: "_models.AppleBarrel", **k if cls: return cls(pipeline_response, None, {}) - put_empty_wrapped_lists.metadata = {"url": "/xml/empty-wrapped-lists"} # type: ignore + put_empty_wrapped_lists.metadata = {'url': '/xml/empty-wrapped-lists'} # type: ignore + @distributed_trace_async - async def get_root_list(self, **kwargs: Any) -> List["_models.Banana"]: + async def get_root_list( + self, + **kwargs: Any + ) -> List["_models.Banana"]: """Gets a list as the root element. :keyword callable cls: A custom type or function that will be passed the direct response @@ -576,34 +679,46 @@ async def get_root_list(self, **kwargs: Any) -> List["_models.Banana"]: :rtype: list[~xmlservice.models.Banana] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Banana"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Banana"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_root_list_request( - template_url=self.get_root_list.metadata["url"], + template_url=self.get_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[Banana]", pipeline_response) + deserialized = self._deserialize('[Banana]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_root_list.metadata = {"url": "/xml/root-list"} # type: ignore + get_root_list.metadata = {'url': '/xml/root-list'} # type: ignore + @distributed_trace_async - async def put_root_list(self, bananas: List["_models.Banana"], **kwargs: Any) -> None: + async def put_root_list( + self, + bananas: List["_models.Banana"], + **kwargs: Any + ) -> None: """Puts a list as the root element. :param bananas: @@ -613,24 +728,30 @@ async def put_root_list(self, bananas: List["_models.Banana"], **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "bananas", "wrapped": True, "itemsName": "banana"}} - _content = self._serialize.body(bananas, "[Banana]", is_xml=True, serialization_ctxt=serialization_ctxt) + serialization_ctxt = {"xml": {'name': 'bananas', 'wrapped': True, 'itemsName': 'banana'}} + _content = self._serialize.body(bananas, '[Banana]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_root_list_request( content_type=content_type, content=_content, - template_url=self.put_root_list.metadata["url"], + template_url=self.put_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -640,10 +761,14 @@ async def put_root_list(self, bananas: List["_models.Banana"], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_root_list.metadata = {"url": "/xml/root-list"} # type: ignore + put_root_list.metadata = {'url': '/xml/root-list'} # type: ignore + @distributed_trace_async - async def get_root_list_single_item(self, **kwargs: Any) -> List["_models.Banana"]: + async def get_root_list_single_item( + self, + **kwargs: Any + ) -> List["_models.Banana"]: """Gets a list with a single item. :keyword callable cls: A custom type or function that will be passed the direct response @@ -651,34 +776,46 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List["_models.Banana :rtype: list[~xmlservice.models.Banana] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Banana"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Banana"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_root_list_single_item_request( - template_url=self.get_root_list_single_item.metadata["url"], + template_url=self.get_root_list_single_item.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[Banana]", pipeline_response) + deserialized = self._deserialize('[Banana]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_root_list_single_item.metadata = {"url": "/xml/root-list-single-item"} # type: ignore + get_root_list_single_item.metadata = {'url': '/xml/root-list-single-item'} # type: ignore + @distributed_trace_async - async def put_root_list_single_item(self, bananas: List["_models.Banana"], **kwargs: Any) -> None: + async def put_root_list_single_item( + self, + bananas: List["_models.Banana"], + **kwargs: Any + ) -> None: """Puts a list with a single item. :param bananas: @@ -688,24 +825,30 @@ async def put_root_list_single_item(self, bananas: List["_models.Banana"], **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "bananas", "wrapped": True, "itemsName": "banana"}} - _content = self._serialize.body(bananas, "[Banana]", is_xml=True, serialization_ctxt=serialization_ctxt) + serialization_ctxt = {"xml": {'name': 'bananas', 'wrapped': True, 'itemsName': 'banana'}} + _content = self._serialize.body(bananas, '[Banana]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_root_list_single_item_request( content_type=content_type, content=_content, - template_url=self.put_root_list_single_item.metadata["url"], + template_url=self.put_root_list_single_item.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -715,10 +858,14 @@ async def put_root_list_single_item(self, bananas: List["_models.Banana"], **kwa if cls: return cls(pipeline_response, None, {}) - put_root_list_single_item.metadata = {"url": "/xml/root-list-single-item"} # type: ignore + put_root_list_single_item.metadata = {'url': '/xml/root-list-single-item'} # type: ignore + @distributed_trace_async - async def get_empty_root_list(self, **kwargs: Any) -> List["_models.Banana"]: + async def get_empty_root_list( + self, + **kwargs: Any + ) -> List["_models.Banana"]: """Gets an empty list as the root element. :keyword callable cls: A custom type or function that will be passed the direct response @@ -726,34 +873,46 @@ async def get_empty_root_list(self, **kwargs: Any) -> List["_models.Banana"]: :rtype: list[~xmlservice.models.Banana] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Banana"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Banana"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_root_list_request( - template_url=self.get_empty_root_list.metadata["url"], + template_url=self.get_empty_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[Banana]", pipeline_response) + deserialized = self._deserialize('[Banana]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_root_list.metadata = {"url": "/xml/empty-root-list"} # type: ignore + get_empty_root_list.metadata = {'url': '/xml/empty-root-list'} # type: ignore + @distributed_trace_async - async def put_empty_root_list(self, bananas: List["_models.Banana"], **kwargs: Any) -> None: + async def put_empty_root_list( + self, + bananas: List["_models.Banana"], + **kwargs: Any + ) -> None: """Puts an empty list as the root element. :param bananas: @@ -763,24 +922,30 @@ async def put_empty_root_list(self, bananas: List["_models.Banana"], **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "bananas", "wrapped": True, "itemsName": "banana"}} - _content = self._serialize.body(bananas, "[Banana]", is_xml=True, serialization_ctxt=serialization_ctxt) + serialization_ctxt = {"xml": {'name': 'bananas', 'wrapped': True, 'itemsName': 'banana'}} + _content = self._serialize.body(bananas, '[Banana]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_empty_root_list_request( content_type=content_type, content=_content, - template_url=self.put_empty_root_list.metadata["url"], + template_url=self.put_empty_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -790,10 +955,14 @@ async def put_empty_root_list(self, bananas: List["_models.Banana"], **kwargs: A if cls: return cls(pipeline_response, None, {}) - put_empty_root_list.metadata = {"url": "/xml/empty-root-list"} # type: ignore + put_empty_root_list.metadata = {'url': '/xml/empty-root-list'} # type: ignore + @distributed_trace_async - async def get_empty_child_element(self, **kwargs: Any) -> "_models.Banana": + async def get_empty_child_element( + self, + **kwargs: Any + ) -> "_models.Banana": """Gets an XML document with an empty child element. :keyword callable cls: A custom type or function that will be passed the direct response @@ -801,34 +970,46 @@ async def get_empty_child_element(self, **kwargs: Any) -> "_models.Banana": :rtype: ~xmlservice.models.Banana :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Banana"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Banana"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_child_element_request( - template_url=self.get_empty_child_element.metadata["url"], + template_url=self.get_empty_child_element.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Banana", pipeline_response) + deserialized = self._deserialize('Banana', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_child_element.metadata = {"url": "/xml/empty-child-element"} # type: ignore + get_empty_child_element.metadata = {'url': '/xml/empty-child-element'} # type: ignore + @distributed_trace_async - async def put_empty_child_element(self, banana: "_models.Banana", **kwargs: Any) -> None: + async def put_empty_child_element( + self, + banana: "_models.Banana", + **kwargs: Any + ) -> None: """Puts a value with an empty child element. :param banana: @@ -838,23 +1019,29 @@ async def put_empty_child_element(self, banana: "_models.Banana", **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(banana, "Banana", is_xml=True) + _content = self._serialize.body(banana, 'Banana', is_xml=True) request = build_put_empty_child_element_request( content_type=content_type, content=_content, - template_url=self.put_empty_child_element.metadata["url"], + template_url=self.put_empty_child_element.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -864,10 +1051,14 @@ async def put_empty_child_element(self, banana: "_models.Banana", **kwargs: Any) if cls: return cls(pipeline_response, None, {}) - put_empty_child_element.metadata = {"url": "/xml/empty-child-element"} # type: ignore + put_empty_child_element.metadata = {'url': '/xml/empty-child-element'} # type: ignore + @distributed_trace_async - async def list_containers(self, **kwargs: Any) -> "_models.ListContainersResponse": + async def list_containers( + self, + **kwargs: Any + ) -> "_models.ListContainersResponse": """Lists containers in a storage account. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -878,37 +1069,48 @@ async def list_containers(self, **kwargs: Any) -> "_models.ListContainersRespons :rtype: ~xmlservice.models.ListContainersResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ListContainersResponse"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainersResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str + comp = kwargs.pop('comp', "list") # type: str + request = build_list_containers_request( comp=comp, - template_url=self.list_containers.metadata["url"], + template_url=self.list_containers.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ListContainersResponse", pipeline_response) + deserialized = self._deserialize('ListContainersResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_containers.metadata = {"url": "/xml/"} # type: ignore + list_containers.metadata = {'url': '/xml/'} # type: ignore + @distributed_trace_async - async def get_service_properties(self, **kwargs: Any) -> "_models.StorageServiceProperties": + async def get_service_properties( + self, + **kwargs: Any + ) -> "_models.StorageServiceProperties": """Gets storage service properties. :keyword comp: The default value is "properties". Note that overriding this default value may @@ -922,39 +1124,51 @@ async def get_service_properties(self, **kwargs: Any) -> "_models.StorageService :rtype: ~xmlservice.models.StorageServiceProperties :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageServiceProperties"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + request = build_get_service_properties_request( comp=comp, restype=restype, - template_url=self.get_service_properties.metadata["url"], + template_url=self.get_service_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("StorageServiceProperties", pipeline_response) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_service_properties.metadata = {"url": "/xml/"} # type: ignore + get_service_properties.metadata = {'url': '/xml/'} # type: ignore + @distributed_trace_async - async def put_service_properties(self, properties: "_models.StorageServiceProperties", **kwargs: Any) -> None: + async def put_service_properties( + self, + properties: "_models.StorageServiceProperties", + **kwargs: Any + ) -> None: """Puts storage service properties. :param properties: @@ -970,27 +1184,33 @@ async def put_service_properties(self, properties: "_models.StorageServiceProper :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(properties, "StorageServiceProperties", is_xml=True) + _content = self._serialize.body(properties, 'StorageServiceProperties', is_xml=True) request = build_put_service_properties_request( comp=comp, restype=restype, content_type=content_type, content=_content, - template_url=self.put_service_properties.metadata["url"], + template_url=self.put_service_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1000,10 +1220,14 @@ async def put_service_properties(self, properties: "_models.StorageServiceProper if cls: return cls(pipeline_response, None, {}) - put_service_properties.metadata = {"url": "/xml/"} # type: ignore + put_service_properties.metadata = {'url': '/xml/'} # type: ignore + @distributed_trace_async - async def get_acls(self, **kwargs: Any) -> List["_models.SignedIdentifier"]: + async def get_acls( + self, + **kwargs: Any + ) -> List["_models.SignedIdentifier"]: """Gets storage ACLs for a container. :keyword comp: The default value is "acl". Note that overriding this default value may result @@ -1017,39 +1241,51 @@ async def get_acls(self, **kwargs: Any) -> List["_models.SignedIdentifier"]: :rtype: list[~xmlservice.models.SignedIdentifier] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.SignedIdentifier"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.SignedIdentifier"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_get_acls_request( comp=comp, restype=restype, - template_url=self.get_acls.metadata["url"], + template_url=self.get_acls.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[SignedIdentifier]", pipeline_response) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_acls.metadata = {"url": "/xml/mycontainer"} # type: ignore + get_acls.metadata = {'url': '/xml/mycontainer'} # type: ignore + @distributed_trace_async - async def put_acls(self, properties: List["_models.SignedIdentifier"], **kwargs: Any) -> None: + async def put_acls( + self, + properties: List["_models.SignedIdentifier"], + **kwargs: Any + ) -> None: """Puts storage ACLs for a container. :param properties: @@ -1065,30 +1301,34 @@ async def put_acls(self, properties: List["_models.SignedIdentifier"], **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "SignedIdentifiers", "wrapped": True, "itemsName": "SignedIdentifier"}} - _content = self._serialize.body( - properties, "[SignedIdentifier]", is_xml=True, serialization_ctxt=serialization_ctxt - ) + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} + _content = self._serialize.body(properties, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_acls_request( comp=comp, restype=restype, content_type=content_type, content=_content, - template_url=self.put_acls.metadata["url"], + template_url=self.put_acls.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1098,10 +1338,14 @@ async def put_acls(self, properties: List["_models.SignedIdentifier"], **kwargs: if cls: return cls(pipeline_response, None, {}) - put_acls.metadata = {"url": "/xml/mycontainer"} # type: ignore + put_acls.metadata = {'url': '/xml/mycontainer'} # type: ignore + @distributed_trace_async - async def list_blobs(self, **kwargs: Any) -> "_models.ListBlobsResponse": + async def list_blobs( + self, + **kwargs: Any + ) -> "_models.ListBlobsResponse": """Lists blobs in a storage container. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -1115,39 +1359,51 @@ async def list_blobs(self, **kwargs: Any) -> "_models.ListBlobsResponse": :rtype: ~xmlservice.models.ListBlobsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ListBlobsResponse"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_list_blobs_request( comp=comp, restype=restype, - template_url=self.list_blobs.metadata["url"], + template_url=self.list_blobs.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ListBlobsResponse", pipeline_response) + deserialized = self._deserialize('ListBlobsResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_blobs.metadata = {"url": "/xml/mycontainer"} # type: ignore + list_blobs.metadata = {'url': '/xml/mycontainer'} # type: ignore + @distributed_trace_async - async def json_input(self, id: Optional[int] = None, **kwargs: Any) -> None: + async def json_input( + self, + id: Optional[int] = None, + **kwargs: Any + ) -> None: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -1158,24 +1414,30 @@ async def json_input(self, id: Optional[int] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _properties = _models.JSONInput(id=id) - _json = self._serialize.body(_properties, "JSONInput") + _json = self._serialize.body(_properties, 'JSONInput') request = build_json_input_request( content_type=content_type, json=_json, - template_url=self.json_input.metadata["url"], + template_url=self.json_input.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1185,10 +1447,14 @@ async def json_input(self, id: Optional[int] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - json_input.metadata = {"url": "/xml/jsoninput"} # type: ignore + json_input.metadata = {'url': '/xml/jsoninput'} # type: ignore + @distributed_trace_async - async def json_output(self, **kwargs: Any) -> "_models.JSONOutput": + async def json_output( + self, + **kwargs: Any + ) -> "_models.JSONOutput": """A Swagger with XML that has one operation that returns JSON. ID number 42. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1196,34 +1462,45 @@ async def json_output(self, **kwargs: Any) -> "_models.JSONOutput": :rtype: ~xmlservice.models.JSONOutput :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.JSONOutput"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.JSONOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_json_output_request( - template_url=self.json_output.metadata["url"], + template_url=self.json_output.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("JSONOutput", pipeline_response) + deserialized = self._deserialize('JSONOutput', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - json_output.metadata = {"url": "/xml/jsonoutput"} # type: ignore + json_output.metadata = {'url': '/xml/jsonoutput'} # type: ignore + @distributed_trace_async - async def get_xms_text(self, **kwargs: Any) -> "_models.ObjectWithXMsTextProperty": + async def get_xms_text( + self, + **kwargs: Any + ) -> "_models.ObjectWithXMsTextProperty": """Get back an XML object with an x-ms-text property, which should translate to the returned object's 'language' property being 'english' and its 'content' property being 'I am text'. @@ -1232,34 +1509,45 @@ async def get_xms_text(self, **kwargs: Any) -> "_models.ObjectWithXMsTextPropert :rtype: ~xmlservice.models.ObjectWithXMsTextProperty :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ObjectWithXMsTextProperty"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectWithXMsTextProperty"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_xms_text_request( - template_url=self.get_xms_text.metadata["url"], + template_url=self.get_xms_text.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ObjectWithXMsTextProperty", pipeline_response) + deserialized = self._deserialize('ObjectWithXMsTextProperty', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_xms_text.metadata = {"url": "/xml/x-ms-text"} # type: ignore + get_xms_text.metadata = {'url': '/xml/x-ms-text'} # type: ignore + @distributed_trace_async - async def get_bytes(self, **kwargs: Any) -> "_models.ModelWithByteProperty": + async def get_bytes( + self, + **kwargs: Any + ) -> "_models.ModelWithByteProperty": """Get an XML document with binary property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1267,17 +1555,24 @@ async def get_bytes(self, **kwargs: Any) -> "_models.ModelWithByteProperty": :rtype: ~xmlservice.models.ModelWithByteProperty :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ModelWithByteProperty"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ModelWithByteProperty"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_bytes_request( - template_url=self.get_bytes.metadata["url"], + template_url=self.get_bytes.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1285,17 +1580,22 @@ async def get_bytes(self, **kwargs: Any) -> "_models.ModelWithByteProperty": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ModelWithByteProperty", pipeline_response) + deserialized = self._deserialize('ModelWithByteProperty', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_bytes.metadata = {"url": "/xml/bytes"} # type: ignore + get_bytes.metadata = {'url': '/xml/bytes'} # type: ignore + @distributed_trace_async - async def put_binary(self, bytes: Optional[bytearray] = None, **kwargs: Any) -> None: + async def put_binary( + self, + bytes: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Put an XML document with binary property. :param bytes: @@ -1305,24 +1605,30 @@ async def put_binary(self, bytes: Optional[bytearray] = None, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _slideshow = _models.ModelWithByteProperty(bytes=bytes) - _content = self._serialize.body(_slideshow, "ModelWithByteProperty", is_xml=True) + _content = self._serialize.body(_slideshow, 'ModelWithByteProperty', is_xml=True) request = build_put_binary_request( content_type=content_type, content=_content, - template_url=self.put_binary.metadata["url"], + template_url=self.put_binary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1333,10 +1639,14 @@ async def put_binary(self, bytes: Optional[bytearray] = None, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) - put_binary.metadata = {"url": "/xml/bytes"} # type: ignore + put_binary.metadata = {'url': '/xml/bytes'} # type: ignore + @distributed_trace_async - async def get_uri(self, **kwargs: Any) -> "_models.ModelWithUrlProperty": + async def get_uri( + self, + **kwargs: Any + ) -> "_models.ModelWithUrlProperty": """Get an XML document with uri property. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1344,17 +1654,24 @@ async def get_uri(self, **kwargs: Any) -> "_models.ModelWithUrlProperty": :rtype: ~xmlservice.models.ModelWithUrlProperty :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ModelWithUrlProperty"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ModelWithUrlProperty"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uri_request( - template_url=self.get_uri.metadata["url"], + template_url=self.get_uri.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1362,17 +1679,22 @@ async def get_uri(self, **kwargs: Any) -> "_models.ModelWithUrlProperty": error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ModelWithUrlProperty", pipeline_response) + deserialized = self._deserialize('ModelWithUrlProperty', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uri.metadata = {"url": "/xml/url"} # type: ignore + get_uri.metadata = {'url': '/xml/url'} # type: ignore + @distributed_trace_async - async def put_uri(self, url: Optional[str] = None, **kwargs: Any) -> None: + async def put_uri( + self, + url: Optional[str] = None, + **kwargs: Any + ) -> None: """Put an XML document with uri property. :param url: @@ -1382,24 +1704,30 @@ async def put_uri(self, url: Optional[str] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _model = _models.ModelWithUrlProperty(url=url) - _content = self._serialize.body(_model, "ModelWithUrlProperty", is_xml=True) + _content = self._serialize.body(_model, 'ModelWithUrlProperty', is_xml=True) request = build_put_uri_request( content_type=content_type, content=_content, - template_url=self.put_uri.metadata["url"], + template_url=self.put_uri.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1410,4 +1738,5 @@ async def put_uri(self, url: Optional[str] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) - put_uri.metadata = {"url": "/xml/url"} # type: ignore + put_uri.metadata = {'url': '/xml/url'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py index 9495fbc8bf0..e0a1ef22ccd 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py @@ -79,41 +79,41 @@ ) __all__ = [ - "AccessPolicy", - "AppleBarrel", - "Banana", - "Blob", - "BlobPrefix", - "BlobProperties", - "Blobs", - "ComplexTypeNoMeta", - "ComplexTypeWithMeta", - "Container", - "ContainerProperties", - "CorsRule", - "Error", - "JSONInput", - "JSONOutput", - "ListBlobsResponse", - "ListContainersResponse", - "Logging", - "Metrics", - "ModelWithByteProperty", - "ModelWithUrlProperty", - "ObjectWithXMsTextProperty", - "RetentionPolicy", - "RootWithRefAndMeta", - "RootWithRefAndNoMeta", - "SignedIdentifier", - "Slide", - "Slideshow", - "StorageServiceProperties", - "AccessTier", - "ArchiveStatus", - "BlobType", - "CopyStatusType", - "LeaseDurationType", - "LeaseStateType", - "LeaseStatusType", - "PublicAccessType", + 'AccessPolicy', + 'AppleBarrel', + 'Banana', + 'Blob', + 'BlobPrefix', + 'BlobProperties', + 'Blobs', + 'ComplexTypeNoMeta', + 'ComplexTypeWithMeta', + 'Container', + 'ContainerProperties', + 'CorsRule', + 'Error', + 'JSONInput', + 'JSONOutput', + 'ListBlobsResponse', + 'ListContainersResponse', + 'Logging', + 'Metrics', + 'ModelWithByteProperty', + 'ModelWithUrlProperty', + 'ObjectWithXMsTextProperty', + 'RetentionPolicy', + 'RootWithRefAndMeta', + 'RootWithRefAndNoMeta', + 'SignedIdentifier', + 'Slide', + 'Slideshow', + 'StorageServiceProperties', + 'AccessTier', + 'ArchiveStatus', + 'BlobType', + 'CopyStatusType', + 'LeaseDurationType', + 'LeaseStateType', + 'LeaseStatusType', + 'PublicAccessType', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_auto_rest_swagger_batxml_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_auto_rest_swagger_batxml_service_enums.py index 598c7ea0494..4592ec64ca1 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_auto_rest_swagger_batxml_service_enums.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_auto_rest_swagger_batxml_service_enums.py @@ -24,20 +24,17 @@ class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" ARCHIVE = "Archive" - class ArchiveStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REHYDRATE_PENDING_TO_HOT = "rehydrate-pending-to-hot" REHYDRATE_PENDING_TO_COOL = "rehydrate-pending-to-cool" - class BlobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): BLOCK_BLOB = "BlockBlob" PAGE_BLOB = "PageBlob" APPEND_BLOB = "AppendBlob" - class CopyStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PENDING = "pending" @@ -45,13 +42,11 @@ class CopyStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ABORTED = "aborted" FAILED = "failed" - class LeaseDurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "infinite" FIXED = "fixed" - class LeaseStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" @@ -60,13 +55,11 @@ class LeaseStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "breaking" BROKEN = "broken" - class LeaseStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOCKED = "locked" UNLOCKED = "unlocked" - class PublicAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CONTAINER = "container" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py index 5543a97d061..e6d0d75f3a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py @@ -24,18 +24,21 @@ class AccessPolicy(msrest.serialization.Model): """ _validation = { - "start": {"required": True}, - "expiry": {"required": True}, - "permission": {"required": True}, + 'start': {'required': True}, + 'expiry': {'required': True}, + 'permission': {'required': True}, } _attribute_map = { - "start": {"key": "Start", "type": "iso-8601"}, - "expiry": {"key": "Expiry", "type": "iso-8601"}, - "permission": {"key": "Permission", "type": "str"}, + 'start': {'key': 'Start', 'type': 'iso-8601'}, + 'expiry': {'key': 'Expiry', 'type': 'iso-8601'}, + 'permission': {'key': 'Permission', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword start: Required. the date-time the policy is active. :paramtype start: ~datetime.datetime @@ -45,9 +48,9 @@ def __init__(self, **kwargs): :paramtype permission: str """ super(AccessPolicy, self).__init__(**kwargs) - self.start = kwargs["start"] - self.expiry = kwargs["expiry"] - self.permission = kwargs["permission"] + self.start = kwargs['start'] + self.expiry = kwargs['expiry'] + self.permission = kwargs['permission'] class AppleBarrel(msrest.serialization.Model): @@ -60,11 +63,14 @@ class AppleBarrel(msrest.serialization.Model): """ _attribute_map = { - "good_apples": {"key": "GoodApples", "type": "[str]", "xml": {"wrapped": True, "itemsName": "Apple"}}, - "bad_apples": {"key": "BadApples", "type": "[str]", "xml": {"wrapped": True, "itemsName": "Apple"}}, + 'good_apples': {'key': 'GoodApples', 'type': '[str]', 'xml': {'wrapped': True, 'itemsName': 'Apple'}}, + 'bad_apples': {'key': 'BadApples', 'type': '[str]', 'xml': {'wrapped': True, 'itemsName': 'Apple'}}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword good_apples: :paramtype good_apples: list[str] @@ -72,8 +78,8 @@ def __init__(self, **kwargs): :paramtype bad_apples: list[str] """ super(AppleBarrel, self).__init__(**kwargs) - self.good_apples = kwargs.get("good_apples", None) - self.bad_apples = kwargs.get("bad_apples", None) + self.good_apples = kwargs.get('good_apples', None) + self.bad_apples = kwargs.get('bad_apples', None) class Banana(msrest.serialization.Model): @@ -88,13 +94,18 @@ class Banana(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str", "xml": {"name": "name"}}, - "flavor": {"key": "flavor", "type": "str", "xml": {"name": "flavor"}}, - "expiration": {"key": "expiration", "type": "iso-8601", "xml": {"name": "expiration"}}, + 'name': {'key': 'name', 'type': 'str', 'xml': {'name': 'name'}}, + 'flavor': {'key': 'flavor', 'type': 'str', 'xml': {'name': 'flavor'}}, + 'expiration': {'key': 'expiration', 'type': 'iso-8601', 'xml': {'name': 'expiration'}}, + } + _xml_map = { + 'name': 'banana' } - _xml_map = {"name": "banana"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: :paramtype name: str @@ -104,9 +115,9 @@ def __init__(self, **kwargs): :paramtype expiration: ~datetime.datetime """ super(Banana, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.flavor = kwargs.get("flavor", None) - self.expiration = kwargs.get("expiration", None) + self.name = kwargs.get('name', None) + self.flavor = kwargs.get('flavor', None) + self.expiration = kwargs.get('expiration', None) class Blob(msrest.serialization.Model): @@ -127,22 +138,27 @@ class Blob(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, - "deleted": {"required": True}, - "snapshot": {"required": True}, - "properties": {"required": True}, + 'name': {'required': True}, + 'deleted': {'required': True}, + 'snapshot': {'required': True}, + 'properties': {'required': True}, } _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "deleted": {"key": "Deleted", "type": "bool"}, - "snapshot": {"key": "Snapshot", "type": "str"}, - "properties": {"key": "Properties", "type": "BlobProperties"}, - "metadata": {"key": "Metadata", "type": "{str}"}, + 'name': {'key': 'Name', 'type': 'str'}, + 'deleted': {'key': 'Deleted', 'type': 'bool'}, + 'snapshot': {'key': 'Snapshot', 'type': 'str'}, + 'properties': {'key': 'Properties', 'type': 'BlobProperties'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, + } + _xml_map = { + 'name': 'Blob' } - _xml_map = {"name": "Blob"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -156,11 +172,11 @@ def __init__(self, **kwargs): :paramtype metadata: dict[str, str] """ super(Blob, self).__init__(**kwargs) - self.name = kwargs["name"] - self.deleted = kwargs["deleted"] - self.snapshot = kwargs["snapshot"] - self.properties = kwargs["properties"] - self.metadata = kwargs.get("metadata", None) + self.name = kwargs['name'] + self.deleted = kwargs['deleted'] + self.snapshot = kwargs['snapshot'] + self.properties = kwargs['properties'] + self.metadata = kwargs.get('metadata', None) class BlobPrefix(msrest.serialization.Model): @@ -173,20 +189,23 @@ class BlobPrefix(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "Name", "type": "str"}, + 'name': {'key': 'Name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Required. :paramtype name: str """ super(BlobPrefix, self).__init__(**kwargs) - self.name = kwargs["name"] + self.name = kwargs['name'] class BlobProperties(msrest.serialization.Model): @@ -256,42 +275,45 @@ class BlobProperties(msrest.serialization.Model): """ _validation = { - "last_modified": {"required": True}, - "etag": {"required": True}, + 'last_modified': {'required': True}, + 'etag': {'required': True}, } _attribute_map = { - "last_modified": {"key": "Last-Modified", "type": "rfc-1123"}, - "etag": {"key": "Etag", "type": "str"}, - "content_length": {"key": "Content-Length", "type": "long"}, - "content_type": {"key": "Content-Type", "type": "str"}, - "content_encoding": {"key": "Content-Encoding", "type": "str"}, - "content_language": {"key": "Content-Language", "type": "str"}, - "content_md5": {"key": "Content-MD5", "type": "str"}, - "content_disposition": {"key": "Content-Disposition", "type": "str"}, - "cache_control": {"key": "Cache-Control", "type": "str"}, - "blob_sequence_number": {"key": "x-ms-blob-sequence-number", "type": "int"}, - "blob_type": {"key": "BlobType", "type": "str"}, - "lease_status": {"key": "LeaseStatus", "type": "str"}, - "lease_state": {"key": "LeaseState", "type": "str"}, - "lease_duration": {"key": "LeaseDuration", "type": "str"}, - "copy_id": {"key": "CopyId", "type": "str"}, - "copy_status": {"key": "CopyStatus", "type": "str"}, - "copy_source": {"key": "CopySource", "type": "str"}, - "copy_progress": {"key": "CopyProgress", "type": "str"}, - "copy_completion_time": {"key": "CopyCompletionTime", "type": "rfc-1123"}, - "copy_status_description": {"key": "CopyStatusDescription", "type": "str"}, - "server_encrypted": {"key": "ServerEncrypted", "type": "bool"}, - "incremental_copy": {"key": "IncrementalCopy", "type": "bool"}, - "destination_snapshot": {"key": "DestinationSnapshot", "type": "str"}, - "deleted_time": {"key": "DeletedTime", "type": "rfc-1123"}, - "remaining_retention_days": {"key": "RemainingRetentionDays", "type": "int"}, - "access_tier": {"key": "AccessTier", "type": "str"}, - "access_tier_inferred": {"key": "AccessTierInferred", "type": "bool"}, - "archive_status": {"key": "ArchiveStatus", "type": "str"}, + 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123'}, + 'etag': {'key': 'Etag', 'type': 'str'}, + 'content_length': {'key': 'Content-Length', 'type': 'long'}, + 'content_type': {'key': 'Content-Type', 'type': 'str'}, + 'content_encoding': {'key': 'Content-Encoding', 'type': 'str'}, + 'content_language': {'key': 'Content-Language', 'type': 'str'}, + 'content_md5': {'key': 'Content-MD5', 'type': 'str'}, + 'content_disposition': {'key': 'Content-Disposition', 'type': 'str'}, + 'cache_control': {'key': 'Cache-Control', 'type': 'str'}, + 'blob_sequence_number': {'key': 'x-ms-blob-sequence-number', 'type': 'int'}, + 'blob_type': {'key': 'BlobType', 'type': 'str'}, + 'lease_status': {'key': 'LeaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'LeaseState', 'type': 'str'}, + 'lease_duration': {'key': 'LeaseDuration', 'type': 'str'}, + 'copy_id': {'key': 'CopyId', 'type': 'str'}, + 'copy_status': {'key': 'CopyStatus', 'type': 'str'}, + 'copy_source': {'key': 'CopySource', 'type': 'str'}, + 'copy_progress': {'key': 'CopyProgress', 'type': 'str'}, + 'copy_completion_time': {'key': 'CopyCompletionTime', 'type': 'rfc-1123'}, + 'copy_status_description': {'key': 'CopyStatusDescription', 'type': 'str'}, + 'server_encrypted': {'key': 'ServerEncrypted', 'type': 'bool'}, + 'incremental_copy': {'key': 'IncrementalCopy', 'type': 'bool'}, + 'destination_snapshot': {'key': 'DestinationSnapshot', 'type': 'str'}, + 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123'}, + 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'AccessTier', 'type': 'str'}, + 'access_tier_inferred': {'key': 'AccessTierInferred', 'type': 'bool'}, + 'archive_status': {'key': 'ArchiveStatus', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword last_modified: Required. :paramtype last_modified: ~datetime.datetime @@ -354,34 +376,34 @@ def __init__(self, **kwargs): :paramtype archive_status: str or ~xmlservice.models.ArchiveStatus """ super(BlobProperties, self).__init__(**kwargs) - self.last_modified = kwargs["last_modified"] - self.etag = kwargs["etag"] - self.content_length = kwargs.get("content_length", None) - self.content_type = kwargs.get("content_type", None) - self.content_encoding = kwargs.get("content_encoding", None) - self.content_language = kwargs.get("content_language", None) - self.content_md5 = kwargs.get("content_md5", None) - self.content_disposition = kwargs.get("content_disposition", None) - self.cache_control = kwargs.get("cache_control", None) - self.blob_sequence_number = kwargs.get("blob_sequence_number", None) - self.blob_type = kwargs.get("blob_type", None) - self.lease_status = kwargs.get("lease_status", None) - self.lease_state = kwargs.get("lease_state", None) - self.lease_duration = kwargs.get("lease_duration", None) - self.copy_id = kwargs.get("copy_id", None) - self.copy_status = kwargs.get("copy_status", None) - self.copy_source = kwargs.get("copy_source", None) - self.copy_progress = kwargs.get("copy_progress", None) - self.copy_completion_time = kwargs.get("copy_completion_time", None) - self.copy_status_description = kwargs.get("copy_status_description", None) - self.server_encrypted = kwargs.get("server_encrypted", None) - self.incremental_copy = kwargs.get("incremental_copy", None) - self.destination_snapshot = kwargs.get("destination_snapshot", None) - self.deleted_time = kwargs.get("deleted_time", None) - self.remaining_retention_days = kwargs.get("remaining_retention_days", None) - self.access_tier = kwargs.get("access_tier", None) - self.access_tier_inferred = kwargs.get("access_tier_inferred", None) - self.archive_status = kwargs.get("archive_status", None) + self.last_modified = kwargs['last_modified'] + self.etag = kwargs['etag'] + self.content_length = kwargs.get('content_length', None) + self.content_type = kwargs.get('content_type', None) + self.content_encoding = kwargs.get('content_encoding', None) + self.content_language = kwargs.get('content_language', None) + self.content_md5 = kwargs.get('content_md5', None) + self.content_disposition = kwargs.get('content_disposition', None) + self.cache_control = kwargs.get('cache_control', None) + self.blob_sequence_number = kwargs.get('blob_sequence_number', None) + self.blob_type = kwargs.get('blob_type', None) + self.lease_status = kwargs.get('lease_status', None) + self.lease_state = kwargs.get('lease_state', None) + self.lease_duration = kwargs.get('lease_duration', None) + self.copy_id = kwargs.get('copy_id', None) + self.copy_status = kwargs.get('copy_status', None) + self.copy_source = kwargs.get('copy_source', None) + self.copy_progress = kwargs.get('copy_progress', None) + self.copy_completion_time = kwargs.get('copy_completion_time', None) + self.copy_status_description = kwargs.get('copy_status_description', None) + self.server_encrypted = kwargs.get('server_encrypted', None) + self.incremental_copy = kwargs.get('incremental_copy', None) + self.destination_snapshot = kwargs.get('destination_snapshot', None) + self.deleted_time = kwargs.get('deleted_time', None) + self.remaining_retention_days = kwargs.get('remaining_retention_days', None) + self.access_tier = kwargs.get('access_tier', None) + self.access_tier_inferred = kwargs.get('access_tier_inferred', None) + self.archive_status = kwargs.get('archive_status', None) class Blobs(msrest.serialization.Model): @@ -394,11 +416,14 @@ class Blobs(msrest.serialization.Model): """ _attribute_map = { - "blob_prefix": {"key": "BlobPrefix", "type": "[BlobPrefix]"}, - "blob": {"key": "Blob", "type": "[Blob]"}, + 'blob_prefix': {'key': 'BlobPrefix', 'type': '[BlobPrefix]'}, + 'blob': {'key': 'Blob', 'type': '[Blob]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword blob_prefix: :paramtype blob_prefix: list[~xmlservice.models.BlobPrefix] @@ -406,8 +431,8 @@ def __init__(self, **kwargs): :paramtype blob: list[~xmlservice.models.Blob] """ super(Blobs, self).__init__(**kwargs) - self.blob_prefix = kwargs.get("blob_prefix", None) - self.blob = kwargs.get("blob", None) + self.blob_prefix = kwargs.get('blob_prefix', None) + self.blob = kwargs.get('blob', None) class ComplexTypeNoMeta(msrest.serialization.Model): @@ -418,16 +443,19 @@ class ComplexTypeNoMeta(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "ID", "type": "str"}, + 'id': {'key': 'ID', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: The id of the res. :paramtype id: str """ super(ComplexTypeNoMeta, self).__init__(**kwargs) - self.id = kwargs.get("id", None) + self.id = kwargs.get('id', None) class ComplexTypeWithMeta(msrest.serialization.Model): @@ -438,17 +466,22 @@ class ComplexTypeWithMeta(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "ID", "type": "str"}, + 'id': {'key': 'ID', 'type': 'str'}, + } + _xml_map = { + 'name': 'XMLComplexTypeWithMeta' } - _xml_map = {"name": "XMLComplexTypeWithMeta"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: The id of the res. :paramtype id: str """ super(ComplexTypeWithMeta, self).__init__(**kwargs) - self.id = kwargs.get("id", None) + self.id = kwargs.get('id', None) class Container(msrest.serialization.Model): @@ -465,17 +498,20 @@ class Container(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, - "properties": {"required": True}, + 'name': {'required': True}, + 'properties': {'required': True}, } _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "properties": {"key": "Properties", "type": "ContainerProperties"}, - "metadata": {"key": "Metadata", "type": "{str}"}, + 'name': {'key': 'Name', 'type': 'str'}, + 'properties': {'key': 'Properties', 'type': 'ContainerProperties'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -485,9 +521,9 @@ def __init__(self, **kwargs): :paramtype metadata: dict[str, str] """ super(Container, self).__init__(**kwargs) - self.name = kwargs["name"] - self.properties = kwargs["properties"] - self.metadata = kwargs.get("metadata", None) + self.name = kwargs['name'] + self.properties = kwargs['properties'] + self.metadata = kwargs.get('metadata', None) class ContainerProperties(msrest.serialization.Model): @@ -511,20 +547,23 @@ class ContainerProperties(msrest.serialization.Model): """ _validation = { - "last_modified": {"required": True}, - "etag": {"required": True}, + 'last_modified': {'required': True}, + 'etag': {'required': True}, } _attribute_map = { - "last_modified": {"key": "Last-Modified", "type": "rfc-1123"}, - "etag": {"key": "Etag", "type": "str"}, - "lease_status": {"key": "LeaseStatus", "type": "str"}, - "lease_state": {"key": "LeaseState", "type": "str"}, - "lease_duration": {"key": "LeaseDuration", "type": "str"}, - "public_access": {"key": "PublicAccess", "type": "str"}, + 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123'}, + 'etag': {'key': 'Etag', 'type': 'str'}, + 'lease_status': {'key': 'LeaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'LeaseState', 'type': 'str'}, + 'lease_duration': {'key': 'LeaseDuration', 'type': 'str'}, + 'public_access': {'key': 'PublicAccess', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword last_modified: Required. :paramtype last_modified: ~datetime.datetime @@ -541,12 +580,12 @@ def __init__(self, **kwargs): :paramtype public_access: str or ~xmlservice.models.PublicAccessType """ super(ContainerProperties, self).__init__(**kwargs) - self.last_modified = kwargs["last_modified"] - self.etag = kwargs["etag"] - self.lease_status = kwargs.get("lease_status", None) - self.lease_state = kwargs.get("lease_state", None) - self.lease_duration = kwargs.get("lease_duration", None) - self.public_access = kwargs.get("public_access", None) + self.last_modified = kwargs['last_modified'] + self.etag = kwargs['etag'] + self.lease_status = kwargs.get('lease_status', None) + self.lease_state = kwargs.get('lease_state', None) + self.lease_duration = kwargs.get('lease_duration', None) + self.public_access = kwargs.get('public_access', None) class CorsRule(msrest.serialization.Model): @@ -575,23 +614,28 @@ class CorsRule(msrest.serialization.Model): """ _validation = { - "allowed_origins": {"required": True}, - "allowed_methods": {"required": True}, - "allowed_headers": {"required": True}, - "exposed_headers": {"required": True}, - "max_age_in_seconds": {"required": True, "minimum": 0}, + 'allowed_origins': {'required': True}, + 'allowed_methods': {'required': True}, + 'allowed_headers': {'required': True}, + 'exposed_headers': {'required': True}, + 'max_age_in_seconds': {'required': True, 'minimum': 0}, } _attribute_map = { - "allowed_origins": {"key": "AllowedOrigins", "type": "str"}, - "allowed_methods": {"key": "AllowedMethods", "type": "str"}, - "allowed_headers": {"key": "AllowedHeaders", "type": "str"}, - "exposed_headers": {"key": "ExposedHeaders", "type": "str"}, - "max_age_in_seconds": {"key": "MaxAgeInSeconds", "type": "int"}, + 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str'}, + 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str'}, + 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str'}, + 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str'}, + 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int'}, + } + _xml_map = { + 'name': 'CorsRule' } - _xml_map = {"name": "CorsRule"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword allowed_origins: Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request @@ -613,11 +657,11 @@ def __init__(self, **kwargs): :paramtype max_age_in_seconds: int """ super(CorsRule, self).__init__(**kwargs) - self.allowed_origins = kwargs["allowed_origins"] - self.allowed_methods = kwargs["allowed_methods"] - self.allowed_headers = kwargs["allowed_headers"] - self.exposed_headers = kwargs["exposed_headers"] - self.max_age_in_seconds = kwargs["max_age_in_seconds"] + self.allowed_origins = kwargs['allowed_origins'] + self.allowed_methods = kwargs['allowed_methods'] + self.allowed_headers = kwargs['allowed_headers'] + self.exposed_headers = kwargs['exposed_headers'] + self.max_age_in_seconds = kwargs['max_age_in_seconds'] class Error(msrest.serialization.Model): @@ -630,11 +674,14 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -642,8 +689,8 @@ def __init__(self, **kwargs): :paramtype message: str """ super(Error, self).__init__(**kwargs) - self.status = kwargs.get("status", None) - self.message = kwargs.get("message", None) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) class JSONInput(msrest.serialization.Model): @@ -654,16 +701,19 @@ class JSONInput(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, + 'id': {'key': 'id', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int """ super(JSONInput, self).__init__(**kwargs) - self.id = kwargs.get("id", None) + self.id = kwargs.get('id', None) class JSONOutput(msrest.serialization.Model): @@ -674,16 +724,19 @@ class JSONOutput(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, + 'id': {'key': 'id', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: :paramtype id: int """ super(JSONOutput, self).__init__(**kwargs) - self.id = kwargs.get("id", None) + self.id = kwargs.get('id', None) class ListBlobsResponse(msrest.serialization.Model): @@ -710,28 +763,33 @@ class ListBlobsResponse(msrest.serialization.Model): """ _validation = { - "container_name": {"required": True}, - "prefix": {"required": True}, - "marker": {"required": True}, - "max_results": {"required": True}, - "delimiter": {"required": True}, - "blobs": {"required": True}, - "next_marker": {"required": True}, + 'container_name': {'required': True}, + 'prefix': {'required': True}, + 'marker': {'required': True}, + 'max_results': {'required': True}, + 'delimiter': {'required': True}, + 'blobs': {'required': True}, + 'next_marker': {'required': True}, } _attribute_map = { - "service_endpoint": {"key": "ServiceEndpoint", "type": "str", "xml": {"attr": True}}, - "container_name": {"key": "ContainerName", "type": "str", "xml": {"attr": True}}, - "prefix": {"key": "Prefix", "type": "str"}, - "marker": {"key": "Marker", "type": "str"}, - "max_results": {"key": "MaxResults", "type": "int"}, - "delimiter": {"key": "Delimiter", "type": "str"}, - "blobs": {"key": "Blobs", "type": "Blobs"}, - "next_marker": {"key": "NextMarker", "type": "str"}, + 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}}, + 'container_name': {'key': 'ContainerName', 'type': 'str', 'xml': {'attr': True}}, + 'prefix': {'key': 'Prefix', 'type': 'str'}, + 'marker': {'key': 'Marker', 'type': 'str'}, + 'max_results': {'key': 'MaxResults', 'type': 'int'}, + 'delimiter': {'key': 'Delimiter', 'type': 'str'}, + 'blobs': {'key': 'Blobs', 'type': 'Blobs'}, + 'next_marker': {'key': 'NextMarker', 'type': 'str'}, + } + _xml_map = { + 'name': 'EnumerationResults' } - _xml_map = {"name": "EnumerationResults"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword service_endpoint: :paramtype service_endpoint: str @@ -751,14 +809,14 @@ def __init__(self, **kwargs): :paramtype next_marker: str """ super(ListBlobsResponse, self).__init__(**kwargs) - self.service_endpoint = kwargs.get("service_endpoint", None) - self.container_name = kwargs["container_name"] - self.prefix = kwargs["prefix"] - self.marker = kwargs["marker"] - self.max_results = kwargs["max_results"] - self.delimiter = kwargs["delimiter"] - self.blobs = kwargs["blobs"] - self.next_marker = kwargs["next_marker"] + self.service_endpoint = kwargs.get('service_endpoint', None) + self.container_name = kwargs['container_name'] + self.prefix = kwargs['prefix'] + self.marker = kwargs['marker'] + self.max_results = kwargs['max_results'] + self.delimiter = kwargs['delimiter'] + self.blobs = kwargs['blobs'] + self.next_marker = kwargs['next_marker'] class ListContainersResponse(msrest.serialization.Model): @@ -781,23 +839,28 @@ class ListContainersResponse(msrest.serialization.Model): """ _validation = { - "service_endpoint": {"required": True}, - "prefix": {"required": True}, - "max_results": {"required": True}, - "next_marker": {"required": True}, + 'service_endpoint': {'required': True}, + 'prefix': {'required': True}, + 'max_results': {'required': True}, + 'next_marker': {'required': True}, } _attribute_map = { - "service_endpoint": {"key": "ServiceEndpoint", "type": "str", "xml": {"attr": True}}, - "prefix": {"key": "Prefix", "type": "str"}, - "marker": {"key": "Marker", "type": "str"}, - "max_results": {"key": "MaxResults", "type": "int"}, - "containers": {"key": "Containers", "type": "[Container]", "xml": {"wrapped": True}}, - "next_marker": {"key": "NextMarker", "type": "str"}, + 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}}, + 'prefix': {'key': 'Prefix', 'type': 'str'}, + 'marker': {'key': 'Marker', 'type': 'str'}, + 'max_results': {'key': 'MaxResults', 'type': 'int'}, + 'containers': {'key': 'Containers', 'type': '[Container]', 'xml': {'wrapped': True}}, + 'next_marker': {'key': 'NextMarker', 'type': 'str'}, + } + _xml_map = { + 'name': 'EnumerationResults' } - _xml_map = {"name": "EnumerationResults"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -813,12 +876,12 @@ def __init__(self, **kwargs): :paramtype next_marker: str """ super(ListContainersResponse, self).__init__(**kwargs) - self.service_endpoint = kwargs["service_endpoint"] - self.prefix = kwargs["prefix"] - self.marker = kwargs.get("marker", None) - self.max_results = kwargs["max_results"] - self.containers = kwargs.get("containers", None) - self.next_marker = kwargs["next_marker"] + self.service_endpoint = kwargs['service_endpoint'] + self.prefix = kwargs['prefix'] + self.marker = kwargs.get('marker', None) + self.max_results = kwargs['max_results'] + self.containers = kwargs.get('containers', None) + self.next_marker = kwargs['next_marker'] class Logging(msrest.serialization.Model): @@ -839,22 +902,25 @@ class Logging(msrest.serialization.Model): """ _validation = { - "version": {"required": True}, - "delete": {"required": True}, - "read": {"required": True}, - "write": {"required": True}, - "retention_policy": {"required": True}, + 'version': {'required': True}, + 'delete': {'required': True}, + 'read': {'required': True}, + 'write': {'required': True}, + 'retention_policy': {'required': True}, } _attribute_map = { - "version": {"key": "Version", "type": "str"}, - "delete": {"key": "Delete", "type": "bool"}, - "read": {"key": "Read", "type": "bool"}, - "write": {"key": "Write", "type": "bool"}, - "retention_policy": {"key": "RetentionPolicy", "type": "RetentionPolicy"}, + 'version': {'key': 'Version', 'type': 'str'}, + 'delete': {'key': 'Delete', 'type': 'bool'}, + 'read': {'key': 'Read', 'type': 'bool'}, + 'write': {'key': 'Write', 'type': 'bool'}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword version: Required. The version of Storage Analytics to configure. :paramtype version: str @@ -868,11 +934,11 @@ def __init__(self, **kwargs): :paramtype retention_policy: ~xmlservice.models.RetentionPolicy """ super(Logging, self).__init__(**kwargs) - self.version = kwargs["version"] - self.delete = kwargs["delete"] - self.read = kwargs["read"] - self.write = kwargs["write"] - self.retention_policy = kwargs["retention_policy"] + self.version = kwargs['version'] + self.delete = kwargs['delete'] + self.read = kwargs['read'] + self.write = kwargs['write'] + self.retention_policy = kwargs['retention_policy'] class Metrics(msrest.serialization.Model): @@ -892,17 +958,20 @@ class Metrics(msrest.serialization.Model): """ _validation = { - "enabled": {"required": True}, + 'enabled': {'required': True}, } _attribute_map = { - "version": {"key": "Version", "type": "str"}, - "enabled": {"key": "Enabled", "type": "bool"}, - "include_apis": {"key": "IncludeAPIs", "type": "bool"}, - "retention_policy": {"key": "RetentionPolicy", "type": "RetentionPolicy"}, + 'version': {'key': 'Version', 'type': 'str'}, + 'enabled': {'key': 'Enabled', 'type': 'bool'}, + 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool'}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword version: The version of Storage Analytics to configure. :paramtype version: str @@ -915,10 +984,10 @@ def __init__(self, **kwargs): :paramtype retention_policy: ~xmlservice.models.RetentionPolicy """ super(Metrics, self).__init__(**kwargs) - self.version = kwargs.get("version", None) - self.enabled = kwargs["enabled"] - self.include_apis = kwargs.get("include_apis", None) - self.retention_policy = kwargs.get("retention_policy", None) + self.version = kwargs.get('version', None) + self.enabled = kwargs['enabled'] + self.include_apis = kwargs.get('include_apis', None) + self.retention_policy = kwargs.get('retention_policy', None) class ModelWithByteProperty(msrest.serialization.Model): @@ -929,16 +998,19 @@ class ModelWithByteProperty(msrest.serialization.Model): """ _attribute_map = { - "bytes": {"key": "Bytes", "type": "bytearray"}, + 'bytes': {'key': 'Bytes', 'type': 'bytearray'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword bytes: :paramtype bytes: bytearray """ super(ModelWithByteProperty, self).__init__(**kwargs) - self.bytes = kwargs.get("bytes", None) + self.bytes = kwargs.get('bytes', None) class ModelWithUrlProperty(msrest.serialization.Model): @@ -949,16 +1021,19 @@ class ModelWithUrlProperty(msrest.serialization.Model): """ _attribute_map = { - "url": {"key": "Url", "type": "str"}, + 'url': {'key': 'Url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword url: :paramtype url: str """ super(ModelWithUrlProperty, self).__init__(**kwargs) - self.url = kwargs.get("url", None) + self.url = kwargs.get('url', None) class ObjectWithXMsTextProperty(msrest.serialization.Model): @@ -971,12 +1046,17 @@ class ObjectWithXMsTextProperty(msrest.serialization.Model): """ _attribute_map = { - "language": {"key": "language", "type": "str", "xml": {"name": "language", "attr": True}}, - "content": {"key": "content", "type": "str", "xml": {"text": True}}, + 'language': {'key': 'language', 'type': 'str', 'xml': {'name': 'language', 'attr': True}}, + 'content': {'key': 'content', 'type': 'str', 'xml': {'text': True}}, + } + _xml_map = { + 'name': 'Data' } - _xml_map = {"name": "Data"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword language: Returned value should be 'english'. :paramtype language: str @@ -984,8 +1064,8 @@ def __init__(self, **kwargs): :paramtype content: str """ super(ObjectWithXMsTextProperty, self).__init__(**kwargs) - self.language = kwargs.get("language", None) - self.content = kwargs.get("content", None) + self.language = kwargs.get('language', None) + self.content = kwargs.get('content', None) class RetentionPolicy(msrest.serialization.Model): @@ -1002,16 +1082,19 @@ class RetentionPolicy(msrest.serialization.Model): """ _validation = { - "enabled": {"required": True}, - "days": {"minimum": 1}, + 'enabled': {'required': True}, + 'days': {'minimum': 1}, } _attribute_map = { - "enabled": {"key": "Enabled", "type": "bool"}, - "days": {"key": "Days", "type": "int"}, + 'enabled': {'key': 'Enabled', 'type': 'bool'}, + 'days': {'key': 'Days', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword enabled: Required. Indicates whether a retention policy is enabled for the storage service. @@ -1021,8 +1104,8 @@ def __init__(self, **kwargs): :paramtype days: int """ super(RetentionPolicy, self).__init__(**kwargs) - self.enabled = kwargs["enabled"] - self.days = kwargs.get("days", None) + self.enabled = kwargs['enabled'] + self.days = kwargs.get('days', None) class RootWithRefAndMeta(msrest.serialization.Model): @@ -1035,11 +1118,14 @@ class RootWithRefAndMeta(msrest.serialization.Model): """ _attribute_map = { - "ref_to_model": {"key": "RefToModel", "type": "ComplexTypeWithMeta"}, - "something": {"key": "Something", "type": "str"}, + 'ref_to_model': {'key': 'RefToModel', 'type': 'ComplexTypeWithMeta'}, + 'something': {'key': 'Something', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword ref_to_model: XML will use XMLComplexTypeWithMeta. :paramtype ref_to_model: ~xmlservice.models.ComplexTypeWithMeta @@ -1047,8 +1133,8 @@ def __init__(self, **kwargs): :paramtype something: str """ super(RootWithRefAndMeta, self).__init__(**kwargs) - self.ref_to_model = kwargs.get("ref_to_model", None) - self.something = kwargs.get("something", None) + self.ref_to_model = kwargs.get('ref_to_model', None) + self.something = kwargs.get('something', None) class RootWithRefAndNoMeta(msrest.serialization.Model): @@ -1061,11 +1147,14 @@ class RootWithRefAndNoMeta(msrest.serialization.Model): """ _attribute_map = { - "ref_to_model": {"key": "RefToModel", "type": "ComplexTypeNoMeta"}, - "something": {"key": "Something", "type": "str"}, + 'ref_to_model': {'key': 'RefToModel', 'type': 'ComplexTypeNoMeta'}, + 'something': {'key': 'Something', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword ref_to_model: XML will use RefToModel. :paramtype ref_to_model: ~xmlservice.models.ComplexTypeNoMeta @@ -1073,8 +1162,8 @@ def __init__(self, **kwargs): :paramtype something: str """ super(RootWithRefAndNoMeta, self).__init__(**kwargs) - self.ref_to_model = kwargs.get("ref_to_model", None) - self.something = kwargs.get("something", None) + self.ref_to_model = kwargs.get('ref_to_model', None) + self.something = kwargs.get('something', None) class SignedIdentifier(msrest.serialization.Model): @@ -1089,17 +1178,22 @@ class SignedIdentifier(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "access_policy": {"required": True}, + 'id': {'required': True}, + 'access_policy': {'required': True}, } _attribute_map = { - "id": {"key": "Id", "type": "str"}, - "access_policy": {"key": "AccessPolicy", "type": "AccessPolicy"}, + 'id': {'key': 'Id', 'type': 'str'}, + 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'}, + } + _xml_map = { + 'name': 'SignedIdentifier' } - _xml_map = {"name": "SignedIdentifier"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword id: Required. a unique id. :paramtype id: str @@ -1107,8 +1201,8 @@ def __init__(self, **kwargs): :paramtype access_policy: ~xmlservice.models.AccessPolicy """ super(SignedIdentifier, self).__init__(**kwargs) - self.id = kwargs["id"] - self.access_policy = kwargs["access_policy"] + self.id = kwargs['id'] + self.access_policy = kwargs['access_policy'] class Slide(msrest.serialization.Model): @@ -1123,13 +1217,18 @@ class Slide(msrest.serialization.Model): """ _attribute_map = { - "type": {"key": "type", "type": "str", "xml": {"attr": True}}, - "title": {"key": "title", "type": "str"}, - "items": {"key": "items", "type": "[str]", "xml": {"itemsName": "item"}}, + 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, + 'title': {'key': 'title', 'type': 'str'}, + 'items': {'key': 'items', 'type': '[str]', 'xml': {'itemsName': 'item'}}, + } + _xml_map = { + 'name': 'slide' } - _xml_map = {"name": "slide"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword type: :paramtype type: str @@ -1139,9 +1238,9 @@ def __init__(self, **kwargs): :paramtype items: list[str] """ super(Slide, self).__init__(**kwargs) - self.type = kwargs.get("type", None) - self.title = kwargs.get("title", None) - self.items = kwargs.get("items", None) + self.type = kwargs.get('type', None) + self.title = kwargs.get('title', None) + self.items = kwargs.get('items', None) class Slideshow(msrest.serialization.Model): @@ -1158,14 +1257,19 @@ class Slideshow(msrest.serialization.Model): """ _attribute_map = { - "title": {"key": "title", "type": "str", "xml": {"attr": True}}, - "date": {"key": "date", "type": "str", "xml": {"attr": True}}, - "author": {"key": "author", "type": "str", "xml": {"attr": True}}, - "slides": {"key": "slides", "type": "[Slide]"}, + 'title': {'key': 'title', 'type': 'str', 'xml': {'attr': True}}, + 'date': {'key': 'date', 'type': 'str', 'xml': {'attr': True}}, + 'author': {'key': 'author', 'type': 'str', 'xml': {'attr': True}}, + 'slides': {'key': 'slides', 'type': '[Slide]'}, + } + _xml_map = { + 'name': 'slideshow' } - _xml_map = {"name": "slideshow"} - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword title: :paramtype title: str @@ -1177,10 +1281,10 @@ def __init__(self, **kwargs): :paramtype slides: list[~xmlservice.models.Slide] """ super(Slideshow, self).__init__(**kwargs) - self.title = kwargs.get("title", None) - self.date = kwargs.get("date", None) - self.author = kwargs.get("author", None) - self.slides = kwargs.get("slides", None) + self.title = kwargs.get('title', None) + self.date = kwargs.get('date', None) + self.author = kwargs.get('author', None) + self.slides = kwargs.get('slides', None) class StorageServiceProperties(msrest.serialization.Model): @@ -1205,15 +1309,18 @@ class StorageServiceProperties(msrest.serialization.Model): """ _attribute_map = { - "logging": {"key": "Logging", "type": "Logging"}, - "hour_metrics": {"key": "HourMetrics", "type": "Metrics"}, - "minute_metrics": {"key": "MinuteMetrics", "type": "Metrics"}, - "cors": {"key": "Cors", "type": "[CorsRule]", "xml": {"wrapped": True, "itemsName": "CorsRule"}}, - "default_service_version": {"key": "DefaultServiceVersion", "type": "str"}, - "delete_retention_policy": {"key": "DeleteRetentionPolicy", "type": "RetentionPolicy"}, + 'logging': {'key': 'Logging', 'type': 'Logging'}, + 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'}, + 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'}, + 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'wrapped': True, 'itemsName': 'CorsRule'}}, + 'default_service_version': {'key': 'DefaultServiceVersion', 'type': 'str'}, + 'delete_retention_policy': {'key': 'DeleteRetentionPolicy', 'type': 'RetentionPolicy'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword logging: Azure Analytics Logging settings. :paramtype logging: ~xmlservice.models.Logging @@ -1233,9 +1340,9 @@ def __init__(self, **kwargs): :paramtype delete_retention_policy: ~xmlservice.models.RetentionPolicy """ super(StorageServiceProperties, self).__init__(**kwargs) - self.logging = kwargs.get("logging", None) - self.hour_metrics = kwargs.get("hour_metrics", None) - self.minute_metrics = kwargs.get("minute_metrics", None) - self.cors = kwargs.get("cors", None) - self.default_service_version = kwargs.get("default_service_version", None) - self.delete_retention_policy = kwargs.get("delete_retention_policy", None) + self.logging = kwargs.get('logging', None) + self.hour_metrics = kwargs.get('hour_metrics', None) + self.minute_metrics = kwargs.get('minute_metrics', None) + self.cors = kwargs.get('cors', None) + self.default_service_version = kwargs.get('default_service_version', None) + self.delete_retention_policy = kwargs.get('delete_retention_policy', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py index a12a3774e0e..d5f4f90700f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py @@ -29,18 +29,25 @@ class AccessPolicy(msrest.serialization.Model): """ _validation = { - "start": {"required": True}, - "expiry": {"required": True}, - "permission": {"required": True}, + 'start': {'required': True}, + 'expiry': {'required': True}, + 'permission': {'required': True}, } _attribute_map = { - "start": {"key": "Start", "type": "iso-8601"}, - "expiry": {"key": "Expiry", "type": "iso-8601"}, - "permission": {"key": "Permission", "type": "str"}, + 'start': {'key': 'Start', 'type': 'iso-8601'}, + 'expiry': {'key': 'Expiry', 'type': 'iso-8601'}, + 'permission': {'key': 'Permission', 'type': 'str'}, } - def __init__(self, *, start: datetime.datetime, expiry: datetime.datetime, permission: str, **kwargs): + def __init__( + self, + *, + start: datetime.datetime, + expiry: datetime.datetime, + permission: str, + **kwargs + ): """ :keyword start: Required. the date-time the policy is active. :paramtype start: ~datetime.datetime @@ -65,11 +72,17 @@ class AppleBarrel(msrest.serialization.Model): """ _attribute_map = { - "good_apples": {"key": "GoodApples", "type": "[str]", "xml": {"wrapped": True, "itemsName": "Apple"}}, - "bad_apples": {"key": "BadApples", "type": "[str]", "xml": {"wrapped": True, "itemsName": "Apple"}}, + 'good_apples': {'key': 'GoodApples', 'type': '[str]', 'xml': {'wrapped': True, 'itemsName': 'Apple'}}, + 'bad_apples': {'key': 'BadApples', 'type': '[str]', 'xml': {'wrapped': True, 'itemsName': 'Apple'}}, } - def __init__(self, *, good_apples: Optional[List[str]] = None, bad_apples: Optional[List[str]] = None, **kwargs): + def __init__( + self, + *, + good_apples: Optional[List[str]] = None, + bad_apples: Optional[List[str]] = None, + **kwargs + ): """ :keyword good_apples: :paramtype good_apples: list[str] @@ -93,11 +106,13 @@ class Banana(msrest.serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str", "xml": {"name": "name"}}, - "flavor": {"key": "flavor", "type": "str", "xml": {"name": "flavor"}}, - "expiration": {"key": "expiration", "type": "iso-8601", "xml": {"name": "expiration"}}, + 'name': {'key': 'name', 'type': 'str', 'xml': {'name': 'name'}}, + 'flavor': {'key': 'flavor', 'type': 'str', 'xml': {'name': 'flavor'}}, + 'expiration': {'key': 'expiration', 'type': 'iso-8601', 'xml': {'name': 'expiration'}}, + } + _xml_map = { + 'name': 'banana' } - _xml_map = {"name": "banana"} def __init__( self, @@ -139,20 +154,22 @@ class Blob(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, - "deleted": {"required": True}, - "snapshot": {"required": True}, - "properties": {"required": True}, + 'name': {'required': True}, + 'deleted': {'required': True}, + 'snapshot': {'required': True}, + 'properties': {'required': True}, } _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "deleted": {"key": "Deleted", "type": "bool"}, - "snapshot": {"key": "Snapshot", "type": "str"}, - "properties": {"key": "Properties", "type": "BlobProperties"}, - "metadata": {"key": "Metadata", "type": "{str}"}, + 'name': {'key': 'Name', 'type': 'str'}, + 'deleted': {'key': 'Deleted', 'type': 'bool'}, + 'snapshot': {'key': 'Snapshot', 'type': 'str'}, + 'properties': {'key': 'Properties', 'type': 'BlobProperties'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, + } + _xml_map = { + 'name': 'Blob' } - _xml_map = {"name": "Blob"} def __init__( self, @@ -194,14 +211,19 @@ class BlobPrefix(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, + 'name': {'required': True}, } _attribute_map = { - "name": {"key": "Name", "type": "str"}, + 'name': {'key': 'Name', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs): + def __init__( + self, + *, + name: str, + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -277,39 +299,39 @@ class BlobProperties(msrest.serialization.Model): """ _validation = { - "last_modified": {"required": True}, - "etag": {"required": True}, + 'last_modified': {'required': True}, + 'etag': {'required': True}, } _attribute_map = { - "last_modified": {"key": "Last-Modified", "type": "rfc-1123"}, - "etag": {"key": "Etag", "type": "str"}, - "content_length": {"key": "Content-Length", "type": "long"}, - "content_type": {"key": "Content-Type", "type": "str"}, - "content_encoding": {"key": "Content-Encoding", "type": "str"}, - "content_language": {"key": "Content-Language", "type": "str"}, - "content_md5": {"key": "Content-MD5", "type": "str"}, - "content_disposition": {"key": "Content-Disposition", "type": "str"}, - "cache_control": {"key": "Cache-Control", "type": "str"}, - "blob_sequence_number": {"key": "x-ms-blob-sequence-number", "type": "int"}, - "blob_type": {"key": "BlobType", "type": "str"}, - "lease_status": {"key": "LeaseStatus", "type": "str"}, - "lease_state": {"key": "LeaseState", "type": "str"}, - "lease_duration": {"key": "LeaseDuration", "type": "str"}, - "copy_id": {"key": "CopyId", "type": "str"}, - "copy_status": {"key": "CopyStatus", "type": "str"}, - "copy_source": {"key": "CopySource", "type": "str"}, - "copy_progress": {"key": "CopyProgress", "type": "str"}, - "copy_completion_time": {"key": "CopyCompletionTime", "type": "rfc-1123"}, - "copy_status_description": {"key": "CopyStatusDescription", "type": "str"}, - "server_encrypted": {"key": "ServerEncrypted", "type": "bool"}, - "incremental_copy": {"key": "IncrementalCopy", "type": "bool"}, - "destination_snapshot": {"key": "DestinationSnapshot", "type": "str"}, - "deleted_time": {"key": "DeletedTime", "type": "rfc-1123"}, - "remaining_retention_days": {"key": "RemainingRetentionDays", "type": "int"}, - "access_tier": {"key": "AccessTier", "type": "str"}, - "access_tier_inferred": {"key": "AccessTierInferred", "type": "bool"}, - "archive_status": {"key": "ArchiveStatus", "type": "str"}, + 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123'}, + 'etag': {'key': 'Etag', 'type': 'str'}, + 'content_length': {'key': 'Content-Length', 'type': 'long'}, + 'content_type': {'key': 'Content-Type', 'type': 'str'}, + 'content_encoding': {'key': 'Content-Encoding', 'type': 'str'}, + 'content_language': {'key': 'Content-Language', 'type': 'str'}, + 'content_md5': {'key': 'Content-MD5', 'type': 'str'}, + 'content_disposition': {'key': 'Content-Disposition', 'type': 'str'}, + 'cache_control': {'key': 'Cache-Control', 'type': 'str'}, + 'blob_sequence_number': {'key': 'x-ms-blob-sequence-number', 'type': 'int'}, + 'blob_type': {'key': 'BlobType', 'type': 'str'}, + 'lease_status': {'key': 'LeaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'LeaseState', 'type': 'str'}, + 'lease_duration': {'key': 'LeaseDuration', 'type': 'str'}, + 'copy_id': {'key': 'CopyId', 'type': 'str'}, + 'copy_status': {'key': 'CopyStatus', 'type': 'str'}, + 'copy_source': {'key': 'CopySource', 'type': 'str'}, + 'copy_progress': {'key': 'CopyProgress', 'type': 'str'}, + 'copy_completion_time': {'key': 'CopyCompletionTime', 'type': 'rfc-1123'}, + 'copy_status_description': {'key': 'CopyStatusDescription', 'type': 'str'}, + 'server_encrypted': {'key': 'ServerEncrypted', 'type': 'bool'}, + 'incremental_copy': {'key': 'IncrementalCopy', 'type': 'bool'}, + 'destination_snapshot': {'key': 'DestinationSnapshot', 'type': 'str'}, + 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123'}, + 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'AccessTier', 'type': 'str'}, + 'access_tier_inferred': {'key': 'AccessTierInferred', 'type': 'bool'}, + 'archive_status': {'key': 'ArchiveStatus', 'type': 'str'}, } def __init__( @@ -447,12 +469,16 @@ class Blobs(msrest.serialization.Model): """ _attribute_map = { - "blob_prefix": {"key": "BlobPrefix", "type": "[BlobPrefix]"}, - "blob": {"key": "Blob", "type": "[Blob]"}, + 'blob_prefix': {'key': 'BlobPrefix', 'type': '[BlobPrefix]'}, + 'blob': {'key': 'Blob', 'type': '[Blob]'}, } def __init__( - self, *, blob_prefix: Optional[List["BlobPrefix"]] = None, blob: Optional[List["Blob"]] = None, **kwargs + self, + *, + blob_prefix: Optional[List["BlobPrefix"]] = None, + blob: Optional[List["Blob"]] = None, + **kwargs ): """ :keyword blob_prefix: @@ -473,10 +499,15 @@ class ComplexTypeNoMeta(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "ID", "type": "str"}, + 'id': {'key': 'ID', 'type': 'str'}, } - def __init__(self, *, id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): """ :keyword id: The id of the res. :paramtype id: str @@ -493,11 +524,18 @@ class ComplexTypeWithMeta(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "ID", "type": "str"}, + 'id': {'key': 'ID', 'type': 'str'}, + } + _xml_map = { + 'name': 'XMLComplexTypeWithMeta' } - _xml_map = {"name": "XMLComplexTypeWithMeta"} - def __init__(self, *, id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): """ :keyword id: The id of the res. :paramtype id: str @@ -520,18 +558,23 @@ class Container(msrest.serialization.Model): """ _validation = { - "name": {"required": True}, - "properties": {"required": True}, + 'name': {'required': True}, + 'properties': {'required': True}, } _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "properties": {"key": "Properties", "type": "ContainerProperties"}, - "metadata": {"key": "Metadata", "type": "{str}"}, + 'name': {'key': 'Name', 'type': 'str'}, + 'properties': {'key': 'Properties', 'type': 'ContainerProperties'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } def __init__( - self, *, name: str, properties: "ContainerProperties", metadata: Optional[Dict[str, str]] = None, **kwargs + self, + *, + name: str, + properties: "ContainerProperties", + metadata: Optional[Dict[str, str]] = None, + **kwargs ): """ :keyword name: Required. @@ -568,17 +611,17 @@ class ContainerProperties(msrest.serialization.Model): """ _validation = { - "last_modified": {"required": True}, - "etag": {"required": True}, + 'last_modified': {'required': True}, + 'etag': {'required': True}, } _attribute_map = { - "last_modified": {"key": "Last-Modified", "type": "rfc-1123"}, - "etag": {"key": "Etag", "type": "str"}, - "lease_status": {"key": "LeaseStatus", "type": "str"}, - "lease_state": {"key": "LeaseState", "type": "str"}, - "lease_duration": {"key": "LeaseDuration", "type": "str"}, - "public_access": {"key": "PublicAccess", "type": "str"}, + 'last_modified': {'key': 'Last-Modified', 'type': 'rfc-1123'}, + 'etag': {'key': 'Etag', 'type': 'str'}, + 'lease_status': {'key': 'LeaseStatus', 'type': 'str'}, + 'lease_state': {'key': 'LeaseState', 'type': 'str'}, + 'lease_duration': {'key': 'LeaseDuration', 'type': 'str'}, + 'public_access': {'key': 'PublicAccess', 'type': 'str'}, } def __init__( @@ -642,21 +685,23 @@ class CorsRule(msrest.serialization.Model): """ _validation = { - "allowed_origins": {"required": True}, - "allowed_methods": {"required": True}, - "allowed_headers": {"required": True}, - "exposed_headers": {"required": True}, - "max_age_in_seconds": {"required": True, "minimum": 0}, + 'allowed_origins': {'required': True}, + 'allowed_methods': {'required': True}, + 'allowed_headers': {'required': True}, + 'exposed_headers': {'required': True}, + 'max_age_in_seconds': {'required': True, 'minimum': 0}, } _attribute_map = { - "allowed_origins": {"key": "AllowedOrigins", "type": "str"}, - "allowed_methods": {"key": "AllowedMethods", "type": "str"}, - "allowed_headers": {"key": "AllowedHeaders", "type": "str"}, - "exposed_headers": {"key": "ExposedHeaders", "type": "str"}, - "max_age_in_seconds": {"key": "MaxAgeInSeconds", "type": "int"}, + 'allowed_origins': {'key': 'AllowedOrigins', 'type': 'str'}, + 'allowed_methods': {'key': 'AllowedMethods', 'type': 'str'}, + 'allowed_headers': {'key': 'AllowedHeaders', 'type': 'str'}, + 'exposed_headers': {'key': 'ExposedHeaders', 'type': 'str'}, + 'max_age_in_seconds': {'key': 'MaxAgeInSeconds', 'type': 'int'}, + } + _xml_map = { + 'name': 'CorsRule' } - _xml_map = {"name": "CorsRule"} def __init__( self, @@ -706,11 +751,17 @@ class Error(msrest.serialization.Model): """ _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): """ :keyword status: :paramtype status: int @@ -730,10 +781,15 @@ class JSONInput(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, + 'id': {'key': 'id', 'type': 'int'}, } - def __init__(self, *, id: Optional[int] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -750,10 +806,15 @@ class JSONOutput(msrest.serialization.Model): """ _attribute_map = { - "id": {"key": "id", "type": "int"}, + 'id': {'key': 'id', 'type': 'int'}, } - def __init__(self, *, id: Optional[int] = None, **kwargs): + def __init__( + self, + *, + id: Optional[int] = None, + **kwargs + ): """ :keyword id: :paramtype id: int @@ -786,26 +847,28 @@ class ListBlobsResponse(msrest.serialization.Model): """ _validation = { - "container_name": {"required": True}, - "prefix": {"required": True}, - "marker": {"required": True}, - "max_results": {"required": True}, - "delimiter": {"required": True}, - "blobs": {"required": True}, - "next_marker": {"required": True}, + 'container_name': {'required': True}, + 'prefix': {'required': True}, + 'marker': {'required': True}, + 'max_results': {'required': True}, + 'delimiter': {'required': True}, + 'blobs': {'required': True}, + 'next_marker': {'required': True}, } _attribute_map = { - "service_endpoint": {"key": "ServiceEndpoint", "type": "str", "xml": {"attr": True}}, - "container_name": {"key": "ContainerName", "type": "str", "xml": {"attr": True}}, - "prefix": {"key": "Prefix", "type": "str"}, - "marker": {"key": "Marker", "type": "str"}, - "max_results": {"key": "MaxResults", "type": "int"}, - "delimiter": {"key": "Delimiter", "type": "str"}, - "blobs": {"key": "Blobs", "type": "Blobs"}, - "next_marker": {"key": "NextMarker", "type": "str"}, + 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}}, + 'container_name': {'key': 'ContainerName', 'type': 'str', 'xml': {'attr': True}}, + 'prefix': {'key': 'Prefix', 'type': 'str'}, + 'marker': {'key': 'Marker', 'type': 'str'}, + 'max_results': {'key': 'MaxResults', 'type': 'int'}, + 'delimiter': {'key': 'Delimiter', 'type': 'str'}, + 'blobs': {'key': 'Blobs', 'type': 'Blobs'}, + 'next_marker': {'key': 'NextMarker', 'type': 'str'}, + } + _xml_map = { + 'name': 'EnumerationResults' } - _xml_map = {"name": "EnumerationResults"} def __init__( self, @@ -869,21 +932,23 @@ class ListContainersResponse(msrest.serialization.Model): """ _validation = { - "service_endpoint": {"required": True}, - "prefix": {"required": True}, - "max_results": {"required": True}, - "next_marker": {"required": True}, + 'service_endpoint': {'required': True}, + 'prefix': {'required': True}, + 'max_results': {'required': True}, + 'next_marker': {'required': True}, } _attribute_map = { - "service_endpoint": {"key": "ServiceEndpoint", "type": "str", "xml": {"attr": True}}, - "prefix": {"key": "Prefix", "type": "str"}, - "marker": {"key": "Marker", "type": "str"}, - "max_results": {"key": "MaxResults", "type": "int"}, - "containers": {"key": "Containers", "type": "[Container]", "xml": {"wrapped": True}}, - "next_marker": {"key": "NextMarker", "type": "str"}, + 'service_endpoint': {'key': 'ServiceEndpoint', 'type': 'str', 'xml': {'attr': True}}, + 'prefix': {'key': 'Prefix', 'type': 'str'}, + 'marker': {'key': 'Marker', 'type': 'str'}, + 'max_results': {'key': 'MaxResults', 'type': 'int'}, + 'containers': {'key': 'Containers', 'type': '[Container]', 'xml': {'wrapped': True}}, + 'next_marker': {'key': 'NextMarker', 'type': 'str'}, + } + _xml_map = { + 'name': 'EnumerationResults' } - _xml_map = {"name": "EnumerationResults"} def __init__( self, @@ -937,23 +1002,30 @@ class Logging(msrest.serialization.Model): """ _validation = { - "version": {"required": True}, - "delete": {"required": True}, - "read": {"required": True}, - "write": {"required": True}, - "retention_policy": {"required": True}, + 'version': {'required': True}, + 'delete': {'required': True}, + 'read': {'required': True}, + 'write': {'required': True}, + 'retention_policy': {'required': True}, } _attribute_map = { - "version": {"key": "Version", "type": "str"}, - "delete": {"key": "Delete", "type": "bool"}, - "read": {"key": "Read", "type": "bool"}, - "write": {"key": "Write", "type": "bool"}, - "retention_policy": {"key": "RetentionPolicy", "type": "RetentionPolicy"}, + 'version': {'key': 'Version', 'type': 'str'}, + 'delete': {'key': 'Delete', 'type': 'bool'}, + 'read': {'key': 'Read', 'type': 'bool'}, + 'write': {'key': 'Write', 'type': 'bool'}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, } def __init__( - self, *, version: str, delete: bool, read: bool, write: bool, retention_policy: "RetentionPolicy", **kwargs + self, + *, + version: str, + delete: bool, + read: bool, + write: bool, + retention_policy: "RetentionPolicy", + **kwargs ): """ :keyword version: Required. The version of Storage Analytics to configure. @@ -992,14 +1064,14 @@ class Metrics(msrest.serialization.Model): """ _validation = { - "enabled": {"required": True}, + 'enabled': {'required': True}, } _attribute_map = { - "version": {"key": "Version", "type": "str"}, - "enabled": {"key": "Enabled", "type": "bool"}, - "include_apis": {"key": "IncludeAPIs", "type": "bool"}, - "retention_policy": {"key": "RetentionPolicy", "type": "RetentionPolicy"}, + 'version': {'key': 'Version', 'type': 'str'}, + 'enabled': {'key': 'Enabled', 'type': 'bool'}, + 'include_apis': {'key': 'IncludeAPIs', 'type': 'bool'}, + 'retention_policy': {'key': 'RetentionPolicy', 'type': 'RetentionPolicy'}, } def __init__( @@ -1037,10 +1109,15 @@ class ModelWithByteProperty(msrest.serialization.Model): """ _attribute_map = { - "bytes": {"key": "Bytes", "type": "bytearray"}, + 'bytes': {'key': 'Bytes', 'type': 'bytearray'}, } - def __init__(self, *, bytes: Optional[bytearray] = None, **kwargs): + def __init__( + self, + *, + bytes: Optional[bytearray] = None, + **kwargs + ): """ :keyword bytes: :paramtype bytes: bytearray @@ -1057,10 +1134,15 @@ class ModelWithUrlProperty(msrest.serialization.Model): """ _attribute_map = { - "url": {"key": "Url", "type": "str"}, + 'url': {'key': 'Url', 'type': 'str'}, } - def __init__(self, *, url: Optional[str] = None, **kwargs): + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): """ :keyword url: :paramtype url: str @@ -1079,12 +1161,20 @@ class ObjectWithXMsTextProperty(msrest.serialization.Model): """ _attribute_map = { - "language": {"key": "language", "type": "str", "xml": {"name": "language", "attr": True}}, - "content": {"key": "content", "type": "str", "xml": {"text": True}}, + 'language': {'key': 'language', 'type': 'str', 'xml': {'name': 'language', 'attr': True}}, + 'content': {'key': 'content', 'type': 'str', 'xml': {'text': True}}, + } + _xml_map = { + 'name': 'Data' } - _xml_map = {"name": "Data"} - def __init__(self, *, language: Optional[str] = None, content: Optional[str] = None, **kwargs): + def __init__( + self, + *, + language: Optional[str] = None, + content: Optional[str] = None, + **kwargs + ): """ :keyword language: Returned value should be 'english'. :paramtype language: str @@ -1110,16 +1200,22 @@ class RetentionPolicy(msrest.serialization.Model): """ _validation = { - "enabled": {"required": True}, - "days": {"minimum": 1}, + 'enabled': {'required': True}, + 'days': {'minimum': 1}, } _attribute_map = { - "enabled": {"key": "Enabled", "type": "bool"}, - "days": {"key": "Days", "type": "int"}, + 'enabled': {'key': 'Enabled', 'type': 'bool'}, + 'days': {'key': 'Days', 'type': 'int'}, } - def __init__(self, *, enabled: bool, days: Optional[int] = None, **kwargs): + def __init__( + self, + *, + enabled: bool, + days: Optional[int] = None, + **kwargs + ): """ :keyword enabled: Required. Indicates whether a retention policy is enabled for the storage service. @@ -1143,12 +1239,16 @@ class RootWithRefAndMeta(msrest.serialization.Model): """ _attribute_map = { - "ref_to_model": {"key": "RefToModel", "type": "ComplexTypeWithMeta"}, - "something": {"key": "Something", "type": "str"}, + 'ref_to_model': {'key': 'RefToModel', 'type': 'ComplexTypeWithMeta'}, + 'something': {'key': 'Something', 'type': 'str'}, } def __init__( - self, *, ref_to_model: Optional["ComplexTypeWithMeta"] = None, something: Optional[str] = None, **kwargs + self, + *, + ref_to_model: Optional["ComplexTypeWithMeta"] = None, + something: Optional[str] = None, + **kwargs ): """ :keyword ref_to_model: XML will use XMLComplexTypeWithMeta. @@ -1171,12 +1271,16 @@ class RootWithRefAndNoMeta(msrest.serialization.Model): """ _attribute_map = { - "ref_to_model": {"key": "RefToModel", "type": "ComplexTypeNoMeta"}, - "something": {"key": "Something", "type": "str"}, + 'ref_to_model': {'key': 'RefToModel', 'type': 'ComplexTypeNoMeta'}, + 'something': {'key': 'Something', 'type': 'str'}, } def __init__( - self, *, ref_to_model: Optional["ComplexTypeNoMeta"] = None, something: Optional[str] = None, **kwargs + self, + *, + ref_to_model: Optional["ComplexTypeNoMeta"] = None, + something: Optional[str] = None, + **kwargs ): """ :keyword ref_to_model: XML will use RefToModel. @@ -1201,17 +1305,25 @@ class SignedIdentifier(msrest.serialization.Model): """ _validation = { - "id": {"required": True}, - "access_policy": {"required": True}, + 'id': {'required': True}, + 'access_policy': {'required': True}, } _attribute_map = { - "id": {"key": "Id", "type": "str"}, - "access_policy": {"key": "AccessPolicy", "type": "AccessPolicy"}, + 'id': {'key': 'Id', 'type': 'str'}, + 'access_policy': {'key': 'AccessPolicy', 'type': 'AccessPolicy'}, + } + _xml_map = { + 'name': 'SignedIdentifier' } - _xml_map = {"name": "SignedIdentifier"} - def __init__(self, *, id: str, access_policy: "AccessPolicy", **kwargs): + def __init__( + self, + *, + id: str, + access_policy: "AccessPolicy", + **kwargs + ): """ :keyword id: Required. a unique id. :paramtype id: str @@ -1235,14 +1347,21 @@ class Slide(msrest.serialization.Model): """ _attribute_map = { - "type": {"key": "type", "type": "str", "xml": {"attr": True}}, - "title": {"key": "title", "type": "str"}, - "items": {"key": "items", "type": "[str]", "xml": {"itemsName": "item"}}, + 'type': {'key': 'type', 'type': 'str', 'xml': {'attr': True}}, + 'title': {'key': 'title', 'type': 'str'}, + 'items': {'key': 'items', 'type': '[str]', 'xml': {'itemsName': 'item'}}, + } + _xml_map = { + 'name': 'slide' } - _xml_map = {"name": "slide"} def __init__( - self, *, type: Optional[str] = None, title: Optional[str] = None, items: Optional[List[str]] = None, **kwargs + self, + *, + type: Optional[str] = None, + title: Optional[str] = None, + items: Optional[List[str]] = None, + **kwargs ): """ :keyword type: @@ -1272,12 +1391,14 @@ class Slideshow(msrest.serialization.Model): """ _attribute_map = { - "title": {"key": "title", "type": "str", "xml": {"attr": True}}, - "date": {"key": "date", "type": "str", "xml": {"attr": True}}, - "author": {"key": "author", "type": "str", "xml": {"attr": True}}, - "slides": {"key": "slides", "type": "[Slide]"}, + 'title': {'key': 'title', 'type': 'str', 'xml': {'attr': True}}, + 'date': {'key': 'date', 'type': 'str', 'xml': {'attr': True}}, + 'author': {'key': 'author', 'type': 'str', 'xml': {'attr': True}}, + 'slides': {'key': 'slides', 'type': '[Slide]'}, + } + _xml_map = { + 'name': 'slideshow' } - _xml_map = {"name": "slideshow"} def __init__( self, @@ -1327,12 +1448,12 @@ class StorageServiceProperties(msrest.serialization.Model): """ _attribute_map = { - "logging": {"key": "Logging", "type": "Logging"}, - "hour_metrics": {"key": "HourMetrics", "type": "Metrics"}, - "minute_metrics": {"key": "MinuteMetrics", "type": "Metrics"}, - "cors": {"key": "Cors", "type": "[CorsRule]", "xml": {"wrapped": True, "itemsName": "CorsRule"}}, - "default_service_version": {"key": "DefaultServiceVersion", "type": "str"}, - "delete_retention_policy": {"key": "DeleteRetentionPolicy", "type": "RetentionPolicy"}, + 'logging': {'key': 'Logging', 'type': 'Logging'}, + 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics'}, + 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics'}, + 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'wrapped': True, 'itemsName': 'CorsRule'}}, + 'default_service_version': {'key': 'DefaultServiceVersion', 'type': 'str'}, + 'delete_retention_policy': {'key': 'DeleteRetentionPolicy', 'type': 'RetentionPolicy'}, } def __init__( diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/__init__.py index 6c29f204a33..0189b1d89ef 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/__init__.py @@ -9,5 +9,5 @@ from ._xml_operations import XmlOperations __all__ = [ - "XmlOperations", + 'XmlOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py index a2d37a603a9..f571f31dc03 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, List, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -798,7 +790,7 @@ def build_put_uri_request( ) # fmt: on -class XmlOperations(object): +class XmlOperations(object): # pylint: disable=too-many-public-methods """XmlOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -822,7 +814,8 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_complex_type_ref_no_meta( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.RootWithRefAndNoMeta" """Get a complex type that has a ref to a complex type with no XML node. @@ -832,31 +825,39 @@ def get_complex_type_ref_no_meta( :rtype: ~xmlservice.models.RootWithRefAndNoMeta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.RootWithRefAndNoMeta"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.RootWithRefAndNoMeta"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_type_ref_no_meta_request( - template_url=self.get_complex_type_ref_no_meta.metadata["url"], + template_url=self.get_complex_type_ref_no_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("RootWithRefAndNoMeta", pipeline_response) + deserialized = self._deserialize('RootWithRefAndNoMeta', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_type_ref_no_meta.metadata = {"url": "/xml/complex-type-ref-no-meta"} # type: ignore + get_complex_type_ref_no_meta.metadata = {'url': '/xml/complex-type-ref-no-meta'} # type: ignore + @distributed_trace def put_complex_type_ref_no_meta( @@ -874,23 +875,29 @@ def put_complex_type_ref_no_meta( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(model, "RootWithRefAndNoMeta", is_xml=True) + _content = self._serialize.body(model, 'RootWithRefAndNoMeta', is_xml=True) request = build_put_complex_type_ref_no_meta_request( content_type=content_type, content=_content, - template_url=self.put_complex_type_ref_no_meta.metadata["url"], + template_url=self.put_complex_type_ref_no_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -900,11 +907,13 @@ def put_complex_type_ref_no_meta( if cls: return cls(pipeline_response, None, {}) - put_complex_type_ref_no_meta.metadata = {"url": "/xml/complex-type-ref-no-meta"} # type: ignore + put_complex_type_ref_no_meta.metadata = {'url': '/xml/complex-type-ref-no-meta'} # type: ignore + @distributed_trace def get_complex_type_ref_with_meta( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.RootWithRefAndMeta" """Get a complex type that has a ref to a complex type with XML node. @@ -914,31 +923,39 @@ def get_complex_type_ref_with_meta( :rtype: ~xmlservice.models.RootWithRefAndMeta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.RootWithRefAndMeta"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.RootWithRefAndMeta"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_complex_type_ref_with_meta_request( - template_url=self.get_complex_type_ref_with_meta.metadata["url"], + template_url=self.get_complex_type_ref_with_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("RootWithRefAndMeta", pipeline_response) + deserialized = self._deserialize('RootWithRefAndMeta', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_complex_type_ref_with_meta.metadata = {"url": "/xml/complex-type-ref-with-meta"} # type: ignore + get_complex_type_ref_with_meta.metadata = {'url': '/xml/complex-type-ref-with-meta'} # type: ignore + @distributed_trace def put_complex_type_ref_with_meta( @@ -956,23 +973,29 @@ def put_complex_type_ref_with_meta( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(model, "RootWithRefAndMeta", is_xml=True) + _content = self._serialize.body(model, 'RootWithRefAndMeta', is_xml=True) request = build_put_complex_type_ref_with_meta_request( content_type=content_type, content=_content, - template_url=self.put_complex_type_ref_with_meta.metadata["url"], + template_url=self.put_complex_type_ref_with_meta.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -982,11 +1005,13 @@ def put_complex_type_ref_with_meta( if cls: return cls(pipeline_response, None, {}) - put_complex_type_ref_with_meta.metadata = {"url": "/xml/complex-type-ref-with-meta"} # type: ignore + put_complex_type_ref_with_meta.metadata = {'url': '/xml/complex-type-ref-with-meta'} # type: ignore + @distributed_trace def get_simple( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Slideshow" """Get a simple XML document. @@ -996,17 +1021,24 @@ def get_simple( :rtype: ~xmlservice.models.Slideshow :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Slideshow"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Slideshow"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_simple_request( - template_url=self.get_simple.metadata["url"], + template_url=self.get_simple.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1014,14 +1046,15 @@ def get_simple( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("Slideshow", pipeline_response) + deserialized = self._deserialize('Slideshow', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_simple.metadata = {"url": "/xml/simple"} # type: ignore + get_simple.metadata = {'url': '/xml/simple'} # type: ignore + @distributed_trace def put_simple( @@ -1039,23 +1072,29 @@ def put_simple( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(slideshow, "Slideshow", is_xml=True) + _content = self._serialize.body(slideshow, 'Slideshow', is_xml=True) request = build_put_simple_request( content_type=content_type, content=_content, - template_url=self.put_simple.metadata["url"], + template_url=self.put_simple.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1066,11 +1105,13 @@ def put_simple( if cls: return cls(pipeline_response, None, {}) - put_simple.metadata = {"url": "/xml/simple"} # type: ignore + put_simple.metadata = {'url': '/xml/simple'} # type: ignore + @distributed_trace def get_wrapped_lists( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.AppleBarrel" """Get an XML document with multiple wrapped lists. @@ -1080,31 +1121,39 @@ def get_wrapped_lists( :rtype: ~xmlservice.models.AppleBarrel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AppleBarrel"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppleBarrel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_wrapped_lists_request( - template_url=self.get_wrapped_lists.metadata["url"], + template_url=self.get_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("AppleBarrel", pipeline_response) + deserialized = self._deserialize('AppleBarrel', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_wrapped_lists.metadata = {"url": "/xml/wrapped-lists"} # type: ignore + get_wrapped_lists.metadata = {'url': '/xml/wrapped-lists'} # type: ignore + @distributed_trace def put_wrapped_lists( @@ -1122,23 +1171,29 @@ def put_wrapped_lists( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(wrapped_lists, "AppleBarrel", is_xml=True) + _content = self._serialize.body(wrapped_lists, 'AppleBarrel', is_xml=True) request = build_put_wrapped_lists_request( content_type=content_type, content=_content, - template_url=self.put_wrapped_lists.metadata["url"], + template_url=self.put_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1149,11 +1204,13 @@ def put_wrapped_lists( if cls: return cls(pipeline_response, None, {}) - put_wrapped_lists.metadata = {"url": "/xml/wrapped-lists"} # type: ignore + put_wrapped_lists.metadata = {'url': '/xml/wrapped-lists'} # type: ignore + @distributed_trace def get_headers( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None """Get strongly-typed response headers. @@ -1163,17 +1220,24 @@ def get_headers( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_headers_request( - template_url=self.get_headers.metadata["url"], + template_url=self.get_headers.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1181,16 +1245,19 @@ def get_headers( raise HttpResponseError(response=response) response_headers = {} - response_headers["Custom-Header"] = self._deserialize("str", response.headers.get("Custom-Header")) + response_headers['Custom-Header']=self._deserialize('str', response.headers.get('Custom-Header')) + if cls: return cls(pipeline_response, None, response_headers) - get_headers.metadata = {"url": "/xml/headers"} # type: ignore + get_headers.metadata = {'url': '/xml/headers'} # type: ignore + @distributed_trace def get_empty_list( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Slideshow" """Get an empty list. @@ -1200,31 +1267,39 @@ def get_empty_list( :rtype: ~xmlservice.models.Slideshow :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Slideshow"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Slideshow"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_list_request( - template_url=self.get_empty_list.metadata["url"], + template_url=self.get_empty_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Slideshow", pipeline_response) + deserialized = self._deserialize('Slideshow', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_list.metadata = {"url": "/xml/empty-list"} # type: ignore + get_empty_list.metadata = {'url': '/xml/empty-list'} # type: ignore + @distributed_trace def put_empty_list( @@ -1242,23 +1317,29 @@ def put_empty_list( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(slideshow, "Slideshow", is_xml=True) + _content = self._serialize.body(slideshow, 'Slideshow', is_xml=True) request = build_put_empty_list_request( content_type=content_type, content=_content, - template_url=self.put_empty_list.metadata["url"], + template_url=self.put_empty_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1268,11 +1349,13 @@ def put_empty_list( if cls: return cls(pipeline_response, None, {}) - put_empty_list.metadata = {"url": "/xml/empty-list"} # type: ignore + put_empty_list.metadata = {'url': '/xml/empty-list'} # type: ignore + @distributed_trace def get_empty_wrapped_lists( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.AppleBarrel" """Gets some empty wrapped lists. @@ -1282,31 +1365,39 @@ def get_empty_wrapped_lists( :rtype: ~xmlservice.models.AppleBarrel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AppleBarrel"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppleBarrel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_wrapped_lists_request( - template_url=self.get_empty_wrapped_lists.metadata["url"], + template_url=self.get_empty_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("AppleBarrel", pipeline_response) + deserialized = self._deserialize('AppleBarrel', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_wrapped_lists.metadata = {"url": "/xml/empty-wrapped-lists"} # type: ignore + get_empty_wrapped_lists.metadata = {'url': '/xml/empty-wrapped-lists'} # type: ignore + @distributed_trace def put_empty_wrapped_lists( @@ -1324,23 +1415,29 @@ def put_empty_wrapped_lists( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(apple_barrel, "AppleBarrel", is_xml=True) + _content = self._serialize.body(apple_barrel, 'AppleBarrel', is_xml=True) request = build_put_empty_wrapped_lists_request( content_type=content_type, content=_content, - template_url=self.put_empty_wrapped_lists.metadata["url"], + template_url=self.put_empty_wrapped_lists.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1350,11 +1447,13 @@ def put_empty_wrapped_lists( if cls: return cls(pipeline_response, None, {}) - put_empty_wrapped_lists.metadata = {"url": "/xml/empty-wrapped-lists"} # type: ignore + put_empty_wrapped_lists.metadata = {'url': '/xml/empty-wrapped-lists'} # type: ignore + @distributed_trace def get_root_list( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Banana"] """Gets a list as the root element. @@ -1364,31 +1463,39 @@ def get_root_list( :rtype: list[~xmlservice.models.Banana] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Banana"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Banana"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_root_list_request( - template_url=self.get_root_list.metadata["url"], + template_url=self.get_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[Banana]", pipeline_response) + deserialized = self._deserialize('[Banana]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_root_list.metadata = {"url": "/xml/root-list"} # type: ignore + get_root_list.metadata = {'url': '/xml/root-list'} # type: ignore + @distributed_trace def put_root_list( @@ -1406,24 +1513,30 @@ def put_root_list( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "bananas", "wrapped": True, "itemsName": "banana"}} - _content = self._serialize.body(bananas, "[Banana]", is_xml=True, serialization_ctxt=serialization_ctxt) + serialization_ctxt = {"xml": {'name': 'bananas', 'wrapped': True, 'itemsName': 'banana'}} + _content = self._serialize.body(bananas, '[Banana]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_root_list_request( content_type=content_type, content=_content, - template_url=self.put_root_list.metadata["url"], + template_url=self.put_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1433,11 +1546,13 @@ def put_root_list( if cls: return cls(pipeline_response, None, {}) - put_root_list.metadata = {"url": "/xml/root-list"} # type: ignore + put_root_list.metadata = {'url': '/xml/root-list'} # type: ignore + @distributed_trace def get_root_list_single_item( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Banana"] """Gets a list with a single item. @@ -1447,31 +1562,39 @@ def get_root_list_single_item( :rtype: list[~xmlservice.models.Banana] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Banana"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Banana"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_root_list_single_item_request( - template_url=self.get_root_list_single_item.metadata["url"], + template_url=self.get_root_list_single_item.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[Banana]", pipeline_response) + deserialized = self._deserialize('[Banana]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_root_list_single_item.metadata = {"url": "/xml/root-list-single-item"} # type: ignore + get_root_list_single_item.metadata = {'url': '/xml/root-list-single-item'} # type: ignore + @distributed_trace def put_root_list_single_item( @@ -1489,24 +1612,30 @@ def put_root_list_single_item( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "bananas", "wrapped": True, "itemsName": "banana"}} - _content = self._serialize.body(bananas, "[Banana]", is_xml=True, serialization_ctxt=serialization_ctxt) + serialization_ctxt = {"xml": {'name': 'bananas', 'wrapped': True, 'itemsName': 'banana'}} + _content = self._serialize.body(bananas, '[Banana]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_root_list_single_item_request( content_type=content_type, content=_content, - template_url=self.put_root_list_single_item.metadata["url"], + template_url=self.put_root_list_single_item.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1516,11 +1645,13 @@ def put_root_list_single_item( if cls: return cls(pipeline_response, None, {}) - put_root_list_single_item.metadata = {"url": "/xml/root-list-single-item"} # type: ignore + put_root_list_single_item.metadata = {'url': '/xml/root-list-single-item'} # type: ignore + @distributed_trace def get_empty_root_list( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.Banana"] """Gets an empty list as the root element. @@ -1530,31 +1661,39 @@ def get_empty_root_list( :rtype: list[~xmlservice.models.Banana] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.Banana"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.Banana"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_root_list_request( - template_url=self.get_empty_root_list.metadata["url"], + template_url=self.get_empty_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[Banana]", pipeline_response) + deserialized = self._deserialize('[Banana]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_root_list.metadata = {"url": "/xml/empty-root-list"} # type: ignore + get_empty_root_list.metadata = {'url': '/xml/empty-root-list'} # type: ignore + @distributed_trace def put_empty_root_list( @@ -1572,24 +1711,30 @@ def put_empty_root_list( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "bananas", "wrapped": True, "itemsName": "banana"}} - _content = self._serialize.body(bananas, "[Banana]", is_xml=True, serialization_ctxt=serialization_ctxt) + serialization_ctxt = {"xml": {'name': 'bananas', 'wrapped': True, 'itemsName': 'banana'}} + _content = self._serialize.body(bananas, '[Banana]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_empty_root_list_request( content_type=content_type, content=_content, - template_url=self.put_empty_root_list.metadata["url"], + template_url=self.put_empty_root_list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1599,11 +1744,13 @@ def put_empty_root_list( if cls: return cls(pipeline_response, None, {}) - put_empty_root_list.metadata = {"url": "/xml/empty-root-list"} # type: ignore + put_empty_root_list.metadata = {'url': '/xml/empty-root-list'} # type: ignore + @distributed_trace def get_empty_child_element( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.Banana" """Gets an XML document with an empty child element. @@ -1613,31 +1760,39 @@ def get_empty_child_element( :rtype: ~xmlservice.models.Banana :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.Banana"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.Banana"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_empty_child_element_request( - template_url=self.get_empty_child_element.metadata["url"], + template_url=self.get_empty_child_element.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("Banana", pipeline_response) + deserialized = self._deserialize('Banana', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_empty_child_element.metadata = {"url": "/xml/empty-child-element"} # type: ignore + get_empty_child_element.metadata = {'url': '/xml/empty-child-element'} # type: ignore + @distributed_trace def put_empty_child_element( @@ -1655,23 +1810,29 @@ def put_empty_child_element( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(banana, "Banana", is_xml=True) + _content = self._serialize.body(banana, 'Banana', is_xml=True) request = build_put_empty_child_element_request( content_type=content_type, content=_content, - template_url=self.put_empty_child_element.metadata["url"], + template_url=self.put_empty_child_element.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1681,11 +1842,13 @@ def put_empty_child_element( if cls: return cls(pipeline_response, None, {}) - put_empty_child_element.metadata = {"url": "/xml/empty-child-element"} # type: ignore + put_empty_child_element.metadata = {'url': '/xml/empty-child-element'} # type: ignore + @distributed_trace def list_containers( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ListContainersResponse" """Lists containers in a storage account. @@ -1698,38 +1861,47 @@ def list_containers( :rtype: ~xmlservice.models.ListContainersResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ListContainersResponse"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListContainersResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str + comp = kwargs.pop('comp', "list") # type: str + request = build_list_containers_request( comp=comp, - template_url=self.list_containers.metadata["url"], + template_url=self.list_containers.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ListContainersResponse", pipeline_response) + deserialized = self._deserialize('ListContainersResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_containers.metadata = {"url": "/xml/"} # type: ignore + list_containers.metadata = {'url': '/xml/'} # type: ignore + @distributed_trace def get_service_properties( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.StorageServiceProperties" """Gets storage service properties. @@ -1745,36 +1917,44 @@ def get_service_properties( :rtype: ~xmlservice.models.StorageServiceProperties :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.StorageServiceProperties"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageServiceProperties"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + request = build_get_service_properties_request( comp=comp, restype=restype, - template_url=self.get_service_properties.metadata["url"], + template_url=self.get_service_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("StorageServiceProperties", pipeline_response) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_service_properties.metadata = {"url": "/xml/"} # type: ignore + get_service_properties.metadata = {'url': '/xml/'} # type: ignore + @distributed_trace def put_service_properties( @@ -1798,27 +1978,33 @@ def put_service_properties( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - _content = self._serialize.body(properties, "StorageServiceProperties", is_xml=True) + _content = self._serialize.body(properties, 'StorageServiceProperties', is_xml=True) request = build_put_service_properties_request( comp=comp, restype=restype, content_type=content_type, content=_content, - template_url=self.put_service_properties.metadata["url"], + template_url=self.put_service_properties.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1828,11 +2014,13 @@ def put_service_properties( if cls: return cls(pipeline_response, None, {}) - put_service_properties.metadata = {"url": "/xml/"} # type: ignore + put_service_properties.metadata = {'url': '/xml/'} # type: ignore + @distributed_trace def get_acls( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> List["_models.SignedIdentifier"] """Gets storage ACLs for a container. @@ -1848,36 +2036,44 @@ def get_acls( :rtype: list[~xmlservice.models.SignedIdentifier] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[List["_models.SignedIdentifier"]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.SignedIdentifier"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_get_acls_request( comp=comp, restype=restype, - template_url=self.get_acls.metadata["url"], + template_url=self.get_acls.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("[SignedIdentifier]", pipeline_response) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_acls.metadata = {"url": "/xml/mycontainer"} # type: ignore + get_acls.metadata = {'url': '/xml/mycontainer'} # type: ignore + @distributed_trace def put_acls( @@ -1901,30 +2097,34 @@ def put_acls( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] - serialization_ctxt = {"xml": {"name": "SignedIdentifiers", "wrapped": True, "itemsName": "SignedIdentifier"}} - _content = self._serialize.body( - properties, "[SignedIdentifier]", is_xml=True, serialization_ctxt=serialization_ctxt - ) + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} + _content = self._serialize.body(properties, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) request = build_put_acls_request( comp=comp, restype=restype, content_type=content_type, content=_content, - template_url=self.put_acls.metadata["url"], + template_url=self.put_acls.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -1934,11 +2134,13 @@ def put_acls( if cls: return cls(pipeline_response, None, {}) - put_acls.metadata = {"url": "/xml/mycontainer"} # type: ignore + put_acls.metadata = {'url': '/xml/mycontainer'} # type: ignore + @distributed_trace def list_blobs( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ListBlobsResponse" """Lists blobs in a storage container. @@ -1954,36 +2156,44 @@ def list_blobs( :rtype: ~xmlservice.models.ListBlobsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ListBlobsResponse"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListBlobsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_list_blobs_request( comp=comp, restype=restype, - template_url=self.list_blobs.metadata["url"], + template_url=self.list_blobs.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ListBlobsResponse", pipeline_response) + deserialized = self._deserialize('ListBlobsResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_blobs.metadata = {"url": "/xml/mycontainer"} # type: ignore + list_blobs.metadata = {'url': '/xml/mycontainer'} # type: ignore + @distributed_trace def json_input( @@ -2002,24 +2212,30 @@ def json_input( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _properties = _models.JSONInput(id=id) - _json = self._serialize.body(_properties, "JSONInput") + _json = self._serialize.body(_properties, 'JSONInput') request = build_json_input_request( content_type=content_type, json=_json, - template_url=self.json_input.metadata["url"], + template_url=self.json_input.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2029,11 +2245,13 @@ def json_input( if cls: return cls(pipeline_response, None, {}) - json_input.metadata = {"url": "/xml/jsoninput"} # type: ignore + json_input.metadata = {'url': '/xml/jsoninput'} # type: ignore + @distributed_trace def json_output( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.JSONOutput" """A Swagger with XML that has one operation that returns JSON. ID number 42. @@ -2043,35 +2261,44 @@ def json_output( :rtype: ~xmlservice.models.JSONOutput :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.JSONOutput"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.JSONOutput"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_json_output_request( - template_url=self.json_output.metadata["url"], + template_url=self.json_output.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("JSONOutput", pipeline_response) + deserialized = self._deserialize('JSONOutput', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - json_output.metadata = {"url": "/xml/jsonoutput"} # type: ignore + json_output.metadata = {'url': '/xml/jsonoutput'} # type: ignore + @distributed_trace def get_xms_text( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ObjectWithXMsTextProperty" """Get back an XML object with an x-ms-text property, which should translate to the returned @@ -2082,35 +2309,44 @@ def get_xms_text( :rtype: ~xmlservice.models.ObjectWithXMsTextProperty :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ObjectWithXMsTextProperty"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ObjectWithXMsTextProperty"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_xms_text_request( - template_url=self.get_xms_text.metadata["url"], + template_url=self.get_xms_text.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - deserialized = self._deserialize("ObjectWithXMsTextProperty", pipeline_response) + deserialized = self._deserialize('ObjectWithXMsTextProperty', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_xms_text.metadata = {"url": "/xml/x-ms-text"} # type: ignore + get_xms_text.metadata = {'url': '/xml/x-ms-text'} # type: ignore + @distributed_trace def get_bytes( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ModelWithByteProperty" """Get an XML document with binary property. @@ -2120,17 +2356,24 @@ def get_bytes( :rtype: ~xmlservice.models.ModelWithByteProperty :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ModelWithByteProperty"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ModelWithByteProperty"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_bytes_request( - template_url=self.get_bytes.metadata["url"], + template_url=self.get_bytes.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2138,14 +2381,15 @@ def get_bytes( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ModelWithByteProperty", pipeline_response) + deserialized = self._deserialize('ModelWithByteProperty', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_bytes.metadata = {"url": "/xml/bytes"} # type: ignore + get_bytes.metadata = {'url': '/xml/bytes'} # type: ignore + @distributed_trace def put_binary( @@ -2163,24 +2407,30 @@ def put_binary( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _slideshow = _models.ModelWithByteProperty(bytes=bytes) - _content = self._serialize.body(_slideshow, "ModelWithByteProperty", is_xml=True) + _content = self._serialize.body(_slideshow, 'ModelWithByteProperty', is_xml=True) request = build_put_binary_request( content_type=content_type, content=_content, - template_url=self.put_binary.metadata["url"], + template_url=self.put_binary.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -2191,11 +2441,13 @@ def put_binary( if cls: return cls(pipeline_response, None, {}) - put_binary.metadata = {"url": "/xml/bytes"} # type: ignore + put_binary.metadata = {'url': '/xml/bytes'} # type: ignore + @distributed_trace def get_uri( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> "_models.ModelWithUrlProperty" """Get an XML document with uri property. @@ -2205,17 +2457,24 @@ def get_uri( :rtype: ~xmlservice.models.ModelWithUrlProperty :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.ModelWithUrlProperty"] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType["_models.ModelWithUrlProperty"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_uri_request( - template_url=self.get_uri.metadata["url"], + template_url=self.get_uri.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -2223,14 +2482,15 @@ def get_uri( error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("ModelWithUrlProperty", pipeline_response) + deserialized = self._deserialize('ModelWithUrlProperty', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_uri.metadata = {"url": "/xml/url"} # type: ignore + get_uri.metadata = {'url': '/xml/url'} # type: ignore + @distributed_trace def put_uri( @@ -2248,24 +2508,30 @@ def put_uri( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _model = _models.ModelWithUrlProperty(url=url) - _content = self._serialize.body(_model, "ModelWithUrlProperty", is_xml=True) + _content = self._serialize.body(_model, 'ModelWithUrlProperty', is_xml=True) request = build_put_uri_request( content_type=content_type, content=_content, - template_url=self.put_uri.metadata["url"], + template_url=self.put_uri.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: @@ -2276,4 +2542,5 @@ def put_uri( if cls: return cls(pipeline_response, None, {}) - put_uri.metadata = {"url": "/xml/url"} # type: ignore + put_uri.metadata = {'url': '/xml/url'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py index ffc32bf4893..7ea66ee2c54 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ XMS Error Response Extensions. - """, + """ ) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/__init__.py index d1cf7e2a92f..d3432d67be3 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["XMSErrorResponseExtensions"] +__all__ = ['XMSErrorResponseExtensions'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_configuration.py index 4f88e442feb..04250f548fe 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_configuration.py @@ -18,7 +18,7 @@ from typing import Any -class XMSErrorResponseExtensionsConfiguration(Configuration): +class XMSErrorResponseExtensionsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for XMSErrorResponseExtensions. Note that all parameters used to create this instance are saved as instance @@ -26,24 +26,26 @@ class XMSErrorResponseExtensionsConfiguration(Configuration): """ def __init__( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None super(XMSErrorResponseExtensionsConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "xmserrorresponseextensions/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'xmserrorresponseextensions/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_vendor.py index 9aad73fc743..138f663c53a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_vendor.py @@ -7,7 +7,6 @@ from azure.core.pipeline.transport import HttpRequest - def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) @@ -15,7 +14,6 @@ def _convert_request(request, files=None): request.set_formdata_body(files) return request - def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -23,5 +21,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py index 887988a9327..0e231881668 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py @@ -18,11 +18,10 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional + from typing import Any from azure.core.rest import HttpRequest, HttpResponse - class XMSErrorResponseExtensions(object): """XMS Error Response Extensions. @@ -47,6 +46,7 @@ def __init__( self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) + def _send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/__init__.py index dc78ca60218..a6afdd01060 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._xms_error_response_extensions import XMSErrorResponseExtensions - -__all__ = ["XMSErrorResponseExtensions"] +__all__ = ['XMSErrorResponseExtensions'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_configuration.py index 6f7dc1e94db..658c16f25da 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class XMSErrorResponseExtensionsConfiguration(Configuration): +class XMSErrorResponseExtensionsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for XMSErrorResponseExtensions. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(XMSErrorResponseExtensionsConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "xmserrorresponseextensions/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'xmserrorresponseextensions/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py index 97a74a4b5e4..5cb410e1740 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ from ._configuration import XMSErrorResponseExtensionsConfiguration from .operations import PetOperations - class XMSErrorResponseExtensions: """XMS Error Response Extensions. @@ -27,7 +26,11 @@ class XMSErrorResponseExtensions: :type base_url: str """ - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> No self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/__init__.py index a072d24cd5c..5c1da84e7fb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._pet_operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py index 52ff6713396..473fc0e934b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -23,16 +16,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._pet_operations import ( - build_do_something_request, - build_get_pet_by_id_request, - build_has_models_param_request, -) - -T = TypeVar("T") +from ...operations._pet_operations import build_do_something_request, build_get_pet_by_id_request, build_has_models_param_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PetOperations: """PetOperations async operations. @@ -56,7 +43,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional["_models.Pet"]: + async def get_pet_by_id( + self, + pet_id: str, + **kwargs: Any + ) -> Optional["_models.Pet"]: """Gets pets by id. :param pet_id: pet id. @@ -66,26 +57,29 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional["_models.P :rtype: ~xmserrorresponse.models.Pet or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Pet"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Pet"]] error_map = { 401: ClientAuthenticationError, 409: ResourceExistsError, 400: HttpResponseError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.NotFoundErrorBase, response) - ), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.NotFoundErrorBase, response)), 501: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_get_pet_by_id_request( pet_id=pet_id, - template_url=self.get_pet_by_id.metadata["url"], + template_url=self.get_pet_by_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -94,17 +88,22 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional["_models.P deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_pet_by_id.metadata = {"url": "/errorStatusCodes/Pets/{petId}/GetPet"} # type: ignore + get_pet_by_id.metadata = {'url': '/errorStatusCodes/Pets/{petId}/GetPet'} # type: ignore + @distributed_trace_async - async def do_something(self, what_action: str, **kwargs: Any) -> "_models.PetAction": + async def do_something( + self, + what_action: str, + **kwargs: Any + ) -> "_models.PetAction": """Asks pet to do something. :param what_action: what action the pet should do. @@ -114,25 +113,28 @@ async def do_something(self, what_action: str, **kwargs: Any) -> "_models.PetAct :rtype: ~xmserrorresponse.models.PetAction :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAction"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAction"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) - ), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.PetActionError, response)), } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_do_something_request( what_action=what_action, - template_url=self.do_something.metadata["url"], + template_url=self.do_something.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,17 +142,22 @@ async def do_something(self, what_action: str, **kwargs: Any) -> "_models.PetAct error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAction", pipeline_response) + deserialized = self._deserialize('PetAction', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - do_something.metadata = {"url": "/errorStatusCodes/Pets/doSomething/{whatAction}"} # type: ignore + do_something.metadata = {'url': '/errorStatusCodes/Pets/doSomething/{whatAction}'} # type: ignore + @distributed_trace_async - async def has_models_param(self, models: Optional[str] = "value1", **kwargs: Any) -> None: + async def has_models_param( + self, + models: Optional[str] = "value1", + **kwargs: Any + ) -> None: """Ensure you can correctly deserialize the returned PetActionError and deserialization doesn't conflict with the input param name 'models'. @@ -162,25 +169,28 @@ async def has_models_param(self, models: Optional[str] = "value1", **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) - ), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.PetActionError, response)), } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_has_models_param_request( models=models, - template_url=self.has_models_param.metadata["url"], + template_url=self.has_models_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,4 +201,5 @@ async def has_models_param(self, models: Optional[str] = "value1", **kwargs: Any if cls: return cls(pipeline_response, None, {}) - has_models_param.metadata = {"url": "/errorStatusCodes/Pets/hasModelsParam"} # type: ignore + has_models_param.metadata = {'url': '/errorStatusCodes/Pets/hasModelsParam'} # type: ignore + diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py index 5a8c7bed900..2878ca3392b 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py @@ -30,14 +30,14 @@ from ._models import PetSadError # type: ignore __all__ = [ - "Animal", - "AnimalNotFound", - "BaseError", - "LinkNotFound", - "NotFoundErrorBase", - "Pet", - "PetAction", - "PetActionError", - "PetHungryOrThirstyError", - "PetSadError", + 'Animal', + 'AnimalNotFound', + 'BaseError', + 'LinkNotFound', + 'NotFoundErrorBase', + 'Pet', + 'PetAction', + 'PetActionError', + 'PetHungryOrThirstyError', + 'PetSadError', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models.py index fe603402157..f309da34e16 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models.py @@ -18,16 +18,19 @@ class Animal(msrest.serialization.Model): """ _attribute_map = { - "ani_type": {"key": "aniType", "type": "str"}, + 'ani_type': {'key': 'aniType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword ani_type: :paramtype ani_type: str """ super(Animal, self).__init__(**kwargs) - self.ani_type = kwargs.get("ani_type", None) + self.ani_type = kwargs.get('ani_type', None) class BaseError(msrest.serialization.Model): @@ -38,16 +41,19 @@ class BaseError(msrest.serialization.Model): """ _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword some_base_prop: :paramtype some_base_prop: str """ super(BaseError, self).__init__(**kwargs) - self.some_base_prop = kwargs.get("some_base_prop", None) + self.some_base_prop = kwargs.get('some_base_prop', None) class NotFoundErrorBase(BaseError): @@ -67,18 +73,23 @@ class NotFoundErrorBase(BaseError): """ _validation = { - "what_not_found": {"required": True}, + 'what_not_found': {'required': True}, } _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "what_not_found": {"key": "whatNotFound", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'what_not_found': {'key': 'whatNotFound', 'type': 'str'}, } - _subtype_map = {"what_not_found": {"AnimalNotFound": "AnimalNotFound", "InvalidResourceLink": "LinkNotFound"}} + _subtype_map = { + 'what_not_found': {'AnimalNotFound': 'AnimalNotFound', 'InvalidResourceLink': 'LinkNotFound'} + } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword some_base_prop: :paramtype some_base_prop: str @@ -86,8 +97,8 @@ def __init__(self, **kwargs): :paramtype reason: str """ super(NotFoundErrorBase, self).__init__(**kwargs) - self.reason = kwargs.get("reason", None) - self.what_not_found = "NotFoundErrorBase" # type: str + self.reason = kwargs.get('reason', None) + self.what_not_found = 'NotFoundErrorBase' # type: str class AnimalNotFound(NotFoundErrorBase): @@ -106,17 +117,20 @@ class AnimalNotFound(NotFoundErrorBase): """ _validation = { - "what_not_found": {"required": True}, + 'what_not_found': {'required': True}, } _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "what_not_found": {"key": "whatNotFound", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'what_not_found': {'key': 'whatNotFound', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword some_base_prop: :paramtype some_base_prop: str @@ -126,8 +140,8 @@ def __init__(self, **kwargs): :paramtype name: str """ super(AnimalNotFound, self).__init__(**kwargs) - self.what_not_found = "AnimalNotFound" # type: str - self.name = kwargs.get("name", None) + self.what_not_found = 'AnimalNotFound' # type: str + self.name = kwargs.get('name', None) class LinkNotFound(NotFoundErrorBase): @@ -146,17 +160,20 @@ class LinkNotFound(NotFoundErrorBase): """ _validation = { - "what_not_found": {"required": True}, + 'what_not_found': {'required': True}, } _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "what_not_found": {"key": "whatNotFound", "type": "str"}, - "what_sub_address": {"key": "whatSubAddress", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'what_not_found': {'key': 'whatNotFound', 'type': 'str'}, + 'what_sub_address': {'key': 'whatSubAddress', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword some_base_prop: :paramtype some_base_prop: str @@ -166,8 +183,8 @@ def __init__(self, **kwargs): :paramtype what_sub_address: str """ super(LinkNotFound, self).__init__(**kwargs) - self.what_not_found = "InvalidResourceLink" # type: str - self.what_sub_address = kwargs.get("what_sub_address", None) + self.what_not_found = 'InvalidResourceLink' # type: str + self.what_sub_address = kwargs.get('what_sub_address', None) class Pet(Animal): @@ -182,15 +199,18 @@ class Pet(Animal): """ _validation = { - "name": {"readonly": True}, + 'name': {'readonly': True}, } _attribute_map = { - "ani_type": {"key": "aniType", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'ani_type': {'key': 'aniType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword ani_type: :paramtype ani_type: str @@ -207,16 +227,19 @@ class PetAction(msrest.serialization.Model): """ _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword action_response: action feedback. :paramtype action_response: str """ super(PetAction, self).__init__(**kwargs) - self.action_response = kwargs.get("action_response", None) + self.action_response = kwargs.get('action_response', None) class PetActionError(PetAction): @@ -236,18 +259,23 @@ class PetActionError(PetAction): """ _validation = { - "error_type": {"required": True}, + 'error_type': {'required': True}, } _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, } - _subtype_map = {"error_type": {"PetSadError": "PetSadError"}} + _subtype_map = { + 'error_type': {'PetSadError': 'PetSadError'} + } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword action_response: action feedback. :paramtype action_response: str @@ -255,8 +283,8 @@ def __init__(self, **kwargs): :paramtype error_message: str """ super(PetActionError, self).__init__(**kwargs) - self.error_type = "PetActionError" # type: str - self.error_message = kwargs.get("error_message", None) + self.error_type = 'PetActionError' # type: str + self.error_message = kwargs.get('error_message', None) class PetSadError(PetActionError): @@ -278,19 +306,24 @@ class PetSadError(PetActionError): """ _validation = { - "error_type": {"required": True}, + 'error_type': {'required': True}, } _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, } - _subtype_map = {"error_type": {"PetHungryOrThirstyError": "PetHungryOrThirstyError"}} + _subtype_map = { + 'error_type': {'PetHungryOrThirstyError': 'PetHungryOrThirstyError'} + } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword action_response: action feedback. :paramtype action_response: str @@ -300,8 +333,8 @@ def __init__(self, **kwargs): :paramtype reason: str """ super(PetSadError, self).__init__(**kwargs) - self.error_type = "PetSadError" # type: str - self.reason = kwargs.get("reason", None) + self.error_type = 'PetSadError' # type: str + self.reason = kwargs.get('reason', None) class PetHungryOrThirstyError(PetSadError): @@ -322,18 +355,21 @@ class PetHungryOrThirstyError(PetSadError): """ _validation = { - "error_type": {"required": True}, + 'error_type': {'required': True}, } _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "hungry_or_thirsty": {"key": "hungryOrThirsty", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'hungry_or_thirsty': {'key': 'hungryOrThirsty', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): """ :keyword action_response: action feedback. :paramtype action_response: str @@ -345,5 +381,5 @@ def __init__(self, **kwargs): :paramtype hungry_or_thirsty: str """ super(PetHungryOrThirstyError, self).__init__(**kwargs) - self.error_type = "PetHungryOrThirstyError" # type: str - self.hungry_or_thirsty = kwargs.get("hungry_or_thirsty", None) + self.error_type = 'PetHungryOrThirstyError' # type: str + self.hungry_or_thirsty = kwargs.get('hungry_or_thirsty', None) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models_py3.py index 13ec792b9f1..0e979d24872 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models_py3.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_models_py3.py @@ -20,10 +20,15 @@ class Animal(msrest.serialization.Model): """ _attribute_map = { - "ani_type": {"key": "aniType", "type": "str"}, + 'ani_type': {'key': 'aniType', 'type': 'str'}, } - def __init__(self, *, ani_type: Optional[str] = None, **kwargs): + def __init__( + self, + *, + ani_type: Optional[str] = None, + **kwargs + ): """ :keyword ani_type: :paramtype ani_type: str @@ -40,10 +45,15 @@ class BaseError(msrest.serialization.Model): """ _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, } - def __init__(self, *, some_base_prop: Optional[str] = None, **kwargs): + def __init__( + self, + *, + some_base_prop: Optional[str] = None, + **kwargs + ): """ :keyword some_base_prop: :paramtype some_base_prop: str @@ -69,18 +79,26 @@ class NotFoundErrorBase(BaseError): """ _validation = { - "what_not_found": {"required": True}, + 'what_not_found': {'required': True}, } _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "what_not_found": {"key": "whatNotFound", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'what_not_found': {'key': 'whatNotFound', 'type': 'str'}, } - _subtype_map = {"what_not_found": {"AnimalNotFound": "AnimalNotFound", "InvalidResourceLink": "LinkNotFound"}} + _subtype_map = { + 'what_not_found': {'AnimalNotFound': 'AnimalNotFound', 'InvalidResourceLink': 'LinkNotFound'} + } - def __init__(self, *, some_base_prop: Optional[str] = None, reason: Optional[str] = None, **kwargs): + def __init__( + self, + *, + some_base_prop: Optional[str] = None, + reason: Optional[str] = None, + **kwargs + ): """ :keyword some_base_prop: :paramtype some_base_prop: str @@ -89,7 +107,7 @@ def __init__(self, *, some_base_prop: Optional[str] = None, reason: Optional[str """ super(NotFoundErrorBase, self).__init__(some_base_prop=some_base_prop, **kwargs) self.reason = reason - self.what_not_found = "NotFoundErrorBase" # type: str + self.what_not_found = 'NotFoundErrorBase' # type: str class AnimalNotFound(NotFoundErrorBase): @@ -108,14 +126,14 @@ class AnimalNotFound(NotFoundErrorBase): """ _validation = { - "what_not_found": {"required": True}, + 'what_not_found': {'required': True}, } _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "what_not_found": {"key": "whatNotFound", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'what_not_found': {'key': 'whatNotFound', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } def __init__( @@ -135,7 +153,7 @@ def __init__( :paramtype name: str """ super(AnimalNotFound, self).__init__(some_base_prop=some_base_prop, reason=reason, **kwargs) - self.what_not_found = "AnimalNotFound" # type: str + self.what_not_found = 'AnimalNotFound' # type: str self.name = name @@ -155,14 +173,14 @@ class LinkNotFound(NotFoundErrorBase): """ _validation = { - "what_not_found": {"required": True}, + 'what_not_found': {'required': True}, } _attribute_map = { - "some_base_prop": {"key": "someBaseProp", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "what_not_found": {"key": "whatNotFound", "type": "str"}, - "what_sub_address": {"key": "whatSubAddress", "type": "str"}, + 'some_base_prop': {'key': 'someBaseProp', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'what_not_found': {'key': 'whatNotFound', 'type': 'str'}, + 'what_sub_address': {'key': 'whatSubAddress', 'type': 'str'}, } def __init__( @@ -182,7 +200,7 @@ def __init__( :paramtype what_sub_address: str """ super(LinkNotFound, self).__init__(some_base_prop=some_base_prop, reason=reason, **kwargs) - self.what_not_found = "InvalidResourceLink" # type: str + self.what_not_found = 'InvalidResourceLink' # type: str self.what_sub_address = what_sub_address @@ -198,15 +216,20 @@ class Pet(Animal): """ _validation = { - "name": {"readonly": True}, + 'name': {'readonly': True}, } _attribute_map = { - "ani_type": {"key": "aniType", "type": "str"}, - "name": {"key": "name", "type": "str"}, + 'ani_type': {'key': 'aniType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, ani_type: Optional[str] = None, **kwargs): + def __init__( + self, + *, + ani_type: Optional[str] = None, + **kwargs + ): """ :keyword ani_type: :paramtype ani_type: str @@ -223,10 +246,15 @@ class PetAction(msrest.serialization.Model): """ _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, } - def __init__(self, *, action_response: Optional[str] = None, **kwargs): + def __init__( + self, + *, + action_response: Optional[str] = None, + **kwargs + ): """ :keyword action_response: action feedback. :paramtype action_response: str @@ -252,18 +280,26 @@ class PetActionError(PetAction): """ _validation = { - "error_type": {"required": True}, + 'error_type': {'required': True}, } _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, } - _subtype_map = {"error_type": {"PetSadError": "PetSadError"}} + _subtype_map = { + 'error_type': {'PetSadError': 'PetSadError'} + } - def __init__(self, *, action_response: Optional[str] = None, error_message: Optional[str] = None, **kwargs): + def __init__( + self, + *, + action_response: Optional[str] = None, + error_message: Optional[str] = None, + **kwargs + ): """ :keyword action_response: action feedback. :paramtype action_response: str @@ -271,7 +307,7 @@ def __init__(self, *, action_response: Optional[str] = None, error_message: Opti :paramtype error_message: str """ super(PetActionError, self).__init__(action_response=action_response, **kwargs) - self.error_type = "PetActionError" # type: str + self.error_type = 'PetActionError' # type: str self.error_message = error_message @@ -294,17 +330,19 @@ class PetSadError(PetActionError): """ _validation = { - "error_type": {"required": True}, + 'error_type': {'required': True}, } _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, } - _subtype_map = {"error_type": {"PetHungryOrThirstyError": "PetHungryOrThirstyError"}} + _subtype_map = { + 'error_type': {'PetHungryOrThirstyError': 'PetHungryOrThirstyError'} + } def __init__( self, @@ -323,7 +361,7 @@ def __init__( :paramtype reason: str """ super(PetSadError, self).__init__(action_response=action_response, error_message=error_message, **kwargs) - self.error_type = "PetSadError" # type: str + self.error_type = 'PetSadError' # type: str self.reason = reason @@ -345,15 +383,15 @@ class PetHungryOrThirstyError(PetSadError): """ _validation = { - "error_type": {"required": True}, + 'error_type': {'required': True}, } _attribute_map = { - "action_response": {"key": "actionResponse", "type": "str"}, - "error_type": {"key": "errorType", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "hungry_or_thirsty": {"key": "hungryOrThirsty", "type": "str"}, + 'action_response': {'key': 'actionResponse', 'type': 'str'}, + 'error_type': {'key': 'errorType', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'hungry_or_thirsty': {'key': 'hungryOrThirsty', 'type': 'str'}, } def __init__( @@ -375,8 +413,6 @@ def __init__( :keyword hungry_or_thirsty: is the pet hungry or thirsty or both. :paramtype hungry_or_thirsty: str """ - super(PetHungryOrThirstyError, self).__init__( - action_response=action_response, error_message=error_message, reason=reason, **kwargs - ) - self.error_type = "PetHungryOrThirstyError" # type: str + super(PetHungryOrThirstyError, self).__init__(action_response=action_response, error_message=error_message, reason=reason, **kwargs) + self.error_type = 'PetHungryOrThirstyError' # type: str self.hungry_or_thirsty = hungry_or_thirsty diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/__init__.py index a072d24cd5c..5c1da84e7fb 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/__init__.py @@ -9,5 +9,5 @@ from ._pet_operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py index ccc3bd6089b..74f51bad64e 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -27,9 +20,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -154,26 +146,29 @@ def get_pet_by_id( :rtype: ~xmserrorresponse.models.Pet or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional["_models.Pet"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Pet"]] error_map = { 401: ClientAuthenticationError, 409: ResourceExistsError, 400: HttpResponseError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.NotFoundErrorBase, response) - ), + 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.NotFoundErrorBase, response)), 501: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_get_pet_by_id_request( pet_id=pet_id, - template_url=self.get_pet_by_id.metadata["url"], + template_url=self.get_pet_by_id.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -182,14 +177,15 @@ def get_pet_by_id( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("Pet", pipeline_response) + deserialized = self._deserialize('Pet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_pet_by_id.metadata = {"url": "/errorStatusCodes/Pets/{petId}/GetPet"} # type: ignore + get_pet_by_id.metadata = {'url': '/errorStatusCodes/Pets/{petId}/GetPet'} # type: ignore + @distributed_trace def do_something( @@ -207,25 +203,28 @@ def do_something( :rtype: ~xmserrorresponse.models.PetAction :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.PetAction"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PetAction"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) - ), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.PetActionError, response)), } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_do_something_request( what_action=what_action, - template_url=self.do_something.metadata["url"], + template_url=self.do_something.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -233,14 +232,15 @@ def do_something( error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("PetAction", pipeline_response) + deserialized = self._deserialize('PetAction', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - do_something.metadata = {"url": "/errorStatusCodes/Pets/doSomething/{whatAction}"} # type: ignore + do_something.metadata = {'url': '/errorStatusCodes/Pets/doSomething/{whatAction}'} # type: ignore + @distributed_trace def has_models_param( @@ -260,25 +260,28 @@ def has_models_param( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) - ), + 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.PetActionError, response)), } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_has_models_param_request( models=models, - template_url=self.has_models_param.metadata["url"], + template_url=self.has_models_param.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -289,4 +292,5 @@ def has_models_param( if cls: return cls(pipeline_response, None, {}) - has_models_param.metadata = {"url": "/errorStatusCodes/Pets/hasModelsParam"} # type: ignore + has_models_param.metadata = {'url': '/errorStatusCodes/Pets/hasModelsParam'} # type: ignore + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/__init__.py index 82bd90b483e..f4e9ea3fdbc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AdditionalPropertiesClient"] +__all__ = ['AdditionalPropertiesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_additional_properties_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_additional_properties_client.py index 801e1f129f6..227d40e3cd7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_additional_properties_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_additional_properties_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AdditionalPropertiesClient: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AdditionalPropertiesClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AdditionalPropertiesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_configuration.py index 109de7bc226..f6d666851f1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AdditionalPropertiesClientConfiguration(Configuration): +class AdditionalPropertiesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AdditionalPropertiesClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AdditionalPropertiesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "additionalpropertiesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'additionalpropertiesclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/__init__.py index 43f6b8afe9d..044030f73fc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._additional_properties_client import AdditionalPropertiesClient - -__all__ = ["AdditionalPropertiesClient"] +__all__ = ['AdditionalPropertiesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_additional_properties_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_additional_properties_client.py index 6dbd57b980f..b3ac439946b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_additional_properties_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_additional_properties_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AdditionalPropertiesClient: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AdditionalPropertiesClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AdditionalPropertiesClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `additionalpropertieslowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_configuration.py index c431b41cf3a..d815acb6132 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AdditionalPropertiesClientConfiguration(Configuration): +class AdditionalPropertiesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AdditionalPropertiesClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AdditionalPropertiesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "additionalpropertiesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'additionalpropertiesclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py index 65128f19617..8ba7a811af2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py @@ -22,10 +22,10 @@ from ._request_builders import build_create_ap_in_properties_with_ap_string_request # type: ignore __all__ = [ - "build_create_ap_true_request", - "build_create_cat_ap_true_request", - "build_create_ap_object_request", - "build_create_ap_string_request", - "build_create_ap_in_properties_request", - "build_create_ap_in_properties_with_ap_string_request", + 'build_create_ap_true_request', + 'build_create_cat_ap_true_request', + 'build_create_ap_object_request', + 'build_create_ap_string_request', + 'build_create_ap_in_properties_request', + 'build_create_ap_in_properties_with_ap_string_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py index ce195c06854..a6b7ac94e45 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -47,14 +46,14 @@ def build_create_ap_true_request( # JSON input template you can fill out and use as your body input. json = { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } # response body for status code(s): 200 response.json() == { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } @@ -106,7 +105,7 @@ def build_create_cat_ap_true_request( # JSON input template you can fill out and use as your body input. json = { "friendly": bool, # Optional. - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } @@ -114,7 +113,7 @@ def build_create_cat_ap_true_request( # response body for status code(s): 200 response.json() == { "friendly": bool, # Optional. - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } @@ -165,14 +164,14 @@ def build_create_ap_object_request( # JSON input template you can fill out and use as your body input. json = { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } # response body for status code(s): 200 response.json() == { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } @@ -223,14 +222,14 @@ def build_create_ap_string_request( # JSON input template you can fill out and use as your body input. json = { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } # response body for status code(s): 200 response.json() == { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } @@ -281,14 +280,14 @@ def build_create_ap_in_properties_request( # JSON input template you can fill out and use as your body input. json = { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } # response body for status code(s): 200 response.json() == { - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } @@ -339,22 +338,22 @@ def build_create_ap_in_properties_with_ap_string_request( # JSON input template you can fill out and use as your body input. json = { - "@odata.location": "str", # Required. + "@odata.location": "str", # Required. "additionalProperties": { "str": 0.0 # Optional. Dictionary of :code:``. }, - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } # response body for status code(s): 200 response.json() == { - "@odata.location": "str", # Required. + "@odata.location": "str", # Required. "additionalProperties": { "str": 0.0 # Optional. Dictionary of :code:``. }, - "id": 0, # Required. + "id": 0, # Required. "name": "str", # Optional. "status": bool # Optional. } @@ -378,3 +377,4 @@ def build_create_ap_in_properties_with_ap_string_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py index 8cbf6555022..17f1c9ed44c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py @@ -9,15 +9,19 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_create_ap_true_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_create_ap_true_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -52,22 +56,34 @@ def build_create_ap_true_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/true" + url = '/additionalProperties/true' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_create_cat_ap_true_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_cat_ap_true_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Create a CatAPTrue which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -104,22 +120,34 @@ def build_create_cat_ap_true_request(*, json: JSONType = None, content: Any = No } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/true-subclass" + url = '/additionalProperties/true-subclass' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_create_ap_object_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_ap_object_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -154,22 +182,34 @@ def build_create_ap_object_request(*, json: JSONType = None, content: Any = None } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/type/object" + url = '/additionalProperties/type/object' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_create_ap_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_ap_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -204,22 +244,34 @@ def build_create_ap_string_request(*, json: JSONType = None, content: Any = None } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/type/string" + url = '/additionalProperties/type/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_create_ap_in_properties_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_ap_in_properties_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -254,23 +306,33 @@ def build_create_ap_in_properties_request(*, json: JSONType = None, content: Any } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/in/properties" + url = '/additionalProperties/in/properties' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_create_ap_in_properties_with_ap_string_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Create a Pet which contains more properties than what is defined. @@ -314,16 +376,24 @@ def build_create_ap_in_properties_with_ap_string_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/in/properties/with/additionalProperties/string" + url = '/additionalProperties/in/properties/with/additionalProperties/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/setup.py index afc03668fe3..1034510e10b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/__init__.py index 7e1dae047a1..f29d927007d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AnythingClient"] +__all__ = ['AnythingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_anything_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_anything_client.py index 558949fd767..787cbfc4272 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_anything_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_anything_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,16 +19,21 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AnythingClient: - """Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. + """Service client for testing basic anything types. Those schemas without types can be anything: + primitive, object, array. :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AnythingClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_configuration.py index 7579bd6ad06..c6b60378423 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AnythingClientConfiguration(Configuration): +class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AnythingClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AnythingClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "anythingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'anythingclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/__init__.py index fbe1d346305..007b54da226 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._anything_client import AnythingClient - -__all__ = ["AnythingClient"] +__all__ = ['AnythingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_anything_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_anything_client.py index 0f5cb8c686e..0cc1eadf6f4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_anything_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_anything_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,15 +19,20 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AnythingClient: - """Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. + """Service client for testing basic anything types. Those schemas without types can be anything: + primitive, object, array. :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AnythingClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `anythinglowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_configuration.py index b5720beca20..377954d2dff 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AnythingClientConfiguration(Configuration): +class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AnythingClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AnythingClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "anythingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'anythingclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py index cc874f11a17..cd9395ddb14 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py @@ -22,10 +22,10 @@ from ._request_builders import build_put_array_request # type: ignore __all__ = [ - "build_get_object_request", - "build_put_object_request", - "build_get_string_request", - "build_put_string_request", - "build_get_array_request", - "build_put_array_request", + 'build_get_object_request', + 'build_put_object_request', + 'build_get_string_request', + 'build_put_string_request', + 'build_get_array_request', + 'build_put_array_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py index aed30379788..a2a2cd03f2d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -258,3 +257,4 @@ def build_put_array_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py index cf8f859f4b3..b164aea5a9a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_object_request(**kwargs: Any) -> HttpRequest: +def build_get_object_request( + **kwargs: Any +) -> HttpRequest: """Basic get that returns an object as anything. Returns object { 'message': 'An object was successfully returned' }. @@ -32,16 +33,26 @@ def build_get_object_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/anything/object" + url = '/anything/object' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_object_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_object_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -68,20 +79,29 @@ def build_put_object_request(*, json: JSONType = None, content: Any = None, **kw json = {} # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/anything/object" + url = '/anything/object' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_string_request(**kwargs: Any) -> HttpRequest: +def build_get_string_request( + **kwargs: Any +) -> HttpRequest: """Basic get that returns an string as anything. Returns string 'foo'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -95,16 +115,26 @@ def build_get_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/anything/string" + url = '/anything/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to get an object error. @@ -131,20 +161,29 @@ def build_put_string_request(*, json: JSONType = None, content: Any = None, **kw json = {} # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/anything/string" + url = '/anything/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_array_request(**kwargs: Any) -> HttpRequest: +def build_get_array_request( + **kwargs: Any +) -> HttpRequest: """Basic get that returns an array as anything. Returns string ['foo', 'bar']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -158,16 +197,26 @@ def build_get_array_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/anything/array" + url = '/anything/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_array_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else to get an object error. @@ -194,14 +243,22 @@ def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwa json = {} # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/anything/array" + url = '/anything/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/setup.py index 5983ebe0fb1..13b9e2c8eb3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/__init__.py index c845d24af2c..e4684d784ee 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_auto_rest_swagger_bat_array_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_auto_rest_swagger_bat_array_service.py index 36e1176f16c..62d130703b0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_auto_rest_swagger_bat_array_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATArrayService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATArrayService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_configuration.py index 2f8438033fd..25a81fbf1ce 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/__init__.py index e216d69d910..9992f153487 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService - -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_auto_rest_swagger_bat_array_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_auto_rest_swagger_bat_array_service.py index 08686614200..9ff6a69b1de 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_auto_rest_swagger_bat_array_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATArrayService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATArrayService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodyarraylowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_configuration.py index 99fd3c7c6ab..71ef2cbc2a8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): +class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATArrayService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py index a715b62d9ae..4b12710fa05 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py @@ -148,73 +148,73 @@ from ._request_builders import build_put_dictionary_valid_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_invalid_request", - "build_get_empty_request", - "build_put_empty_request", - "build_get_boolean_tfft_request", - "build_put_boolean_tfft_request", - "build_get_boolean_invalid_null_request", - "build_get_boolean_invalid_string_request", - "build_get_integer_valid_request", - "build_put_integer_valid_request", - "build_get_int_invalid_null_request", - "build_get_int_invalid_string_request", - "build_get_long_valid_request", - "build_put_long_valid_request", - "build_get_long_invalid_null_request", - "build_get_long_invalid_string_request", - "build_get_float_valid_request", - "build_put_float_valid_request", - "build_get_float_invalid_null_request", - "build_get_float_invalid_string_request", - "build_get_double_valid_request", - "build_put_double_valid_request", - "build_get_double_invalid_null_request", - "build_get_double_invalid_string_request", - "build_get_string_valid_request", - "build_put_string_valid_request", - "build_get_enum_valid_request", - "build_put_enum_valid_request", - "build_get_string_enum_valid_request", - "build_put_string_enum_valid_request", - "build_get_string_with_null_request", - "build_get_string_with_invalid_request", - "build_get_uuid_valid_request", - "build_put_uuid_valid_request", - "build_get_uuid_invalid_chars_request", - "build_get_date_valid_request", - "build_put_date_valid_request", - "build_get_date_invalid_null_request", - "build_get_date_invalid_chars_request", - "build_get_date_time_valid_request", - "build_put_date_time_valid_request", - "build_get_date_time_invalid_null_request", - "build_get_date_time_invalid_chars_request", - "build_get_date_time_rfc1123_valid_request", - "build_put_date_time_rfc1123_valid_request", - "build_get_duration_valid_request", - "build_put_duration_valid_request", - "build_get_byte_valid_request", - "build_put_byte_valid_request", - "build_get_byte_invalid_null_request", - "build_get_base64_url_request", - "build_get_complex_null_request", - "build_get_complex_empty_request", - "build_get_complex_item_null_request", - "build_get_complex_item_empty_request", - "build_get_complex_valid_request", - "build_put_complex_valid_request", - "build_get_array_null_request", - "build_get_array_empty_request", - "build_get_array_item_null_request", - "build_get_array_item_empty_request", - "build_get_array_valid_request", - "build_put_array_valid_request", - "build_get_dictionary_null_request", - "build_get_dictionary_empty_request", - "build_get_dictionary_item_null_request", - "build_get_dictionary_item_empty_request", - "build_get_dictionary_valid_request", - "build_put_dictionary_valid_request", + 'build_get_null_request', + 'build_get_invalid_request', + 'build_get_empty_request', + 'build_put_empty_request', + 'build_get_boolean_tfft_request', + 'build_put_boolean_tfft_request', + 'build_get_boolean_invalid_null_request', + 'build_get_boolean_invalid_string_request', + 'build_get_integer_valid_request', + 'build_put_integer_valid_request', + 'build_get_int_invalid_null_request', + 'build_get_int_invalid_string_request', + 'build_get_long_valid_request', + 'build_put_long_valid_request', + 'build_get_long_invalid_null_request', + 'build_get_long_invalid_string_request', + 'build_get_float_valid_request', + 'build_put_float_valid_request', + 'build_get_float_invalid_null_request', + 'build_get_float_invalid_string_request', + 'build_get_double_valid_request', + 'build_put_double_valid_request', + 'build_get_double_invalid_null_request', + 'build_get_double_invalid_string_request', + 'build_get_string_valid_request', + 'build_put_string_valid_request', + 'build_get_enum_valid_request', + 'build_put_enum_valid_request', + 'build_get_string_enum_valid_request', + 'build_put_string_enum_valid_request', + 'build_get_string_with_null_request', + 'build_get_string_with_invalid_request', + 'build_get_uuid_valid_request', + 'build_put_uuid_valid_request', + 'build_get_uuid_invalid_chars_request', + 'build_get_date_valid_request', + 'build_put_date_valid_request', + 'build_get_date_invalid_null_request', + 'build_get_date_invalid_chars_request', + 'build_get_date_time_valid_request', + 'build_put_date_time_valid_request', + 'build_get_date_time_invalid_null_request', + 'build_get_date_time_invalid_chars_request', + 'build_get_date_time_rfc1123_valid_request', + 'build_put_date_time_rfc1123_valid_request', + 'build_get_duration_valid_request', + 'build_put_duration_valid_request', + 'build_get_byte_valid_request', + 'build_put_byte_valid_request', + 'build_get_byte_invalid_null_request', + 'build_get_base64_url_request', + 'build_get_complex_null_request', + 'build_get_complex_empty_request', + 'build_get_complex_item_null_request', + 'build_get_complex_item_empty_request', + 'build_get_complex_valid_request', + 'build_put_complex_valid_request', + 'build_get_array_null_request', + 'build_get_array_empty_request', + 'build_get_array_item_null_request', + 'build_get_array_item_empty_request', + 'build_get_array_valid_request', + 'build_put_array_valid_request', + 'build_get_dictionary_null_request', + 'build_get_dictionary_empty_request', + 'build_get_dictionary_item_null_request', + 'build_get_dictionary_item_empty_request', + 'build_get_dictionary_valid_request', + 'build_put_dictionary_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py index 3bf77d7a8be..059d8913af4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -13,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -2951,3 +2949,4 @@ def build_put_dictionary_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py index 1bae29ac3fd..25fab201011 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime -from typing import Any, Dict, List, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null array value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -40,16 +40,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/null" + url = '/array/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get invalid array [1, 2, 3. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -71,16 +78,23 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/invalid" + url = '/array/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get empty array value []. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -102,16 +116,26 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/empty" + url = '/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value empty []. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -137,22 +161,31 @@ def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwa ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/empty" + url = '/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_tfft_request( + **kwargs: Any +) -> HttpRequest: """Get boolean array value [true, false, false, true]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -174,16 +207,26 @@ def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/boolean/tfft" + url = '/array/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_boolean_tfft_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value empty [true, false, false, true]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -209,22 +252,31 @@ def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/boolean/tfft" + url = '/array/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get boolean array value [true, null, false]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -246,16 +298,23 @@ def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/boolean/true.null.false" + url = '/array/prim/boolean/true.null.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get boolean array value [true, 'boolean', false]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -277,16 +336,23 @@ def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/boolean/true.boolean.false" + url = '/array/prim/boolean/true.boolean.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_integer_valid_request( + **kwargs: Any +) -> HttpRequest: """Get integer array value [1, -1, 3, 300]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -308,16 +374,26 @@ def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/integer/1.-1.3.300" + url = '/array/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_integer_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_integer_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -343,22 +419,31 @@ def build_put_integer_valid_request(*, json: JSONType = None, content: Any = Non ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/integer/1.-1.3.300" + url = '/array/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_int_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get integer array value [1, null, 0]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -380,16 +465,23 @@ def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/integer/1.null.zero" + url = '/array/prim/integer/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_int_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get integer array value [1, 'integer', 0]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -411,16 +503,23 @@ def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/integer/1.integer.0" + url = '/array/prim/integer/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_long_valid_request( + **kwargs: Any +) -> HttpRequest: """Get integer array value [1, -1, 3, 300]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -442,16 +541,26 @@ def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/long/1.-1.3.300" + url = '/array/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_long_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -477,22 +586,31 @@ def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/long/1.-1.3.300" + url = '/array/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_long_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get long array value [1, null, 0]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -514,16 +632,23 @@ def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/long/1.null.zero" + url = '/array/prim/long/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_long_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get long array value [1, 'integer', 0]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -545,16 +670,23 @@ def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/long/1.integer.0" + url = '/array/prim/long/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_float_valid_request( + **kwargs: Any +) -> HttpRequest: """Get float array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -576,16 +708,26 @@ def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/float/0--0.01-1.2e20" + url = '/array/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_float_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -611,22 +753,31 @@ def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/float/0--0.01-1.2e20" + url = '/array/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_float_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get float array value [0.0, null, -1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -648,16 +799,23 @@ def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/float/0.0-null-1.2e20" + url = '/array/prim/float/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_float_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get boolean array value [1.0, 'number', 0.0]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -679,16 +837,23 @@ def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/float/1.number.0" + url = '/array/prim/float/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_double_valid_request( + **kwargs: Any +) -> HttpRequest: """Get float array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -710,16 +875,26 @@ def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/double/0--0.01-1.2e20" + url = '/array/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_double_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_double_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -745,22 +920,31 @@ def build_put_double_valid_request(*, json: JSONType = None, content: Any = None ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/double/0--0.01-1.2e20" + url = '/array/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_double_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get float array value [0.0, null, -1.2e20]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -782,16 +966,23 @@ def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/double/0.0-null-1.2e20" + url = '/array/prim/double/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_double_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get boolean array value [1.0, 'number', 0.0]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -813,16 +1004,23 @@ def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/double/1.number.0" + url = '/array/prim/double/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_valid_request( + **kwargs: Any +) -> HttpRequest: """Get string array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -844,16 +1042,26 @@ def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string/foo1.foo2.foo3" + url = '/array/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_string_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -879,22 +1087,31 @@ def build_put_string_valid_request(*, json: JSONType = None, content: Any = None ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/string/foo1.foo2.foo3" + url = '/array/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_enum_valid_request( + **kwargs: Any +) -> HttpRequest: """Get enum array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -916,16 +1133,26 @@ def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/enum/foo1.foo2.foo3" + url = '/array/prim/enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_enum_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -951,22 +1178,31 @@ def build_put_enum_valid_request(*, json: JSONType = None, content: Any = None, ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/enum/foo1.foo2.foo3" + url = '/array/prim/enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_enum_valid_request( + **kwargs: Any +) -> HttpRequest: """Get enum array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -988,16 +1224,26 @@ def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string-enum/foo1.foo2.foo3" + url = '/array/prim/string-enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_string_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_enum_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1023,22 +1269,31 @@ def build_put_string_enum_valid_request(*, json: JSONType = None, content: Any = ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/string-enum/foo1.foo2.foo3" + url = '/array/prim/string-enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: +def build_get_string_with_null_request( + **kwargs: Any +) -> HttpRequest: """Get string array value ['foo', null, 'foo2']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1060,16 +1315,23 @@ def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string/foo.null.foo2" + url = '/array/prim/string/foo.null.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_with_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get string array value ['foo', 123, 'foo2']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1091,16 +1353,23 @@ def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string/foo.123.foo2" + url = '/array/prim/string/foo.123.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_uuid_valid_request( + **kwargs: Any +) -> HttpRequest: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1123,16 +1392,26 @@ def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/uuid/valid" + url = '/array/prim/uuid/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_uuid_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_uuid_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1159,22 +1438,31 @@ def build_put_uuid_valid_request(*, json: JSONType = None, content: Any = None, ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/uuid/valid" + url = '/array/prim/uuid/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_uuid_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_uuid_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1196,16 +1484,23 @@ def build_get_uuid_invalid_chars_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/uuid/invalidchars" + url = '/array/prim/uuid/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_valid_request( + **kwargs: Any +) -> HttpRequest: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1227,16 +1522,26 @@ def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date/valid" + url = '/array/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1262,22 +1567,31 @@ def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/date/valid" + url = '/array/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_date_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get date array value ['2012-01-01', null, '1776-07-04']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1299,16 +1613,23 @@ def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date/invalidnull" + url = '/array/prim/date/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_date_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: """Get date array value ['2011-03-22', 'date']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1330,16 +1651,23 @@ def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date/invalidchars" + url = '/array/prim/date/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1362,16 +1690,26 @@ def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time/valid" + url = '/array/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1398,22 +1736,31 @@ def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = N ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/date-time/valid" + url = '/array/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get date array value ['2000-12-01t00:00:01z', null]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1435,16 +1782,23 @@ def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time/invalidnull" + url = '/array/prim/date-time/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1466,16 +1820,23 @@ def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time/invalidchars" + url = '/array/prim/date-time/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_rfc1123_valid_request( + **kwargs: Any +) -> HttpRequest: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1498,17 +1859,25 @@ def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time-rfc1123/valid" + url = '/array/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_put_date_time_rfc1123_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1536,22 +1905,31 @@ def build_put_date_time_rfc1123_valid_request( ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/date-time-rfc1123/valid" + url = '/array/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_duration_valid_request( + **kwargs: Any +) -> HttpRequest: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1573,16 +1951,26 @@ def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/duration/valid" + url = '/array/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_duration_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_duration_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1608,22 +1996,31 @@ def build_put_duration_valid_request(*, json: JSONType = None, content: Any = No ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/duration/valid" + url = '/array/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_byte_valid_request( + **kwargs: Any +) -> HttpRequest: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -1646,16 +2043,26 @@ def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/byte/valid" + url = '/array/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_byte_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -1682,22 +2089,31 @@ def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/byte/valid" + url = '/array/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_byte_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1719,16 +2135,23 @@ def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/byte/invalidnull" + url = '/array/prim/byte/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: +def build_get_base64_url_request( + **kwargs: Any +) -> HttpRequest: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -1751,16 +2174,23 @@ def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/base64url/valid" + url = '/array/prim/base64url/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_null_request( + **kwargs: Any +) -> HttpRequest: """Get array of complex type null value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1785,16 +2215,23 @@ def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/null" + url = '/array/complex/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_empty_request( + **kwargs: Any +) -> HttpRequest: """Get empty array of complex type []. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1819,16 +2256,23 @@ def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/empty" + url = '/array/complex/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_item_null_request( + **kwargs: Any +) -> HttpRequest: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -1854,16 +2298,23 @@ def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/itemnull" + url = '/array/complex/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_item_empty_request( + **kwargs: Any +) -> HttpRequest: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -1889,16 +2340,23 @@ def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/itemempty" + url = '/array/complex/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_valid_request( + **kwargs: Any +) -> HttpRequest: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -1924,16 +2382,26 @@ def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/valid" + url = '/array/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_complex_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complex_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -1963,22 +2431,31 @@ def build_put_complex_valid_request(*, json: JSONType = None, content: Any = Non ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/complex/valid" + url = '/array/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_array_null_request(**kwargs: Any) -> HttpRequest: +def build_get_array_null_request( + **kwargs: Any +) -> HttpRequest: """Get a null array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2002,16 +2479,23 @@ def build_get_array_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/null" + url = '/array/array/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_array_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an empty array []. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2035,16 +2519,23 @@ def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/empty" + url = '/array/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_array_item_null_request( + **kwargs: Any +) -> HttpRequest: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2068,16 +2559,23 @@ def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/itemnull" + url = '/array/array/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_array_item_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2101,16 +2599,23 @@ def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/itemempty" + url = '/array/array/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_array_valid_request( + **kwargs: Any +) -> HttpRequest: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2134,16 +2639,26 @@ def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/valid" + url = '/array/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2171,22 +2686,31 @@ def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/array/valid" + url = '/array/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_null_request( + **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries with value null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2210,16 +2734,23 @@ def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/null" + url = '/array/dictionary/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries of type with value []. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2243,16 +2774,23 @@ def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/empty" + url = '/array/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_item_null_request( + **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2277,16 +2815,23 @@ def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/itemnull" + url = '/array/dictionary/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_item_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2311,16 +2856,23 @@ def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/itemempty" + url = '/array/dictionary/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_valid_request( + **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2345,16 +2897,26 @@ def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/valid" + url = '/array/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_dictionary_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2383,16 +2945,24 @@ def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/dictionary/valid" + url = '/array/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/setup.py index 877b4dde4a8..f570de0377a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/__init__.py index 04867b878c9..7d6d9918496 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["BinaryWithContentTypeApplicationJson"] +__all__ = ['BinaryWithContentTypeApplicationJson'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py index 75e5c18bd36..4b3782379e1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_binarywithcontent_typeapplicationjson.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BinaryWithContentTypeApplicationJson: """Sample for file with json and binary content type. @@ -27,8 +26,13 @@ class BinaryWithContentTypeApplicationJson: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = BinaryWithContentTypeApplicationJsonConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_configuration.py index 4e167c6b166..d8fce611b6a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): +class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BinaryWithContentTypeApplicationJson. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BinaryWithContentTypeApplicationJsonConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "binarywithcontenttypeapplicationjson/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'binarywithcontenttypeapplicationjson/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/__init__.py index a1aa9464094..a5fff7df533 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._binarywithcontent_typeapplicationjson import BinaryWithContentTypeApplicationJson - -__all__ = ["BinaryWithContentTypeApplicationJson"] +__all__ = ['BinaryWithContentTypeApplicationJson'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py index 4ad729a50e2..42373464834 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_binarywithcontent_typeapplicationjson.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BinaryWithContentTypeApplicationJson: """Sample for file with json and binary content type. @@ -27,7 +26,12 @@ class BinaryWithContentTypeApplicationJson: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = BinaryWithContentTypeApplicationJsonConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodybinarylowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_configuration.py index 88da831735e..de97b10fb47 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): +class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BinaryWithContentTypeApplicationJson. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BinaryWithContentTypeApplicationJsonConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "binarywithcontenttypeapplicationjson/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'binarywithcontenttypeapplicationjson/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py index 7ce9e704698..873c8793348 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_binary_request # type: ignore __all__ = [ - "build_file_request", - "build_binary_request", + 'build_file_request', + 'build_binary_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py index d83f4b96f54..2932c1ea953 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -101,3 +100,4 @@ def build_binary_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py index d78c0e9bec8..18fb81f1d39 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py @@ -5,19 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_file_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_file_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Uploading json file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -41,20 +45,31 @@ def build_file_request(*, json: JSONType = None, content: Any = None, **kwargs: json = b'bytes' # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/binary/file" + url = '/binary/file' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_binary_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Uploading binary file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -69,14 +84,21 @@ def build_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/binary/octet" + url = '/binary/octet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/setup.py index 772307d83f9..4a12c367eb1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Sample for file with json and binary content type. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/__init__.py index b7f0064df51..f7824a9f9db 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestBoolTestService"] +__all__ = ['AutoRestBoolTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_auto_rest_bool_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_auto_rest_bool_test_service.py index df12c411e30..89b6367cefa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_auto_rest_bool_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_auto_rest_bool_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestBoolTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestBoolTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestBoolTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_configuration.py index 29a044c6d32..a6d2545b010 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestBoolTestServiceConfiguration(Configuration): +class AutoRestBoolTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestBoolTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestBoolTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestbooltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestbooltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/__init__.py index 00f063d07bf..6807a1e64da 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_bool_test_service import AutoRestBoolTestService - -__all__ = ["AutoRestBoolTestService"] +__all__ = ['AutoRestBoolTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_auto_rest_bool_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_auto_rest_bool_test_service.py index e7da3cffc64..0f746af4513 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_auto_rest_bool_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_auto_rest_bool_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestBoolTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestBoolTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestBoolTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodybooleanlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_configuration.py index 759e32fbf2e..8016efed0d0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestBoolTestServiceConfiguration(Configuration): +class AutoRestBoolTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestBoolTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestBoolTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestbooltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestbooltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py index a4fff07ee74..a17de1bce68 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py @@ -22,10 +22,10 @@ from ._request_builders import build_get_invalid_request # type: ignore __all__ = [ - "build_get_true_request", - "build_put_true_request", - "build_get_false_request", - "build_put_false_request", - "build_get_null_request", - "build_get_invalid_request", + 'build_get_true_request', + 'build_put_true_request', + 'build_get_false_request', + 'build_put_false_request', + 'build_get_null_request', + 'build_get_invalid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py index e2977164192..aa35eb44722 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -224,3 +223,4 @@ def build_get_invalid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py index dacb9503f08..507524aef22 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_true_request(**kwargs: Any) -> HttpRequest: +def build_get_true_request( + **kwargs: Any +) -> HttpRequest: """Get true Boolean value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,23 @@ def build_get_true_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/true" + url = '/bool/true' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_true_request(**kwargs: Any) -> HttpRequest: +def build_put_true_request( + **kwargs: Any +) -> HttpRequest: """Set Boolean value true. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,23 +63,31 @@ def build_put_true_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", True) # type: bool + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', True) # type: bool accept = "application/json" # Construct URL - url = "/bool/true" + url = '/bool/true' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_false_request(**kwargs: Any) -> HttpRequest: +def build_get_false_request( + **kwargs: Any +) -> HttpRequest: """Get false Boolean value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -85,16 +101,23 @@ def build_get_false_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/false" + url = '/bool/false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_false_request(**kwargs: Any) -> HttpRequest: +def build_put_false_request( + **kwargs: Any +) -> HttpRequest: """Set Boolean value false. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -109,23 +132,31 @@ def build_put_false_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", False) # type: bool + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', False) # type: bool accept = "application/json" # Construct URL - url = "/bool/false" + url = '/bool/false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null Boolean value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -139,16 +170,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/null" + url = '/bool/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get invalid Boolean value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -162,10 +200,16 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/invalid" + url = '/bool/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/setup.py index 374eaef7983..ebc098fd1cc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/__init__.py index c8aff8de0a0..910d784dc9b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATByteService"] +__all__ = ['AutoRestSwaggerBATByteService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_auto_rest_swagger_bat_byte_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_auto_rest_swagger_bat_byte_service.py index f952d01421e..f1d21e2649f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_auto_rest_swagger_bat_byte_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_auto_rest_swagger_bat_byte_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATByteService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATByteService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATByteServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_configuration.py index 8effad8b28f..2651a976ad8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATByteServiceConfiguration(Configuration): +class AutoRestSwaggerBATByteServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATByteService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATByteServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatbyteservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatbyteservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/__init__.py index 6ee1bab4379..073b055af7f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_byte_service import AutoRestSwaggerBATByteService - -__all__ = ["AutoRestSwaggerBATByteService"] +__all__ = ['AutoRestSwaggerBATByteService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_auto_rest_swagger_bat_byte_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_auto_rest_swagger_bat_byte_service.py index 3b89336f3e5..74743f36d01 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_auto_rest_swagger_bat_byte_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_auto_rest_swagger_bat_byte_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATByteService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATByteService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATByteServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodybytelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_configuration.py index 9262696cc4f..b1345d6f694 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATByteServiceConfiguration(Configuration): +class AutoRestSwaggerBATByteServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATByteService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATByteServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatbyteservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatbyteservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py index 9fdaa4a2115..e67a7ce1b9e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py @@ -20,9 +20,9 @@ from ._request_builders import build_get_invalid_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_empty_request", - "build_get_non_ascii_request", - "build_put_non_ascii_request", - "build_get_invalid_request", + 'build_get_null_request', + 'build_get_empty_request', + 'build_get_non_ascii_request', + 'build_put_non_ascii_request', + 'build_get_invalid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py index bae12185110..ae7a14f2ffa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -193,3 +192,4 @@ def build_get_invalid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py index da9e9f2dbf8..7d859981e2d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null byte value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/null" + url = '/byte/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get empty byte value ''. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -54,16 +62,23 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/empty" + url = '/byte/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_non_ascii_request(**kwargs: Any) -> HttpRequest: +def build_get_non_ascii_request( + **kwargs: Any +) -> HttpRequest: """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -77,16 +92,26 @@ def build_get_non_ascii_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/nonAscii" + url = '/byte/nonAscii' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_non_ascii_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_non_ascii_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -112,22 +137,31 @@ def build_put_non_ascii_request(*, json: JSONType = None, content: Any = None, * json = bytearray("bytearray", encoding="utf-8") # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/byte/nonAscii" + url = '/byte/nonAscii' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get invalid byte value ':::SWAGGER::::'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -141,10 +175,16 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/invalid" + url = '/byte/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/setup.py index 158f73d896a..84a5162110e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/__init__.py index fd3f96ec0e5..f0dfc13a72f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_auto_rest_complex_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_auto_rest_complex_test_service.py index ce37d6d8730..1e9eb4d658e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_auto_rest_complex_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_auto_rest_complex_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestComplexTestService: """Test Infrastructure for AutoRest. @@ -30,14 +29,20 @@ class AutoRestComplexTestService: :paramtype api_version: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_configuration.py index b8ad9ec301b..7ce1124a731 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_configuration.py @@ -14,34 +14,40 @@ from ._version import VERSION -class AutoRestComplexTestServiceConfiguration(Configuration): +class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestComplexTestService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestcomplextestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestcomplextestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/__init__.py index 4c5493d4555..a5cab1e6f99 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_complex_test_service import AutoRestComplexTestService - -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_auto_rest_complex_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_auto_rest_complex_test_service.py index 2a97e885343..0e0f8c46e30 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_auto_rest_complex_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_auto_rest_complex_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestComplexTestService: """Test Infrastructure for AutoRest. @@ -30,14 +29,24 @@ class AutoRestComplexTestService: :paramtype api_version: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodycomplexlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_configuration.py index 3a0eb727003..e968e56c41a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/aio/_configuration.py @@ -14,31 +14,39 @@ from .._version import VERSION -class AutoRestComplexTestServiceConfiguration(Configuration): +class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestComplexTestService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "2016-02-29". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestcomplextestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestcomplextestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py index 11147632432..954c72b764d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py @@ -20,9 +20,9 @@ from ._request_builders import build_get_not_provided_request # type: ignore __all__ = [ - "build_get_valid_request", - "build_put_valid_request", - "build_get_empty_request", - "build_put_empty_request", - "build_get_not_provided_request", + 'build_get_valid_request', + 'build_put_valid_request', + 'build_get_empty_request', + 'build_put_empty_request', + 'build_get_not_provided_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py index 64a47dbaecd..10af7e1b2ae 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -246,3 +245,4 @@ def build_get_not_provided_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py index 356504ea41d..4ad55565b03 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with array property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -40,16 +41,26 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/valid" + url = '/complex/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with array property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -79,22 +90,31 @@ def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/array/valid" + url = '/complex/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_empty_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with array property which is empty. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -118,16 +138,26 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/empty" + url = '/complex/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with array property which is empty. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -155,22 +185,31 @@ def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/array/empty" + url = '/complex/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with array property while server doesn't provide a response payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -194,10 +233,16 @@ def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/notprovided" + url = '/complex/array/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py index 2ea66984c02..34b6276dda2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py @@ -22,10 +22,10 @@ from ._request_builders import build_get_not_provided_request # type: ignore __all__ = [ - "build_get_valid_request", - "build_put_valid_request", - "build_get_invalid_request", - "build_get_empty_request", - "build_get_null_request", - "build_get_not_provided_request", + 'build_get_valid_request', + 'build_put_valid_request', + 'build_get_invalid_request', + 'build_get_empty_request', + 'build_get_null_request', + 'build_get_not_provided_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py index 5b15facc270..36d8f2a5572 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -40,9 +39,11 @@ def build_get_valid_request( # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ @@ -87,9 +88,11 @@ def build_put_valid_request( # JSON input template you can fill out and use as your body input. json = { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ @@ -138,9 +141,11 @@ def build_get_invalid_request( # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ @@ -179,9 +184,11 @@ def build_get_empty_request( # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ @@ -220,9 +227,11 @@ def build_get_null_request( # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ @@ -261,9 +270,11 @@ def build_get_not_provided_request( # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ @@ -281,3 +292,4 @@ def build_get_not_provided_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py index 92d925a69b1..7fa777c6c86 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,24 +33,36 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ accept = "application/json" # Construct URL - url = "/complex/basic/valid" + url = '/complex/basic/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Please put {id: 2, name: 'abc', color: 'Magenta'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -71,35 +84,45 @@ def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwa # JSON input template you can fill out and use as your body input. json = { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/basic/valid" + url = '/complex/basic/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get a basic complex type that is invalid for the local strong type. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -115,24 +138,33 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ accept = "application/json" # Construct URL - url = "/complex/basic/invalid" + url = '/complex/basic/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get a basic complex type that is empty. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -148,24 +180,33 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ accept = "application/json" # Construct URL - url = "/complex/basic/empty" + url = '/complex/basic/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get a basic complex type whose properties are null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -181,24 +222,33 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ accept = "application/json" # Construct URL - url = "/complex/basic/null" + url = '/complex/basic/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: """Get a basic complex type while the server doesn't provide a response payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -214,18 +264,26 @@ def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "color": "str", # Optional. Possible values include: "cyan", "Magenta", "YELLOW", "blacK". + "color": "str", # Optional. Possible values include: "cyan", "Magenta", + "YELLOW", "blacK". "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that does not fit on a single line and a line break. + "name": "str" # Optional. Name property with a very long description that + does not fit on a single line and a line break. } """ accept = "application/json" # Construct URL - url = "/complex/basic/notprovided" + url = '/complex/basic/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py index 9d06b6a145a..c616ebfd5a2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py @@ -22,10 +22,10 @@ from ._request_builders import build_get_not_provided_request # type: ignore __all__ = [ - "build_get_valid_request", - "build_put_valid_request", - "build_get_empty_request", - "build_put_empty_request", - "build_get_null_request", - "build_get_not_provided_request", + 'build_get_valid_request', + 'build_put_valid_request', + 'build_get_empty_request', + 'build_put_empty_request', + 'build_get_null_request', + 'build_get_not_provided_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py index f2ccd0482fb..90686d4e015 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -287,3 +286,4 @@ def build_get_not_provided_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py index a30ee93c17c..126afb3b63f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with dictionary property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -40,16 +41,26 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/valid" + url = '/complex/dictionary/typed/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with dictionary property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -79,22 +90,31 @@ def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/valid" + url = '/complex/dictionary/typed/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_empty_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with dictionary property which is empty. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -118,16 +138,26 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/empty" + url = '/complex/dictionary/typed/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with dictionary property which is empty. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -155,22 +185,31 @@ def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/empty" + url = '/complex/dictionary/typed/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_null_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with dictionary property which is null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -194,16 +233,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/null" + url = '/complex/dictionary/typed/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with dictionary property while server doesn't provide a response payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -227,10 +273,16 @@ def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/notprovided" + url = '/complex/dictionary/typed/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py index 37b2d0a112d..c0bc9c2aa4b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_valid_request # type: ignore __all__ = [ - "build_get_valid_request", + 'build_get_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py index b96d855dbaa..8717b5f2700 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py @@ -59,3 +59,4 @@ def build_get_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py index 9df858aff94..1a157c97168 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py @@ -13,7 +13,9 @@ _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """get_valid. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -39,10 +41,16 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/flatten/valid" + url = '/complex/flatten/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py index 83d94e4e60b..17028d4e2e6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_put_valid_request # type: ignore __all__ = [ - "build_get_valid_request", - "build_put_valid_request", + 'build_get_valid_request', + 'build_put_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py index ce3a0a03463..6595860df44 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -131,3 +130,4 @@ def build_put_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py index 4359de8f650..97aae9a72f3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """Get complex types that extend others. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -48,16 +49,26 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/inheritance/valid" + url = '/complex/inheritance/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types that extend others. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -97,16 +108,24 @@ def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/inheritance/valid" + url = '/complex/inheritance/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py index 83d94e4e60b..17028d4e2e6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_put_valid_request # type: ignore __all__ = [ - "build_get_valid_request", - "build_put_valid_request", + 'build_get_valid_request', + 'build_put_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py index 229ef0e9bfd..6b1cab56740 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -40,7 +39,7 @@ def build_get_valid_request( # response body for status code(s): 200 response.json() == { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -196,7 +195,7 @@ def build_put_valid_request( # JSON input template you can fill out and use as your body input. json = { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -223,3 +222,4 @@ def build_put_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py index 2f82f035d1f..44564f014a4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """Get complex types that are polymorphic and have recursive references. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -43,16 +44,26 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphicrecursive/valid" + url = '/complex/polymorphicrecursive/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic and have recursive references. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -189,16 +200,24 @@ def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphicrecursive/valid" + url = '/complex/polymorphicrecursive/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py index 3ea2d60203f..585ba444b71 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py @@ -28,13 +28,13 @@ from ._request_builders import build_put_valid_missing_required_request # type: ignore __all__ = [ - "build_get_valid_request", - "build_put_valid_request", - "build_get_dot_syntax_request", - "build_get_composed_with_discriminator_request", - "build_get_composed_without_discriminator_request", - "build_get_complicated_request", - "build_put_complicated_request", - "build_put_missing_discriminator_request", - "build_put_valid_missing_required_request", + 'build_get_valid_request', + 'build_put_valid_request', + 'build_get_dot_syntax_request', + 'build_get_composed_with_discriminator_request', + 'build_get_composed_without_discriminator_request', + 'build_get_complicated_request', + 'build_put_complicated_request', + 'build_put_missing_discriminator_request', + 'build_put_valid_missing_required_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py index 92168701a71..60d78dd53b9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -40,7 +39,7 @@ def build_get_valid_request( # response body for status code(s): 200 response.json() == { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -156,7 +155,7 @@ def build_put_valid_request( # JSON input template you can fill out and use as your body input. json = { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -374,11 +373,11 @@ def build_get_complicated_request( # response body for status code(s): 200 response.json() == { "iswild": bool, # Optional. - "length": 0.0, # Required. + "length": 0.0, # Required. "location": "str", # Optional. "siblings": [ { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -436,11 +435,11 @@ def build_put_complicated_request( # JSON input template you can fill out and use as your body input. json = { "iswild": bool, # Optional. - "length": 0.0, # Required. + "length": 0.0, # Required. "location": "str", # Optional. "siblings": [ { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -501,11 +500,11 @@ def build_put_missing_discriminator_request( # JSON input template you can fill out and use as your body input. json = { "iswild": bool, # Optional. - "length": 0.0, # Required. + "length": 0.0, # Required. "location": "str", # Optional. "siblings": [ { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -520,11 +519,11 @@ def build_put_missing_discriminator_request( # response body for status code(s): 200 response.json() == { "iswild": bool, # Optional. - "length": 0.0, # Required. + "length": 0.0, # Required. "location": "str", # Optional. "siblings": [ { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -637,7 +636,7 @@ def build_put_valid_missing_required_request( # JSON input template you can fill out and use as your body input. json = { - "length": 0.0, # Required. + "length": 0.0, # Required. "siblings": [ ... ], @@ -664,3 +663,4 @@ def build_put_valid_missing_required_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py index a6a553f8657..6ce0ec4df3a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """Get complex types that are polymorphic. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -43,16 +44,26 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/valid" + url = '/complex/polymorphism/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -149,22 +160,31 @@ def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/valid" + url = '/complex/polymorphism/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_dot_syntax_request(**kwargs: Any) -> HttpRequest: +def build_get_dot_syntax_request( + **kwargs: Any +) -> HttpRequest: """Get complex types that are polymorphic, JSON key contains a dot. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -187,16 +207,23 @@ def build_get_dot_syntax_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/dotsyntax" + url = '/complex/polymorphism/dotsyntax' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_composed_with_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_get_composed_with_discriminator_request( + **kwargs: Any +) -> HttpRequest: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -243,16 +270,23 @@ def build_get_composed_with_discriminator_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/composedWithDiscriminator" + url = '/complex/polymorphism/composedWithDiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_composed_without_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_get_composed_without_discriminator_request( + **kwargs: Any +) -> HttpRequest: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -299,16 +333,23 @@ def build_get_composed_without_discriminator_request(**kwargs: Any) -> HttpReque accept = "application/json" # Construct URL - url = "/complex/polymorphism/composedWithoutDiscriminator" + url = '/complex/polymorphism/composedWithoutDiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complicated_request(**kwargs: Any) -> HttpRequest: +def build_get_complicated_request( + **kwargs: Any +) -> HttpRequest: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -345,16 +386,26 @@ def build_get_complicated_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/complicated" + url = '/complex/polymorphism/complicated' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_complicated_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complicated_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -397,23 +448,33 @@ def build_put_complicated_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/complicated" + url = '/complex/polymorphism/complicated' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_missing_discriminator_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put complex types that are polymorphic, omitting the discriminator. @@ -475,23 +536,33 @@ def build_put_missing_discriminator_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/missingdiscriminator" + url = '/complex/polymorphism/missingdiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_valid_missing_required_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -578,16 +649,24 @@ def build_put_valid_missing_required_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/missingrequired/invalid" + url = '/complex/polymorphism/missingrequired/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py index 4de6eb2c665..f5363a8a1c5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py @@ -54,26 +54,26 @@ from ._request_builders import build_put_byte_request # type: ignore __all__ = [ - "build_get_int_request", - "build_put_int_request", - "build_get_long_request", - "build_put_long_request", - "build_get_float_request", - "build_put_float_request", - "build_get_double_request", - "build_put_double_request", - "build_get_bool_request", - "build_put_bool_request", - "build_get_string_request", - "build_put_string_request", - "build_get_date_request", - "build_put_date_request", - "build_get_date_time_request", - "build_put_date_time_request", - "build_get_date_time_rfc1123_request", - "build_put_date_time_rfc1123_request", - "build_get_duration_request", - "build_put_duration_request", - "build_get_byte_request", - "build_put_byte_request", + 'build_get_int_request', + 'build_put_int_request', + 'build_get_long_request', + 'build_put_long_request', + 'build_get_float_request', + 'build_put_float_request', + 'build_get_double_request', + 'build_put_double_request', + 'build_get_bool_request', + 'build_put_bool_request', + 'build_get_string_request', + 'build_put_string_request', + 'build_get_date_request', + 'build_put_date_request', + 'build_get_date_time_request', + 'build_put_date_time_request', + 'build_get_date_time_rfc1123_request', + 'build_put_date_time_rfc1123_request', + 'build_get_duration_request', + 'build_put_duration_request', + 'build_get_byte_request', + 'build_put_byte_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py index 7d1ffdfadc4..75aa2a29039 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -311,7 +310,8 @@ def build_get_double_request( # response body for status code(s): 200 response.json() == { "field1": 0.0, # Optional. - "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. + "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": + 0.0 # Optional. } """ @@ -359,7 +359,8 @@ def build_put_double_request( # JSON input template you can fill out and use as your body input. json = { "field1": 0.0, # Optional. - "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. + "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": + 0.0 # Optional. } """ @@ -1015,3 +1016,4 @@ def build_put_byte_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py index 120b56cfbd2..d58b661d407 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_int_request(**kwargs: Any) -> HttpRequest: +def build_get_int_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with integer properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -39,16 +40,26 @@ def build_get_int_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/integer" + url = '/complex/primitive/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_int_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_int_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with integer properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -75,22 +86,31 @@ def build_put_int_request(*, json: JSONType = None, content: Any = None, **kwarg } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/integer" + url = '/complex/primitive/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_long_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_long_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with long properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -113,16 +133,26 @@ def build_get_long_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/long" + url = '/complex/primitive/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_long_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_long_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with long properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -149,22 +179,31 @@ def build_put_long_request(*, json: JSONType = None, content: Any = None, **kwar } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/long" + url = '/complex/primitive/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_float_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_float_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with float properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -187,16 +226,26 @@ def build_get_float_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/float" + url = '/complex/primitive/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with float properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -223,22 +272,31 @@ def build_put_float_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/float" + url = '/complex/primitive/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_double_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_double_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with double properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -255,22 +313,33 @@ def build_get_double_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { "field1": 0.0, # Optional. - "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. + "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": + 0.0 # Optional. } """ accept = "application/json" # Construct URL - url = "/complex/primitive/double" + url = '/complex/primitive/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with double properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -295,26 +364,36 @@ def build_put_double_request(*, json: JSONType = None, content: Any = None, **kw # JSON input template you can fill out and use as your body input. json = { "field1": 0.0, # Optional. - "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": 0.0 # Optional. + "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": + 0.0 # Optional. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/double" + url = '/complex/primitive/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_bool_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_bool_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with bool properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -337,16 +416,26 @@ def build_get_bool_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/bool" + url = '/complex/primitive/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_bool_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_bool_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with bool properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -373,22 +462,31 @@ def build_put_bool_request(*, json: JSONType = None, content: Any = None, **kwar } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/bool" + url = '/complex/primitive/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_string_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_string_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with string properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -412,16 +510,26 @@ def build_get_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/string" + url = '/complex/primitive/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with string properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -449,22 +557,31 @@ def build_put_string_request(*, json: JSONType = None, content: Any = None, **kw } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/string" + url = '/complex/primitive/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_date_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_date_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with date properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -487,16 +604,26 @@ def build_get_date_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/date" + url = '/complex/primitive/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with date properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -523,22 +650,31 @@ def build_put_date_request(*, json: JSONType = None, content: Any = None, **kwar } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/date" + url = '/complex/primitive/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_date_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with datetime properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -561,16 +697,26 @@ def build_get_date_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/datetime" + url = '/complex/primitive/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with datetime properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -599,22 +745,31 @@ def build_put_date_time_request(*, json: JSONType = None, content: Any = None, * } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/datetime" + url = '/complex/primitive/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_date_time_rfc1123_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with datetimeRfc1123 properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -637,16 +792,26 @@ def build_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/datetimerfc1123" + url = '/complex/primitive/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_date_time_rfc1123_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_date_time_rfc1123_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with datetimeRfc1123 properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -675,22 +840,31 @@ def build_put_date_time_rfc1123_request(*, json: JSONType = None, content: Any = } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/datetimerfc1123" + url = '/complex/primitive/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_duration_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_duration_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with duration properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -712,16 +886,26 @@ def build_get_duration_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/duration" + url = '/complex/primitive/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_duration_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with duration properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -747,22 +931,31 @@ def build_put_duration_request(*, json: JSONType = None, content: Any = None, ** } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/duration" + url = '/complex/primitive/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_byte_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_byte_request( + **kwargs: Any +) -> HttpRequest: """Get complex types with byte properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -784,16 +977,26 @@ def build_get_byte_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/byte" + url = '/complex/primitive/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_byte_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_byte_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types with byte properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -821,16 +1024,24 @@ def build_put_byte_request(*, json: JSONType = None, content: Any = None, **kwar } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/byte" + url = '/complex/primitive/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py index 83d94e4e60b..17028d4e2e6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_put_valid_request # type: ignore __all__ = [ - "build_get_valid_request", - "build_put_valid_request", + 'build_get_valid_request', + 'build_put_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py index 4c6e1ffddcf..c954e6aaf93 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -109,3 +108,4 @@ def build_put_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py index 2d8032c65f1..baa8ffdcc87 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py @@ -9,14 +9,15 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_valid_request( + **kwargs: Any +) -> HttpRequest: """Get complex types that have readonly properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -39,16 +40,26 @@ def build_get_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/readonlyproperty/valid" + url = '/complex/readonlyproperty/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put complex types that have readonly properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -75,16 +86,24 @@ def build_put_valid_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/readonlyproperty/valid" + url = '/complex/readonlyproperty/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/setup.py index ea77baa0fb5..ab429f6939d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/__init__.py index c72e12f3ed2..2e45fd5955d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDateTestService"] +__all__ = ['AutoRestDateTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_auto_rest_date_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_auto_rest_date_test_service.py index 58b2b01ea27..59f6e678811 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_auto_rest_date_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_auto_rest_date_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestDateTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDateTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_configuration.py index ae4a2b37a46..deb4b257788 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestDateTestServiceConfiguration(Configuration): +class AutoRestDateTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/__init__.py index a4536c944f2..9a13a3906db 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_date_test_service import AutoRestDateTestService - -__all__ = ["AutoRestDateTestService"] +__all__ = ['AutoRestDateTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_auto_rest_date_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_auto_rest_date_test_service.py index 458049255b1..34994b3a01e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_auto_rest_date_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_auto_rest_date_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestDateTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDateTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodydatelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_configuration.py index 4f71dfb033d..8de96a567e4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDateTestServiceConfiguration(Configuration): +class AutoRestDateTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py index 30de141574a..305fd55dfb8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py @@ -26,12 +26,12 @@ from ._request_builders import build_get_min_date_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_invalid_date_request", - "build_get_overflow_date_request", - "build_get_underflow_date_request", - "build_put_max_date_request", - "build_get_max_date_request", - "build_put_min_date_request", - "build_get_min_date_request", + 'build_get_null_request', + 'build_get_invalid_date_request', + 'build_get_overflow_date_request', + 'build_get_underflow_date_request', + 'build_put_max_date_request', + 'build_get_max_date_request', + 'build_put_min_date_request', + 'build_get_min_date_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py index 07b7a99b764..09792d1556d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -14,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -301,3 +299,4 @@ def build_get_min_date_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py index 2a0dccc2823..efa51d3abdc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null date value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,16 +32,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/null" + url = '/date/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_date_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_date_request( + **kwargs: Any +) -> HttpRequest: """Get invalid date value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,16 +62,23 @@ def build_get_invalid_date_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/invaliddate" + url = '/date/invaliddate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_overflow_date_request(**kwargs: Any) -> HttpRequest: +def build_get_overflow_date_request( + **kwargs: Any +) -> HttpRequest: """Get overflow date value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -78,16 +92,23 @@ def build_get_overflow_date_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/overflowdate" + url = '/date/overflowdate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_underflow_date_request(**kwargs: Any) -> HttpRequest: +def build_get_underflow_date_request( + **kwargs: Any +) -> HttpRequest: """Get underflow date value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -101,16 +122,26 @@ def build_get_underflow_date_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/underflowdate" + url = '/date/underflowdate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_max_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_max_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put max date value 9999-12-31. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -134,22 +165,31 @@ def build_put_max_date_request(*, json: JSONType = None, content: Any = None, ** json = "2020-02-20" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/date/max" + url = '/date/max' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_max_date_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_max_date_request( + **kwargs: Any +) -> HttpRequest: """Get max date value 9999-12-31. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -163,16 +203,26 @@ def build_get_max_date_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/max" + url = '/date/max' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_min_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_min_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put min date value 0000-01-01. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -196,22 +246,31 @@ def build_put_min_date_request(*, json: JSONType = None, content: Any = None, ** json = "2020-02-20" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/date/min" + url = '/date/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_min_date_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_min_date_request( + **kwargs: Any +) -> HttpRequest: """Get min date value 0000-01-01. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -225,10 +284,16 @@ def build_get_min_date_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/min" + url = '/date/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/setup.py index 1b7756a102f..5ac60578073 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/__init__.py index df3337616a6..0fd77564071 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDateTimeTestService"] +__all__ = ['AutoRestDateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_auto_rest_date_time_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_auto_rest_date_time_test_service.py index cd6ce0f538b..21ed78326cd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_auto_rest_date_time_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_auto_rest_date_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTimeTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestDateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_configuration.py index f4cb7c8e6ab..b2649384d8f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestDateTimeTestServiceConfiguration(Configuration): +class AutoRestDateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/__init__.py index 11cb96198a2..216b041a4cb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_date_time_test_service import AutoRestDateTimeTestService - -__all__ = ["AutoRestDateTimeTestService"] +__all__ = ['AutoRestDateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_auto_rest_date_time_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_auto_rest_date_time_test_service.py index 1a0dfa1e0c8..8e8a7e69806 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_auto_rest_date_time_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_auto_rest_date_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTimeTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestDateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDateTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodydatetimelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_configuration.py index fece892264c..fb1109a0d47 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDateTimeTestServiceConfiguration(Configuration): +class AutoRestDateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDateTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py index 3a935a20ab7..e72e7a76e2b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py @@ -54,26 +54,26 @@ from ._request_builders import build_get_local_no_offset_min_date_time_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_invalid_request", - "build_get_overflow_request", - "build_get_underflow_request", - "build_put_utc_max_date_time_request", - "build_put_utc_max_date_time7_digits_request", - "build_get_utc_lowercase_max_date_time_request", - "build_get_utc_uppercase_max_date_time_request", - "build_get_utc_uppercase_max_date_time7_digits_request", - "build_put_local_positive_offset_max_date_time_request", - "build_get_local_positive_offset_lowercase_max_date_time_request", - "build_get_local_positive_offset_uppercase_max_date_time_request", - "build_put_local_negative_offset_max_date_time_request", - "build_get_local_negative_offset_uppercase_max_date_time_request", - "build_get_local_negative_offset_lowercase_max_date_time_request", - "build_put_utc_min_date_time_request", - "build_get_utc_min_date_time_request", - "build_put_local_positive_offset_min_date_time_request", - "build_get_local_positive_offset_min_date_time_request", - "build_put_local_negative_offset_min_date_time_request", - "build_get_local_negative_offset_min_date_time_request", - "build_get_local_no_offset_min_date_time_request", + 'build_get_null_request', + 'build_get_invalid_request', + 'build_get_overflow_request', + 'build_get_underflow_request', + 'build_put_utc_max_date_time_request', + 'build_put_utc_max_date_time7_digits_request', + 'build_get_utc_lowercase_max_date_time_request', + 'build_get_utc_uppercase_max_date_time_request', + 'build_get_utc_uppercase_max_date_time7_digits_request', + 'build_put_local_positive_offset_max_date_time_request', + 'build_get_local_positive_offset_lowercase_max_date_time_request', + 'build_get_local_positive_offset_uppercase_max_date_time_request', + 'build_put_local_negative_offset_max_date_time_request', + 'build_get_local_negative_offset_uppercase_max_date_time_request', + 'build_get_local_negative_offset_lowercase_max_date_time_request', + 'build_put_utc_min_date_time_request', + 'build_get_utc_min_date_time_request', + 'build_put_local_positive_offset_min_date_time_request', + 'build_get_local_positive_offset_min_date_time_request', + 'build_put_local_negative_offset_min_date_time_request', + 'build_get_local_negative_offset_min_date_time_request', + 'build_get_local_no_offset_min_date_time_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py index df8c0fc9092..9355e6f009c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -14,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -821,3 +819,4 @@ def build_get_local_no_offset_min_date_time_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py index 9cc0e9cc74a..2a0bd261379 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,16 +32,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/null" + url = '/datetime/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get invalid datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,16 +62,23 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/invalid" + url = '/datetime/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_overflow_request(**kwargs: Any) -> HttpRequest: +def build_get_overflow_request( + **kwargs: Any +) -> HttpRequest: """Get overflow datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -78,16 +92,23 @@ def build_get_overflow_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/overflow" + url = '/datetime/overflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_underflow_request(**kwargs: Any) -> HttpRequest: +def build_get_underflow_request( + **kwargs: Any +) -> HttpRequest: """Get underflow datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -101,16 +122,26 @@ def build_get_underflow_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/underflow" + url = '/datetime/underflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_utc_max_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_utc_max_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put max datetime value 9999-12-31T23:59:59.999Z. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -134,23 +165,33 @@ def build_put_utc_max_date_time_request(*, json: JSONType = None, content: Any = json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/utc" + url = '/datetime/max/utc' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_utc_max_date_time7_digits_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put max datetime value 9999-12-31T23:59:59.9999999Z. @@ -178,22 +219,31 @@ def build_put_utc_max_date_time7_digits_request( json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/utc7ms" + url = '/datetime/max/utc7ms' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_utc_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value 9999-12-31t23:59:59.999z. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -207,16 +257,23 @@ def build_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/utc/lowercase" + url = '/datetime/max/utc/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_utc_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value 9999-12-31T23:59:59.999Z. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -230,16 +287,23 @@ def build_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/utc/uppercase" + url = '/datetime/max/utc/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_utc_uppercase_max_date_time7_digits_request(**kwargs: Any) -> HttpRequest: +def build_get_utc_uppercase_max_date_time7_digits_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -256,17 +320,25 @@ def build_get_utc_uppercase_max_date_time7_digits_request(**kwargs: Any) -> Http accept = "application/json" # Construct URL - url = "/datetime/max/utc7ms/uppercase" + url = '/datetime/max/utc7ms/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_put_local_positive_offset_max_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. @@ -291,22 +363,31 @@ def build_put_local_positive_offset_max_date_time_request( json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/localpositiveoffset" + url = '/datetime/max/localpositiveoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_local_positive_offset_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_local_positive_offset_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999+14:00. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -320,16 +401,23 @@ def build_get_local_positive_offset_lowercase_max_date_time_request(**kwargs: An accept = "application/json" # Construct URL - url = "/datetime/max/localpositiveoffset/lowercase" + url = '/datetime/max/localpositiveoffset/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_local_positive_offset_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_local_positive_offset_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999+14:00. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -343,17 +431,25 @@ def build_get_local_positive_offset_uppercase_max_date_time_request(**kwargs: An accept = "application/json" # Construct URL - url = "/datetime/max/localpositiveoffset/uppercase" + url = '/datetime/max/localpositiveoffset/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_put_local_negative_offset_max_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. @@ -378,22 +474,31 @@ def build_put_local_negative_offset_max_date_time_request( json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/localnegativeoffset" + url = '/datetime/max/localnegativeoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_local_negative_offset_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_local_negative_offset_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999-14:00. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -407,16 +512,23 @@ def build_get_local_negative_offset_uppercase_max_date_time_request(**kwargs: An accept = "application/json" # Construct URL - url = "/datetime/max/localnegativeoffset/uppercase" + url = '/datetime/max/localnegativeoffset/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_local_negative_offset_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_local_negative_offset_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999-14:00. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -430,16 +542,26 @@ def build_get_local_negative_offset_lowercase_max_date_time_request(**kwargs: An accept = "application/json" # Construct URL - url = "/datetime/max/localnegativeoffset/lowercase" + url = '/datetime/max/localnegativeoffset/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_utc_min_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_utc_min_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00Z. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -463,22 +585,31 @@ def build_put_utc_min_date_time_request(*, json: JSONType = None, content: Any = json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/min/utc" + url = '/datetime/min/utc' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_utc_min_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00Z. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -492,17 +623,25 @@ def build_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/min/utc" + url = '/datetime/min/utc' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_put_local_positive_offset_min_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00+14:00. @@ -527,22 +666,31 @@ def build_put_local_positive_offset_min_date_time_request( json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/min/localpositiveoffset" + url = '/datetime/min/localpositiveoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_local_positive_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_local_positive_offset_min_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00+14:00. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -556,17 +704,25 @@ def build_get_local_positive_offset_min_date_time_request(**kwargs: Any) -> Http accept = "application/json" # Construct URL - url = "/datetime/min/localpositiveoffset" + url = '/datetime/min/localpositiveoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_put_local_negative_offset_min_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00-14:00. @@ -591,22 +747,31 @@ def build_put_local_negative_offset_min_date_time_request( json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/min/localnegativeoffset" + url = '/datetime/min/localnegativeoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_local_negative_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_local_negative_offset_min_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00-14:00. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -620,16 +785,23 @@ def build_get_local_negative_offset_min_date_time_request(**kwargs: Any) -> Http accept = "application/json" # Construct URL - url = "/datetime/min/localnegativeoffset" + url = '/datetime/min/localnegativeoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_local_no_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_local_no_offset_min_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -643,10 +815,16 @@ def build_get_local_no_offset_min_date_time_request(**kwargs: Any) -> HttpReques accept = "application/json" # Construct URL - url = "/datetime/min/localnooffset" + url = '/datetime/min/localnooffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/setup.py index e3def2be286..5b3c0852cfa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/__init__.py index baf26fe7155..b1b218fa611 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestRFC1123DateTimeTestService"] +__all__ = ['AutoRestRFC1123DateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_auto_rest_rfc1123_date_time_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_auto_rest_rfc1123_date_time_test_service.py index e373bf295c2..6df415656a7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_auto_rest_rfc1123_date_time_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_auto_rest_rfc1123_date_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRFC1123DateTimeTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestRFC1123DateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestRFC1123DateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_configuration.py index 30257aefa92..fb56b6bf520 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): +class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRFC1123DateTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestRFC1123DateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestrfc1123datetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrfc1123datetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/__init__.py index 7cdf4bb0601..4a49b2bc883 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_rfc1123_date_time_test_service import AutoRestRFC1123DateTimeTestService - -__all__ = ["AutoRestRFC1123DateTimeTestService"] +__all__ = ['AutoRestRFC1123DateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_auto_rest_rfc1123_date_time_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_auto_rest_rfc1123_date_time_test_service.py index 5aa42dd8cc1..67a573880f5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_auto_rest_rfc1123_date_time_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_auto_rest_rfc1123_date_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRFC1123DateTimeTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestRFC1123DateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestRFC1123DateTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodydatetimerfc1123lowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_configuration.py index a5f8aa98c35..40ad35ac665 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): +class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRFC1123DateTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestRFC1123DateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestrfc1123datetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrfc1123datetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py index 63f5895326f..18e7a95faa2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py @@ -28,13 +28,13 @@ from ._request_builders import build_get_utc_min_date_time_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_invalid_request", - "build_get_overflow_request", - "build_get_underflow_request", - "build_put_utc_max_date_time_request", - "build_get_utc_lowercase_max_date_time_request", - "build_get_utc_uppercase_max_date_time_request", - "build_put_utc_min_date_time_request", - "build_get_utc_min_date_time_request", + 'build_get_null_request', + 'build_get_invalid_request', + 'build_get_overflow_request', + 'build_get_underflow_request', + 'build_put_utc_max_date_time_request', + 'build_get_utc_lowercase_max_date_time_request', + 'build_get_utc_uppercase_max_date_time_request', + 'build_put_utc_min_date_time_request', + 'build_get_utc_min_date_time_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py index 8cbb8fbf046..f526530b17c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -14,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -332,3 +330,4 @@ def build_get_utc_min_date_time_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py index 7ca538db685..342b46bd88a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,16 +32,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/null" + url = '/datetimerfc1123/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get invalid datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,16 +62,23 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/invalid" + url = '/datetimerfc1123/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_overflow_request(**kwargs: Any) -> HttpRequest: +def build_get_overflow_request( + **kwargs: Any +) -> HttpRequest: """Get overflow datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -78,16 +92,23 @@ def build_get_overflow_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/overflow" + url = '/datetimerfc1123/overflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_underflow_request(**kwargs: Any) -> HttpRequest: +def build_get_underflow_request( + **kwargs: Any +) -> HttpRequest: """Get underflow datetime value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -101,16 +122,26 @@ def build_get_underflow_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/underflow" + url = '/datetimerfc1123/underflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_utc_max_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_utc_max_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -134,22 +165,31 @@ def build_put_utc_max_date_time_request(*, json: JSONType = None, content: Any = json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetimerfc1123/max" + url = '/datetimerfc1123/max' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_utc_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value fri, 31 dec 9999 23:59:59 gmt. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -163,16 +203,23 @@ def build_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/max/lowercase" + url = '/datetimerfc1123/max/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_get_utc_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -186,16 +233,26 @@ def build_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/max/uppercase" + url = '/datetimerfc1123/max/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_utc_min_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_utc_min_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -219,22 +276,31 @@ def build_put_utc_min_date_time_request(*, json: JSONType = None, content: Any = json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetimerfc1123/min" + url = '/datetimerfc1123/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_utc_min_date_time_request( + **kwargs: Any +) -> HttpRequest: """Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -248,10 +314,16 @@ def build_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/min" + url = '/datetimerfc1123/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/setup.py index 8c0de0f8c73..d9e2ec06e9c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/__init__.py index b6681846f67..7cfdf1acafa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATDictionaryService"] +__all__ = ['AutoRestSwaggerBATDictionaryService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_auto_rest_swagger_ba_tdictionary_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_auto_rest_swagger_ba_tdictionary_service.py index 3b67de22ccd..88538f757e4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_auto_rest_swagger_ba_tdictionary_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_auto_rest_swagger_ba_tdictionary_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATDictionaryService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATDictionaryService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATDictionaryServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_configuration.py index 2969ee5a4ea..e6a19dec6f6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): +class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATDictionaryService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATDictionaryServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatdictionaryservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatdictionaryservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/__init__.py index ed2c0ce5f1a..b6ad0df5d3f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_ba_tdictionary_service import AutoRestSwaggerBATDictionaryService - -__all__ = ["AutoRestSwaggerBATDictionaryService"] +__all__ = ['AutoRestSwaggerBATDictionaryService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_auto_rest_swagger_ba_tdictionary_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_auto_rest_swagger_ba_tdictionary_service.py index 691552ec31e..6b45a5a5a4e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_auto_rest_swagger_ba_tdictionary_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_auto_rest_swagger_ba_tdictionary_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATDictionaryService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATDictionaryService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATDictionaryServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodydictionarylowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_configuration.py index 01218333453..4fc9e0fc602 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): +class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATDictionaryService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATDictionaryServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatdictionaryservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatdictionaryservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py index dbf5f8a21dd..db42ac2a9d0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py @@ -140,69 +140,69 @@ from ._request_builders import build_put_dictionary_valid_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_empty_request", - "build_put_empty_request", - "build_get_null_value_request", - "build_get_null_key_request", - "build_get_empty_string_key_request", - "build_get_invalid_request", - "build_get_boolean_tfft_request", - "build_put_boolean_tfft_request", - "build_get_boolean_invalid_null_request", - "build_get_boolean_invalid_string_request", - "build_get_integer_valid_request", - "build_put_integer_valid_request", - "build_get_int_invalid_null_request", - "build_get_int_invalid_string_request", - "build_get_long_valid_request", - "build_put_long_valid_request", - "build_get_long_invalid_null_request", - "build_get_long_invalid_string_request", - "build_get_float_valid_request", - "build_put_float_valid_request", - "build_get_float_invalid_null_request", - "build_get_float_invalid_string_request", - "build_get_double_valid_request", - "build_put_double_valid_request", - "build_get_double_invalid_null_request", - "build_get_double_invalid_string_request", - "build_get_string_valid_request", - "build_put_string_valid_request", - "build_get_string_with_null_request", - "build_get_string_with_invalid_request", - "build_get_date_valid_request", - "build_put_date_valid_request", - "build_get_date_invalid_null_request", - "build_get_date_invalid_chars_request", - "build_get_date_time_valid_request", - "build_put_date_time_valid_request", - "build_get_date_time_invalid_null_request", - "build_get_date_time_invalid_chars_request", - "build_get_date_time_rfc1123_valid_request", - "build_put_date_time_rfc1123_valid_request", - "build_get_duration_valid_request", - "build_put_duration_valid_request", - "build_get_byte_valid_request", - "build_put_byte_valid_request", - "build_get_byte_invalid_null_request", - "build_get_base64_url_request", - "build_get_complex_null_request", - "build_get_complex_empty_request", - "build_get_complex_item_null_request", - "build_get_complex_item_empty_request", - "build_get_complex_valid_request", - "build_put_complex_valid_request", - "build_get_array_null_request", - "build_get_array_empty_request", - "build_get_array_item_null_request", - "build_get_array_item_empty_request", - "build_get_array_valid_request", - "build_put_array_valid_request", - "build_get_dictionary_null_request", - "build_get_dictionary_empty_request", - "build_get_dictionary_item_null_request", - "build_get_dictionary_item_empty_request", - "build_get_dictionary_valid_request", - "build_put_dictionary_valid_request", + 'build_get_null_request', + 'build_get_empty_request', + 'build_put_empty_request', + 'build_get_null_value_request', + 'build_get_null_key_request', + 'build_get_empty_string_key_request', + 'build_get_invalid_request', + 'build_get_boolean_tfft_request', + 'build_put_boolean_tfft_request', + 'build_get_boolean_invalid_null_request', + 'build_get_boolean_invalid_string_request', + 'build_get_integer_valid_request', + 'build_put_integer_valid_request', + 'build_get_int_invalid_null_request', + 'build_get_int_invalid_string_request', + 'build_get_long_valid_request', + 'build_put_long_valid_request', + 'build_get_long_invalid_null_request', + 'build_get_long_invalid_string_request', + 'build_get_float_valid_request', + 'build_put_float_valid_request', + 'build_get_float_invalid_null_request', + 'build_get_float_invalid_string_request', + 'build_get_double_valid_request', + 'build_put_double_valid_request', + 'build_get_double_invalid_null_request', + 'build_get_double_invalid_string_request', + 'build_get_string_valid_request', + 'build_put_string_valid_request', + 'build_get_string_with_null_request', + 'build_get_string_with_invalid_request', + 'build_get_date_valid_request', + 'build_put_date_valid_request', + 'build_get_date_invalid_null_request', + 'build_get_date_invalid_chars_request', + 'build_get_date_time_valid_request', + 'build_put_date_time_valid_request', + 'build_get_date_time_invalid_null_request', + 'build_get_date_time_invalid_chars_request', + 'build_get_date_time_rfc1123_valid_request', + 'build_put_date_time_rfc1123_valid_request', + 'build_get_duration_valid_request', + 'build_put_duration_valid_request', + 'build_get_byte_valid_request', + 'build_put_byte_valid_request', + 'build_get_byte_invalid_null_request', + 'build_get_base64_url_request', + 'build_get_complex_null_request', + 'build_get_complex_empty_request', + 'build_get_complex_item_null_request', + 'build_get_complex_item_empty_request', + 'build_get_complex_valid_request', + 'build_put_complex_valid_request', + 'build_get_array_null_request', + 'build_get_array_empty_request', + 'build_get_array_item_null_request', + 'build_get_array_item_empty_request', + 'build_get_array_valid_request', + 'build_put_array_valid_request', + 'build_get_dictionary_null_request', + 'build_get_dictionary_empty_request', + 'build_get_dictionary_item_null_request', + 'build_get_dictionary_item_empty_request', + 'build_get_dictionary_valid_request', + 'build_put_dictionary_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py index 5159bcaaa62..71f27240218 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -13,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -2768,3 +2766,4 @@ def build_put_dictionary_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py index 74a40ae3f2d..4b1bd526ce3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime -from typing import Any, Dict, List, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null dictionary value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -40,16 +40,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/null" + url = '/dictionary/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get empty dictionary value {}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -71,16 +78,26 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/empty" + url = '/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -106,22 +123,31 @@ def build_put_empty_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/empty" + url = '/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_null_value_request(**kwargs: Any) -> HttpRequest: +def build_get_null_value_request( + **kwargs: Any +) -> HttpRequest: """Get Dictionary with null value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -143,16 +169,23 @@ def build_get_null_value_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/nullvalue" + url = '/dictionary/nullvalue' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_null_key_request(**kwargs: Any) -> HttpRequest: +def build_get_null_key_request( + **kwargs: Any +) -> HttpRequest: """Get Dictionary with null key. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -174,16 +207,23 @@ def build_get_null_key_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/nullkey" + url = '/dictionary/nullkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_string_key_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_string_key_request( + **kwargs: Any +) -> HttpRequest: """Get Dictionary with key as empty string. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -205,16 +245,23 @@ def build_get_empty_string_key_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/keyemptystring" + url = '/dictionary/keyemptystring' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get invalid Dictionary value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -236,16 +283,23 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/invalid" + url = '/dictionary/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_tfft_request( + **kwargs: Any +) -> HttpRequest: """Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true }. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -267,16 +321,26 @@ def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/tfft" + url = '/dictionary/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_boolean_tfft_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -302,22 +366,31 @@ def build_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/tfft" + url = '/dictionary/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get boolean dictionary value {"0": true, "1": null, "2": false }. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -339,16 +412,23 @@ def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/true.null.false" + url = '/dictionary/prim/boolean/true.null.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -370,16 +450,23 @@ def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/true.boolean.false" + url = '/dictionary/prim/boolean/true.boolean.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_integer_valid_request( + **kwargs: Any +) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -401,16 +488,26 @@ def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.-1.3.300" + url = '/dictionary/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_integer_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_integer_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -436,22 +533,31 @@ def build_put_integer_valid_request(*, json: JSONType = None, content: Any = Non } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.-1.3.300" + url = '/dictionary/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_int_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": null, "2": 0}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -473,16 +579,23 @@ def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.null.zero" + url = '/dictionary/prim/integer/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_int_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": "integer", "2": 0}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -504,16 +617,23 @@ def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.integer.0" + url = '/dictionary/prim/integer/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_long_valid_request( + **kwargs: Any +) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -535,16 +655,26 @@ def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.-1.3.300" + url = '/dictionary/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_long_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -570,22 +700,31 @@ def build_put_long_valid_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.-1.3.300" + url = '/dictionary/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_long_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get long dictionary value {"0": 1, "1": null, "2": 0}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -607,16 +746,23 @@ def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.null.zero" + url = '/dictionary/prim/long/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_long_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get long dictionary value {"0": 1, "1": "integer", "2": 0}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -638,16 +784,23 @@ def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.integer.0" + url = '/dictionary/prim/long/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_float_valid_request( + **kwargs: Any +) -> HttpRequest: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -669,16 +822,26 @@ def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/float/0--0.01-1.2e20" + url = '/dictionary/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_float_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -704,22 +867,31 @@ def build_put_float_valid_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/float/0--0.01-1.2e20" + url = '/dictionary/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_float_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -741,16 +913,23 @@ def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/float/0.0-null-1.2e20" + url = '/dictionary/prim/float/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_float_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -772,16 +951,23 @@ def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/float/1.number.0" + url = '/dictionary/prim/float/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_double_valid_request( + **kwargs: Any +) -> HttpRequest: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -803,16 +989,26 @@ def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/double/0--0.01-1.2e20" + url = '/dictionary/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_double_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_double_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -838,22 +1034,31 @@ def build_put_double_valid_request(*, json: JSONType = None, content: Any = None } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/double/0--0.01-1.2e20" + url = '/dictionary/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_double_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -875,16 +1080,23 @@ def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/double/0.0-null-1.2e20" + url = '/dictionary/prim/double/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_get_double_invalid_string_request( + **kwargs: Any +) -> HttpRequest: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -906,16 +1118,23 @@ def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/double/1.number.0" + url = '/dictionary/prim/double/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_valid_request( + **kwargs: Any +) -> HttpRequest: """Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -937,16 +1156,26 @@ def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo1.foo2.foo3" + url = '/dictionary/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_string_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_string_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -972,22 +1201,31 @@ def build_put_string_valid_request(*, json: JSONType = None, content: Any = None } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo1.foo2.foo3" + url = '/dictionary/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: +def build_get_string_with_null_request( + **kwargs: Any +) -> HttpRequest: """Get string dictionary value {"0": "foo", "1": null, "2": "foo2"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1009,16 +1247,23 @@ def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo.null.foo2" + url = '/dictionary/prim/string/foo.null.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_string_with_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1040,16 +1285,23 @@ def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo.123.foo2" + url = '/dictionary/prim/string/foo.123.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_valid_request( + **kwargs: Any +) -> HttpRequest: """Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1071,16 +1323,26 @@ def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date/valid" + url = '/dictionary/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1106,22 +1368,31 @@ def build_put_date_valid_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/date/valid" + url = '/dictionary/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_date_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1143,16 +1414,23 @@ def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date/invalidnull" + url = '/dictionary/prim/date/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_date_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: """Get date dictionary value {"0": "2011-03-22", "1": "date"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1174,16 +1452,23 @@ def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date/invalidchars" + url = '/dictionary/prim/date/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: """Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1206,16 +1491,26 @@ def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/valid" + url = '/dictionary/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_date_time_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1242,22 +1537,31 @@ def build_put_date_time_valid_request(*, json: JSONType = None, content: Any = N } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/valid" + url = '/dictionary/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1279,16 +1583,23 @@ def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/invalidnull" + url = '/dictionary/prim/date-time/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1310,16 +1621,23 @@ def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/invalidchars" + url = '/dictionary/prim/date-time/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_date_time_rfc1123_valid_request( + **kwargs: Any +) -> HttpRequest: """Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1342,17 +1660,25 @@ def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time-rfc1123/valid" + url = '/dictionary/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_put_date_time_rfc1123_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1380,22 +1706,31 @@ def build_put_date_time_rfc1123_valid_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time-rfc1123/valid" + url = '/dictionary/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_duration_valid_request( + **kwargs: Any +) -> HttpRequest: """Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1417,16 +1752,26 @@ def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/duration/valid" + url = '/dictionary/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_duration_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_duration_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1452,22 +1797,31 @@ def build_put_duration_valid_request(*, json: JSONType = None, content: Any = No } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/duration/valid" + url = '/dictionary/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_byte_valid_request( + **kwargs: Any +) -> HttpRequest: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each item encoded in base64. @@ -1490,16 +1844,26 @@ def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/byte/valid" + url = '/dictionary/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_byte_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -1526,22 +1890,31 @@ def build_put_byte_valid_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/byte/valid" + url = '/dictionary/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_get_byte_invalid_null_request( + **kwargs: Any +) -> HttpRequest: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 encoded. @@ -1564,16 +1937,23 @@ def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/byte/invalidnull" + url = '/dictionary/prim/byte/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: +def build_get_base64_url_request( + **kwargs: Any +) -> HttpRequest: """Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test string", "2": "Lorem ipsum"}. @@ -1596,16 +1976,23 @@ def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/base64url/valid" + url = '/dictionary/prim/base64url/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_null_request( + **kwargs: Any +) -> HttpRequest: """Get dictionary of complex type null value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1630,16 +2017,23 @@ def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/null" + url = '/dictionary/complex/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_empty_request( + **kwargs: Any +) -> HttpRequest: """Get empty dictionary of complex type {}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1664,16 +2058,23 @@ def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/empty" + url = '/dictionary/complex/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_item_null_request( + **kwargs: Any +) -> HttpRequest: """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}}. @@ -1699,16 +2100,23 @@ def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/itemnull" + url = '/dictionary/complex/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_item_empty_request( + **kwargs: Any +) -> HttpRequest: """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}}. @@ -1734,16 +2142,23 @@ def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/itemempty" + url = '/dictionary/complex/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_valid_request( + **kwargs: Any +) -> HttpRequest: """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -1769,16 +2184,26 @@ def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/valid" + url = '/dictionary/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_complex_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_complex_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -1808,22 +2233,31 @@ def build_put_complex_valid_request(*, json: JSONType = None, content: Any = Non } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/complex/valid" + url = '/dictionary/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_array_null_request(**kwargs: Any) -> HttpRequest: +def build_get_array_null_request( + **kwargs: Any +) -> HttpRequest: """Get a null array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1847,16 +2281,23 @@ def build_get_array_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/null" + url = '/dictionary/array/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_array_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an empty dictionary {}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1880,16 +2321,23 @@ def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/empty" + url = '/dictionary/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_array_item_null_request( + **kwargs: Any +) -> HttpRequest: """Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1913,16 +2361,23 @@ def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/itemnull" + url = '/dictionary/array/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_array_item_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1946,16 +2401,23 @@ def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/itemempty" + url = '/dictionary/array/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_array_valid_request( + **kwargs: Any +) -> HttpRequest: """Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -1980,16 +2442,26 @@ def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/valid" + url = '/dictionary/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2018,22 +2490,31 @@ def build_put_array_valid_request(*, json: JSONType = None, content: Any = None, } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/array/valid" + url = '/dictionary/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_null_request( + **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries with value null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2057,16 +2538,23 @@ def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/null" + url = '/dictionary/dictionary/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -2090,16 +2578,23 @@ def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/empty" + url = '/dictionary/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_item_null_request( + **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2124,16 +2619,23 @@ def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/itemnull" + url = '/dictionary/dictionary/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_item_empty_request( + **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2158,16 +2660,23 @@ def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/itemempty" + url = '/dictionary/dictionary/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_valid_request( + **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2193,16 +2702,26 @@ def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/valid" + url = '/dictionary/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_dictionary_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2232,16 +2751,24 @@ def build_put_dictionary_valid_request(*, json: JSONType = None, content: Any = } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/dictionary/valid" + url = '/dictionary/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/setup.py index 17faa081a7f..75ab9f722ed 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/__init__.py index 623e438eb9c..48ac23f1972 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py index 27b3e462369..3d4ce69a7b4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_auto_rest_duration_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_configuration.py index eebf56f42f2..b9017b0ff7b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py index ecd1d021c33..2db0a55fdb1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_duration_test_service import AutoRestDurationTestService - -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py index d53c6fcfd31..54e75592246 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_auto_rest_duration_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodydurationlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py index f7cece514e6..5994e663a71 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestDurationTestServiceConfiguration(Configuration): +class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestDurationTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py index 2551fd5500f..1068a1ad711 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_get_invalid_request # type: ignore __all__ = [ - "build_get_null_request", - "build_put_positive_duration_request", - "build_get_positive_duration_request", - "build_get_invalid_request", + 'build_get_null_request', + 'build_put_positive_duration_request', + 'build_get_positive_duration_request', + 'build_get_invalid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py index f3a13712c8e..21eeb377285 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -14,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -161,3 +159,4 @@ def build_get_invalid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py index 3ed698a6462..c53c9d32639 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,16 +32,26 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/null" + url = '/duration/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_positive_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_positive_duration_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a positive duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -65,22 +75,31 @@ def build_put_positive_duration_request(*, json: JSONType = None, content: Any = json = "1 day, 0:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_positive_duration_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_positive_duration_request( + **kwargs: Any +) -> HttpRequest: """Get a positive duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -94,16 +113,23 @@ def build_get_positive_duration_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get an invalid duration value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -117,10 +143,16 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/invalid" + url = '/duration/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/setup.py index 385afe6573c..05c0d98d9d2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/__init__.py index fedd7c51bff..b7164036958 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATFileService"] +__all__ = ['AutoRestSwaggerBATFileService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_auto_rest_swagger_bat_file_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_auto_rest_swagger_bat_file_service.py index e79738cb7a6..d3b8ffc313b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_auto_rest_swagger_bat_file_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_auto_rest_swagger_bat_file_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFileService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATFileService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATFileServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_configuration.py index 593948e653e..34a638e7354 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATFileServiceConfiguration(Configuration): +class AutoRestSwaggerBATFileServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFileService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFileServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatfileservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatfileservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/__init__.py index be4bf5f38d9..23e0f2a3206 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_file_service import AutoRestSwaggerBATFileService - -__all__ = ["AutoRestSwaggerBATFileService"] +__all__ = ['AutoRestSwaggerBATFileService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_auto_rest_swagger_bat_file_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_auto_rest_swagger_bat_file_service.py index 8447261cfeb..097b51daba4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_auto_rest_swagger_bat_file_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_auto_rest_swagger_bat_file_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFileService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATFileService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATFileServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodyfilelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_configuration.py index 668abb62f8e..f8818da4138 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATFileServiceConfiguration(Configuration): +class AutoRestSwaggerBATFileServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFileService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFileServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatfileservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatfileservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py index 7ac5971aa0b..337848dfb9c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_get_empty_file_request # type: ignore __all__ = [ - "build_get_file_request", - "build_get_file_large_request", - "build_get_empty_file_request", + 'build_get_file_request', + 'build_get_file_large_request', + 'build_get_empty_file_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py index 67beeefd085..04a356d509d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py @@ -110,3 +110,4 @@ def build_get_empty_file_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py index e30764e7525..98d6c8b0741 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER.client_side_validation = False -def build_get_file_request(**kwargs: Any) -> HttpRequest: +def build_get_file_request( + **kwargs: Any +) -> HttpRequest: """Get file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -28,16 +30,23 @@ def build_get_file_request(**kwargs: Any) -> HttpRequest: accept = "image/png, application/json" # Construct URL - url = "/files/stream/nonempty" + url = '/files/stream/nonempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_file_large_request(**kwargs: Any) -> HttpRequest: +def build_get_file_large_request( + **kwargs: Any +) -> HttpRequest: """Get a large file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -51,16 +60,23 @@ def build_get_file_large_request(**kwargs: Any) -> HttpRequest: accept = "image/png, application/json" # Construct URL - url = "/files/stream/verylarge" + url = '/files/stream/verylarge' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_empty_file_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_file_request( + **kwargs: Any +) -> HttpRequest: """Get empty file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -74,10 +90,16 @@ def build_get_empty_file_request(**kwargs: Any) -> HttpRequest: accept = "image/png, application/json" # Construct URL - url = "/files/stream/empty" + url = '/files/stream/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/setup.py index da0628aad71..fbaa7e44694 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/__init__.py index 3778d845e32..2c1d02ebfdb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATFormDataService"] +__all__ = ['AutoRestSwaggerBATFormDataService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_auto_rest_swagger_bat_form_data_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_auto_rest_swagger_bat_form_data_service.py index be4e5229d53..56baaa6215b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_auto_rest_swagger_bat_form_data_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_auto_rest_swagger_bat_form_data_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFormDataService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATFormDataService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATFormDataServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_configuration.py index dc2b708c432..8cf83183801 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): +class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFormDataService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFormDataServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatformdataservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatformdataservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/__init__.py index e27460706e4..255b1419e0b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_form_data_service import AutoRestSwaggerBATFormDataService - -__all__ = ["AutoRestSwaggerBATFormDataService"] +__all__ = ['AutoRestSwaggerBATFormDataService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_auto_rest_swagger_bat_form_data_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_auto_rest_swagger_bat_form_data_service.py index a27548ee656..9588dc404da 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_auto_rest_swagger_bat_form_data_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_auto_rest_swagger_bat_form_data_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFormDataService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATFormDataService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATFormDataServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodyformdatalowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_configuration.py index 6728a757294..c1c299343e5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): +class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATFormDataService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFormDataServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatformdataservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatformdataservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py index f7d990f66f0..c748d112b35 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_upload_files_request # type: ignore __all__ = [ - "build_upload_file_request", - "build_upload_file_via_body_request", - "build_upload_files_request", + 'build_upload_file_request', + 'build_upload_file_via_body_request', + 'build_upload_files_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py index e891e73342b..085cd4b2d22 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -48,7 +47,8 @@ def build_upload_file_request( # multipart input template you can fill out and use as your `files` input. files = { "file_content": b'bytes', # File to upload. - "file_name": "str" # File name to upload. Name has to be spelled exactly as written here. + "file_name": "str" # File name to upload. Name has to be spelled exactly as + written here. } """ @@ -159,3 +159,4 @@ def build_upload_files_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py index de06ec4eb75..db9179100c1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py @@ -5,12 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, List, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -18,7 +17,10 @@ def build_upload_file_request( - *, files: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + files: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Upload file. @@ -42,26 +44,38 @@ def build_upload_file_request( # multipart input template you can fill out and use as your `files` input. files = { "file_content": b'bytes', # File to upload. - "file_name": "str" # File name to upload. Name has to be spelled exactly as written here. + "file_name": "str" # File name to upload. Name has to be spelled exactly as + written here. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/octet-stream, application/json" # Construct URL - url = "/formdata/stream/uploadfile" + url = '/formdata/stream/uploadfile' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, files=files, content=content, **kwargs) - - -def build_upload_file_via_body_request(*, content: Any, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + files=files, + content=content, + **kwargs + ) + + +def build_upload_file_via_body_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Upload file. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -76,23 +90,32 @@ def build_upload_file_via_body_request(*, content: Any, **kwargs: Any) -> HttpRe :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/octet-stream, application/json" # Construct URL - url = "/formdata/stream/uploadfile" + url = '/formdata/stream/uploadfile' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_upload_files_request( - *, files: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + files: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Upload multiple files. @@ -121,16 +144,24 @@ def build_upload_files_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/octet-stream, application/json" # Construct URL - url = "/formdata/stream/uploadfiles" + url = '/formdata/stream/uploadfiles' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + files=files, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, files=files, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/setup.py index b9c8a22987e..39e98d75b27 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/__init__.py index 1bbfaf60a8b..39430c90415 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["BodyFormsDataURLEncoded"] +__all__ = ['BodyFormsDataURLEncoded'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_body_forms_data_url_encoded.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_body_forms_data_url_encoded.py index a8c654d17e5..c0ad1aed5e7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_body_forms_data_url_encoded.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_body_forms_data_url_encoded.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BodyFormsDataURLEncoded: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class BodyFormsDataURLEncoded: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = BodyFormsDataURLEncodedConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_configuration.py index 837cbafae7a..a3bc9a0f47a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class BodyFormsDataURLEncodedConfiguration(Configuration): +class BodyFormsDataURLEncodedConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BodyFormsDataURLEncoded. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BodyFormsDataURLEncodedConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "bodyformsdataurlencoded/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodyformsdataurlencoded/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/__init__.py index 9eda7cfdb59..71fa91da75b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._body_forms_data_url_encoded import BodyFormsDataURLEncoded - -__all__ = ["BodyFormsDataURLEncoded"] +__all__ = ['BodyFormsDataURLEncoded'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_body_forms_data_url_encoded.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_body_forms_data_url_encoded.py index 14dbc3ed63c..08f41f3c122 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_body_forms_data_url_encoded.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_body_forms_data_url_encoded.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BodyFormsDataURLEncoded: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class BodyFormsDataURLEncoded: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = BodyFormsDataURLEncodedConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodyformurlencodeddatalowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_configuration.py index 71cd7fc41ca..f95a73a26b1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class BodyFormsDataURLEncodedConfiguration(Configuration): +class BodyFormsDataURLEncodedConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for BodyFormsDataURLEncoded. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BodyFormsDataURLEncodedConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "bodyformsdataurlencoded/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodyformsdataurlencoded/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py index c2a1a3cee7d..983c97e941b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_partial_constant_body_request # type: ignore __all__ = [ - "build_update_pet_with_form_request", - "build_partial_constant_body_request", + 'build_update_pet_with_form_request', + 'build_partial_constant_body_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py index f7ce39409bb..a1d829e9304 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py @@ -15,8 +15,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -56,8 +55,10 @@ def build_update_pet_with_form_request( data = { "name": "str", # Optional. Updated name of the pet. "pet_age": 0, # How many years is it old?. - "pet_food": "str", # Can take a value of meat, or fish, or plant. Possible values are: "meat", "fish", and "plant". - "pet_type": "str", # Can take a value of dog, or cat, or fish. Possible values are: "dog", "cat", and "fish". + "pet_food": "str", # Can take a value of meat, or fish, or plant. Possible + values are: "meat", "fish", and "plant". + "pet_type": "str", # Can take a value of dog, or cat, or fish. Possible + values are: "dog", "cat", and "fish". "status": "str" # Optional. Updated status of the pet. } """ @@ -111,8 +112,11 @@ def build_partial_constant_body_request( # form-encoded input template you can fill out and use as your `data` input. data = { - "access_token": "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. - "grant_type": "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + "access_token": "str", # AAD access token, mandatory when grant_type is + access_token_refresh_token or access_token. + "grant_type": "access_token", # Default value is "access_token". Constant + part of a formdata body. The default value is "access_token". Note that + overriding this default value may result in unsupported behavior. "service": "str" # Indicates the name of your Azure container registry. } """ @@ -133,3 +137,4 @@ def build_partial_constant_body_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py index 287370f80d7..09be54c82c6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py @@ -11,8 +11,7 @@ from msrest import Serializer from ..._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -20,7 +19,11 @@ def build_update_pet_with_form_request( - pet_id: int, *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + pet_id: int, + *, + data: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Updates a pet in the store with form data. @@ -49,18 +52,20 @@ def build_update_pet_with_form_request( data = { "name": "str", # Optional. Updated name of the pet. "pet_age": 0, # How many years is it old?. - "pet_food": "str", # Can take a value of meat, or fish, or plant. Possible values are: "meat", "fish", and "plant". - "pet_type": "str", # Can take a value of dog, or cat, or fish. Possible values are: "dog", "cat", and "fish". + "pet_food": "str", # Can take a value of meat, or fish, or plant. Possible + values are: "meat", "fish", and "plant". + "pet_type": "str", # Can take a value of dog, or cat, or fish. Possible + values are: "dog", "cat", and "fish". "status": "str" # Optional. Updated status of the pet. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/formsdataurlencoded/pet/add/{petId}" + url = '/formsdataurlencoded/pet/add/{petId}' path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, "int"), + "petId": _SERIALIZER.url("pet_id", pet_id, 'int'), } url = _format_url_section(url, **path_format_arguments) @@ -68,13 +73,23 @@ def build_update_pet_with_form_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + data=data, + content=content, + **kwargs + ) def build_partial_constant_body_request( - *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + data: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: 'foo', service: 'bar' } to pass the test. @@ -98,20 +113,31 @@ def build_partial_constant_body_request( # form-encoded input template you can fill out and use as your `data` input. data = { - "access_token": "str", # AAD access token, mandatory when grant_type is access_token_refresh_token or access_token. - "grant_type": "access_token", # Default value is "access_token". Constant part of a formdata body. The default value is "access_token". Note that overriding this default value may result in unsupported behavior. + "access_token": "str", # AAD access token, mandatory when grant_type is + access_token_refresh_token or access_token. + "grant_type": "access_token", # Default value is "access_token". Constant + part of a formdata body. The default value is "access_token". Note that + overriding this default value may result in unsupported behavior. "service": "str" # Indicates the name of your Azure container registry. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/formsdataurlencoded/partialConstantBody" + url = '/formsdataurlencoded/partialConstantBody' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + data=data, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/setup.py index 865983fb584..7d71a848053 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/__init__.py index 57b034a143f..df30011173d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestIntegerTestService"] +__all__ = ['AutoRestIntegerTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_auto_rest_integer_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_auto_rest_integer_test_service.py index 60816be5861..23db35f974a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_auto_rest_integer_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_auto_rest_integer_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestIntegerTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestIntegerTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestIntegerTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_configuration.py index 486012b65e3..284e94b4ea6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestIntegerTestServiceConfiguration(Configuration): +class AutoRestIntegerTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestIntegerTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestIntegerTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestintegertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestintegertestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/__init__.py index 92e3cb60c63..6c38252cb2b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_integer_test_service import AutoRestIntegerTestService - -__all__ = ["AutoRestIntegerTestService"] +__all__ = ['AutoRestIntegerTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_auto_rest_integer_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_auto_rest_integer_test_service.py index 1182b607314..261c969b7e0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_auto_rest_integer_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_auto_rest_integer_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestIntegerTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestIntegerTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestIntegerTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodyintegerlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_configuration.py index 68ab8b27e32..57034c6aa91 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestIntegerTestServiceConfiguration(Configuration): +class AutoRestIntegerTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestIntegerTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestIntegerTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestintegertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestintegertestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py index 9ef9986b288..0978936aba7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py @@ -38,18 +38,18 @@ from ._request_builders import build_get_null_unix_time_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_invalid_request", - "build_get_overflow_int32_request", - "build_get_underflow_int32_request", - "build_get_overflow_int64_request", - "build_get_underflow_int64_request", - "build_put_max32_request", - "build_put_max64_request", - "build_put_min32_request", - "build_put_min64_request", - "build_get_unix_time_request", - "build_put_unix_time_date_request", - "build_get_invalid_unix_time_request", - "build_get_null_unix_time_request", + 'build_get_null_request', + 'build_get_invalid_request', + 'build_get_overflow_int32_request', + 'build_get_underflow_int32_request', + 'build_get_overflow_int64_request', + 'build_get_underflow_int64_request', + 'build_put_max32_request', + 'build_put_max64_request', + 'build_put_min32_request', + 'build_put_min64_request', + 'build_get_unix_time_request', + 'build_put_unix_time_date_request', + 'build_get_invalid_unix_time_request', + 'build_get_null_unix_time_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py index e1ba10a58ac..239bc7ba53d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -14,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -535,3 +533,4 @@ def build_get_null_unix_time_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py index 0840bfa4c71..73f43e11308 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null Int value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,16 +32,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/null" + url = '/int/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_request( + **kwargs: Any +) -> HttpRequest: """Get invalid Int value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,16 +62,23 @@ def build_get_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/invalid" + url = '/int/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_overflow_int32_request(**kwargs: Any) -> HttpRequest: +def build_get_overflow_int32_request( + **kwargs: Any +) -> HttpRequest: """Get overflow Int32 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -78,16 +92,23 @@ def build_get_overflow_int32_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/overflowint32" + url = '/int/overflowint32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_underflow_int32_request(**kwargs: Any) -> HttpRequest: +def build_get_underflow_int32_request( + **kwargs: Any +) -> HttpRequest: """Get underflow Int32 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -101,16 +122,23 @@ def build_get_underflow_int32_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/underflowint32" + url = '/int/underflowint32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_overflow_int64_request(**kwargs: Any) -> HttpRequest: +def build_get_overflow_int64_request( + **kwargs: Any +) -> HttpRequest: """Get overflow Int64 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -124,16 +152,23 @@ def build_get_overflow_int64_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/overflowint64" + url = '/int/overflowint64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_underflow_int64_request(**kwargs: Any) -> HttpRequest: +def build_get_underflow_int64_request( + **kwargs: Any +) -> HttpRequest: """Get underflow Int64 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -147,16 +182,26 @@ def build_get_underflow_int64_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/underflowint64" + url = '/int/underflowint64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_max32_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_max32_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put max int32 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -180,22 +225,34 @@ def build_put_max32_request(*, json: JSONType = None, content: Any = None, **kwa json = 0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/max/32" + url = '/int/max/32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_max64_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_max64_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put max int64 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -219,22 +276,34 @@ def build_put_max64_request(*, json: JSONType = None, content: Any = None, **kwa json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/max/64" + url = '/int/max/64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_min32_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_min32_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put min int32 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -258,22 +327,34 @@ def build_put_min32_request(*, json: JSONType = None, content: Any = None, **kwa json = 0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/min/32" + url = '/int/min/32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_min64_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_min64_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put min int64 value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -297,22 +378,31 @@ def build_put_min64_request(*, json: JSONType = None, content: Any = None, **kwa json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/min/64" + url = '/int/min/64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_unix_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_unix_time_request( + **kwargs: Any +) -> HttpRequest: """Get datetime encoded as Unix time value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -326,16 +416,26 @@ def build_get_unix_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/unixtime" + url = '/int/unixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_unix_time_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_unix_time_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put datetime encoded as Unix time. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -359,22 +459,31 @@ def build_put_unix_time_date_request(*, json: JSONType = None, content: Any = No json = "2020-02-20 00:00:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/unixtime" + url = '/int/unixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_invalid_unix_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_invalid_unix_time_request( + **kwargs: Any +) -> HttpRequest: """Get invalid Unix time value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -388,16 +497,23 @@ def build_get_invalid_unix_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/invalidunixtime" + url = '/int/invalidunixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_null_unix_time_request(**kwargs: Any) -> HttpRequest: +def build_get_null_unix_time_request( + **kwargs: Any +) -> HttpRequest: """Get null Unix time value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -411,10 +527,16 @@ def build_get_null_unix_time_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/nullunixtime" + url = '/int/nullunixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/setup.py index bcd0dece55b..2171cf31990 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/__init__.py index 9b131940e32..f031d50102e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestNumberTestService"] +__all__ = ['AutoRestNumberTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_auto_rest_number_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_auto_rest_number_test_service.py index e97119d0a92..919511aa912 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_auto_rest_number_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_auto_rest_number_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestNumberTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestNumberTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestNumberTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_configuration.py index 27ae3c7a63a..e7b8cfd2766 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestNumberTestServiceConfiguration(Configuration): +class AutoRestNumberTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestNumberTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestNumberTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestnumbertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestnumbertestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/__init__.py index 4b6e06f5364..b3cdd84231d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_number_test_service import AutoRestNumberTestService - -__all__ = ["AutoRestNumberTestService"] +__all__ = ['AutoRestNumberTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_auto_rest_number_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_auto_rest_number_test_service.py index 90cd898c125..74e07d83574 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_auto_rest_number_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_auto_rest_number_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestNumberTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestNumberTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestNumberTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodynumberlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_configuration.py index aa79cc51c32..d6e3c56a3e0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestNumberTestServiceConfiguration(Configuration): +class AutoRestNumberTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestNumberTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestNumberTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestnumbertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestnumbertestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py index cce808da949..db05cebbbe0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py @@ -58,28 +58,28 @@ from ._request_builders import build_get_small_decimal_request # type: ignore __all__ = [ - "build_get_null_request", - "build_get_invalid_float_request", - "build_get_invalid_double_request", - "build_get_invalid_decimal_request", - "build_put_big_float_request", - "build_get_big_float_request", - "build_put_big_double_request", - "build_get_big_double_request", - "build_put_big_double_positive_decimal_request", - "build_get_big_double_positive_decimal_request", - "build_put_big_double_negative_decimal_request", - "build_get_big_double_negative_decimal_request", - "build_put_big_decimal_request", - "build_get_big_decimal_request", - "build_put_big_decimal_positive_decimal_request", - "build_get_big_decimal_positive_decimal_request", - "build_put_big_decimal_negative_decimal_request", - "build_get_big_decimal_negative_decimal_request", - "build_put_small_float_request", - "build_get_small_float_request", - "build_put_small_double_request", - "build_get_small_double_request", - "build_put_small_decimal_request", - "build_get_small_decimal_request", + 'build_get_null_request', + 'build_get_invalid_float_request', + 'build_get_invalid_double_request', + 'build_get_invalid_decimal_request', + 'build_put_big_float_request', + 'build_get_big_float_request', + 'build_put_big_double_request', + 'build_get_big_double_request', + 'build_put_big_double_positive_decimal_request', + 'build_get_big_double_positive_decimal_request', + 'build_put_big_double_negative_decimal_request', + 'build_get_big_double_negative_decimal_request', + 'build_put_big_decimal_request', + 'build_get_big_decimal_request', + 'build_put_big_decimal_positive_decimal_request', + 'build_get_big_decimal_positive_decimal_request', + 'build_put_big_decimal_negative_decimal_request', + 'build_get_big_decimal_negative_decimal_request', + 'build_put_small_float_request', + 'build_get_small_float_request', + 'build_put_small_double_request', + 'build_get_small_double_request', + 'build_put_small_decimal_request', + 'build_get_small_decimal_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py index 25ca6eb2980..cfeb3eedc36 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -896,3 +895,4 @@ def build_get_small_decimal_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py index 48b5b35fa9a..0dfad44ca2e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null Number value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,23 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/null" + url = '/number/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_float_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_float_request( + **kwargs: Any +) -> HttpRequest: """Get invalid float Number value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -54,16 +62,23 @@ def build_get_invalid_float_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/invalidfloat" + url = '/number/invalidfloat' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_double_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_double_request( + **kwargs: Any +) -> HttpRequest: """Get invalid double Number value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -77,16 +92,23 @@ def build_get_invalid_double_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/invaliddouble" + url = '/number/invaliddouble' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_invalid_decimal_request(**kwargs: Any) -> HttpRequest: +def build_get_invalid_decimal_request( + **kwargs: Any +) -> HttpRequest: """Get invalid decimal Number value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -100,16 +122,26 @@ def build_get_invalid_decimal_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/invaliddecimal" + url = '/number/invaliddecimal' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_big_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_big_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put big float value 3.402823e+20. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -133,22 +165,31 @@ def build_put_big_float_request(*, json: JSONType = None, content: Any = None, * json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/big/float/3.402823e+20" + url = '/number/big/float/3.402823e+20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_big_float_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_big_float_request( + **kwargs: Any +) -> HttpRequest: """Get big float value 3.402823e+20. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -162,16 +203,26 @@ def build_get_big_float_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/float/3.402823e+20" + url = '/number/big/float/3.402823e+20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_big_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_big_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put big double value 2.5976931e+101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -195,22 +246,31 @@ def build_put_big_double_request(*, json: JSONType = None, content: Any = None, json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/big/double/2.5976931e+101" + url = '/number/big/double/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_big_double_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_big_double_request( + **kwargs: Any +) -> HttpRequest: """Get big double value 2.5976931e+101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -224,16 +284,23 @@ def build_get_big_double_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/double/2.5976931e+101" + url = '/number/big/double/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: +def build_put_big_double_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: """Put big double value 99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -248,23 +315,31 @@ def build_put_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", 99999999.99) # type: float + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', 99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/double/99999999.99" + url = '/number/big/double/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: +def build_get_big_double_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: """Get big double value 99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -278,16 +353,23 @@ def build_get_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/double/99999999.99" + url = '/number/big/double/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: +def build_put_big_double_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: """Put big double value -99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -302,23 +384,31 @@ def build_put_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", -99999999.99) # type: float + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', -99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/double/-99999999.99" + url = '/number/big/double/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: +def build_get_big_double_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: """Get big double value -99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -332,16 +422,26 @@ def build_get_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/double/-99999999.99" + url = '/number/big/double/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_big_decimal_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_big_decimal_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put big decimal value 2.5976931e+101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -365,22 +465,31 @@ def build_put_big_decimal_request(*, json: JSONType = None, content: Any = None, json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/big/decimal/2.5976931e+101" + url = '/number/big/decimal/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_big_decimal_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_big_decimal_request( + **kwargs: Any +) -> HttpRequest: """Get big decimal value 2.5976931e+101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -394,16 +503,23 @@ def build_get_big_decimal_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/decimal/2.5976931e+101" + url = '/number/big/decimal/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest: +def build_put_big_decimal_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: """Put big decimal value 99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -418,23 +534,31 @@ def build_put_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", 99999999.99) # type: float + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', 99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/decimal/99999999.99" + url = '/number/big/decimal/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest: +def build_get_big_decimal_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: """Get big decimal value 99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -448,16 +572,23 @@ def build_get_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest accept = "application/json" # Construct URL - url = "/number/big/decimal/99999999.99" + url = '/number/big/decimal/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest: +def build_put_big_decimal_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: """Put big decimal value -99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -472,23 +603,31 @@ def build_put_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", -99999999.99) # type: float + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', -99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/decimal/-99999999.99" + url = '/number/big/decimal/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest: +def build_get_big_decimal_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: """Get big decimal value -99999999.99. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -502,16 +641,26 @@ def build_get_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest accept = "application/json" # Construct URL - url = "/number/big/decimal/-99999999.99" + url = '/number/big/decimal/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_small_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_small_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put small float value 3.402823e-20. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -535,22 +684,31 @@ def build_put_small_float_request(*, json: JSONType = None, content: Any = None, json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/small/float/3.402823e-20" + url = '/number/small/float/3.402823e-20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_small_float_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_small_float_request( + **kwargs: Any +) -> HttpRequest: """Get big double value 3.402823e-20. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -564,16 +722,26 @@ def build_get_small_float_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/small/float/3.402823e-20" + url = '/number/small/float/3.402823e-20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_small_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_small_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put small double value 2.5976931e-101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -597,22 +765,31 @@ def build_put_small_double_request(*, json: JSONType = None, content: Any = None json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/small/double/2.5976931e-101" + url = '/number/small/double/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_small_double_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_small_double_request( + **kwargs: Any +) -> HttpRequest: """Get big double value 2.5976931e-101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -626,16 +803,26 @@ def build_get_small_double_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/small/double/2.5976931e-101" + url = '/number/small/double/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_small_decimal_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_small_decimal_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put small decimal value 2.5976931e-101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -659,22 +846,31 @@ def build_put_small_decimal_request(*, json: JSONType = None, content: Any = Non json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/small/decimal/2.5976931e-101" + url = '/number/small/decimal/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_small_decimal_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_small_decimal_request( + **kwargs: Any +) -> HttpRequest: """Get small decimal value 2.5976931e-101. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -688,10 +884,16 @@ def build_get_small_decimal_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/small/decimal/2.5976931e-101" + url = '/number/small/decimal/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/setup.py index f2c282a12aa..b71e9aed9fc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/__init__.py index 86f0d888647..d160e037104 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATService"] +__all__ = ['AutoRestSwaggerBATService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_auto_rest_swagger_bat_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_auto_rest_swagger_bat_service.py index ddf4fdcab81..e71e21e5a70 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_auto_rest_swagger_bat_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_auto_rest_swagger_bat_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_configuration.py index 97f7a19b775..abe4315ba6a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATServiceConfiguration(Configuration): +class AutoRestSwaggerBATServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/__init__.py index 865075d6286..9fe2b43623d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_service import AutoRestSwaggerBATService - -__all__ = ["AutoRestSwaggerBATService"] +__all__ = ['AutoRestSwaggerBATService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_auto_rest_swagger_bat_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_auto_rest_swagger_bat_service.py index 295170e4f4e..f311cdc9155 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_auto_rest_swagger_bat_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_auto_rest_swagger_bat_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodystringlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_configuration.py index b78427e6b41..95456b43dd5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATServiceConfiguration(Configuration): +class AutoRestSwaggerBATServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py index b47975af01f..8a4ee74d0db 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py @@ -22,10 +22,10 @@ from ._request_builders import build_put_referenced_constant_request # type: ignore __all__ = [ - "build_get_not_expandable_request", - "build_put_not_expandable_request", - "build_get_referenced_request", - "build_put_referenced_request", - "build_get_referenced_constant_request", - "build_put_referenced_constant_request", + 'build_get_not_expandable_request', + 'build_put_not_expandable_request', + 'build_get_referenced_request', + 'build_put_referenced_request', + 'build_get_referenced_constant_request', + 'build_put_referenced_constant_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py index 2a5cc29e020..93c291808e5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -209,7 +208,8 @@ def build_get_referenced_constant_request( # response body for status code(s): 200 response.json() == { - "ColorConstant": "green-color", # Default value is "green-color". Referenced Color Constant Description. Has constant value: "green-color". + "ColorConstant": "green-color", # Default value is "green-color". Referenced + Color Constant Description. Has constant value: "green-color". "field1": "str" # Optional. Sample string. } """ @@ -255,7 +255,8 @@ def build_put_referenced_constant_request( # JSON input template you can fill out and use as your body input. json = { - "ColorConstant": "green-color", # Default value is "green-color". Referenced Color Constant Description. Has constant value: "green-color". + "ColorConstant": "green-color", # Default value is "green-color". Referenced + Color Constant Description. Has constant value: "green-color". "field1": "str" # Optional. Sample string. } """ @@ -278,3 +279,4 @@ def build_put_referenced_constant_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py index c1f914ed1e6..6d57e675f37 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_not_expandable_request(**kwargs: Any) -> HttpRequest: +def build_get_not_expandable_request( + **kwargs: Any +) -> HttpRequest: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -37,16 +38,26 @@ def build_get_not_expandable_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/enum/notExpandable" + url = '/string/enum/notExpandable' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_not_expandable_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_not_expandable_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -70,22 +81,31 @@ def build_put_not_expandable_request(*, json: JSONType = None, content: Any = No json = "str" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/enum/notExpandable" + url = '/string/enum/notExpandable' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_referenced_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_referenced_request( + **kwargs: Any +) -> HttpRequest: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -105,16 +125,26 @@ def build_get_referenced_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/enum/Referenced" + url = '/string/enum/Referenced' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_referenced_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_referenced_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -138,22 +168,31 @@ def build_put_referenced_request(*, json: JSONType = None, content: Any = None, json = "str" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/enum/Referenced" + url = '/string/enum/Referenced' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_referenced_constant_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_referenced_constant_request( + **kwargs: Any +) -> HttpRequest: """Get value 'green-color' from the constant. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -169,23 +208,34 @@ def build_get_referenced_constant_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "ColorConstant": "green-color", # Default value is "green-color". Referenced Color Constant Description. Has constant value: "green-color". + "ColorConstant": "green-color", # Default value is "green-color". Referenced + Color Constant Description. Has constant value: "green-color". "field1": "str" # Optional. Sample string. } """ accept = "application/json" # Construct URL - url = "/string/enum/ReferencedConstant" + url = '/string/enum/ReferencedConstant' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_referenced_constant_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_referenced_constant_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Sends value 'green-color' from a constant. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -207,21 +257,30 @@ def build_put_referenced_constant_request(*, json: JSONType = None, content: Any # JSON input template you can fill out and use as your body input. json = { - "ColorConstant": "green-color", # Default value is "green-color". Referenced Color Constant Description. Has constant value: "green-color". + "ColorConstant": "green-color", # Default value is "green-color". Referenced + Color Constant Description. Has constant value: "green-color". "field1": "str" # Optional. Sample string. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/enum/ReferencedConstant" + url = '/string/enum/ReferencedConstant' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py index 9ace38ded20..3a9f132659d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py @@ -36,17 +36,17 @@ from ._request_builders import build_get_null_base64_url_encoded_request # type: ignore __all__ = [ - "build_get_null_request", - "build_put_null_request", - "build_get_empty_request", - "build_put_empty_request", - "build_get_mbcs_request", - "build_put_mbcs_request", - "build_get_whitespace_request", - "build_put_whitespace_request", - "build_get_not_provided_request", - "build_get_base64_encoded_request", - "build_get_base64_url_encoded_request", - "build_put_base64_url_encoded_request", - "build_get_null_base64_url_encoded_request", + 'build_get_null_request', + 'build_put_null_request', + 'build_get_empty_request', + 'build_put_empty_request', + 'build_get_mbcs_request', + 'build_put_mbcs_request', + 'build_get_whitespace_request', + 'build_put_whitespace_request', + 'build_get_not_provided_request', + 'build_get_base64_encoded_request', + 'build_get_base64_url_encoded_request', + 'build_put_base64_url_encoded_request', + 'build_get_null_base64_url_encoded_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py index 424e79fa372..6ddf003ca00 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -488,3 +487,4 @@ def build_get_null_base64_url_encoded_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py index 7a85de251c1..e1a886e9774 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_null_request(**kwargs: Any) -> HttpRequest: +def build_get_null_request( + **kwargs: Any +) -> HttpRequest: """Get null string value value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,26 @@ def build_get_null_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/null" + url = '/string/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_null_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_null_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Set string value null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -64,22 +75,31 @@ def build_put_null_request(*, json: JSONType = None, content: Any = None, **kwar json = "str" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/null" + url = '/string/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_empty_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get empty string value value ''. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -93,16 +113,23 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/empty" + url = '/string/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_request(**kwargs: Any) -> HttpRequest: +def build_put_empty_request( + **kwargs: Any +) -> HttpRequest: """Set string value empty ''. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -117,23 +144,31 @@ def build_put_empty_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", "") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', "") # type: str accept = "application/json" # Construct URL - url = "/string/empty" + url = '/string/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_mbcs_request(**kwargs: Any) -> HttpRequest: +def build_get_mbcs_request( + **kwargs: Any +) -> HttpRequest: """Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -147,16 +182,23 @@ def build_get_mbcs_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/mbcs" + url = '/string/mbcs' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_mbcs_request(**kwargs: Any) -> HttpRequest: +def build_put_mbcs_request( + **kwargs: Any +) -> HttpRequest: """Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -172,23 +214,31 @@ def build_put_mbcs_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str accept = "application/json" # Construct URL - url = "/string/mbcs" + url = '/string/mbcs' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_whitespace_request(**kwargs: Any) -> HttpRequest: +def build_get_whitespace_request( + **kwargs: Any +) -> HttpRequest: """Get string value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -204,16 +254,23 @@ def build_get_whitespace_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/whitespace" + url = '/string/whitespace' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_whitespace_request(**kwargs: Any) -> HttpRequest: +def build_put_whitespace_request( + **kwargs: Any +) -> HttpRequest: """Set String value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -231,25 +288,31 @@ def build_put_whitespace_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop( - "json", " Now is the time for all good men to come to the aid of their country " - ) # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', " Now is the time for all good men to come to the aid of their country ") # type: str accept = "application/json" # Construct URL - url = "/string/whitespace" + url = '/string/whitespace' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: """Get String value when no string value is sent in response payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -263,16 +326,23 @@ def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/notProvided" + url = '/string/notProvided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_base64_encoded_request(**kwargs: Any) -> HttpRequest: +def build_get_base64_encoded_request( + **kwargs: Any +) -> HttpRequest: """Get value that is base64 encoded. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -286,16 +356,23 @@ def build_get_base64_encoded_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/base64Encoding" + url = '/string/base64Encoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: +def build_get_base64_url_encoded_request( + **kwargs: Any +) -> HttpRequest: """Get value that is base64url encoded. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -309,16 +386,26 @@ def build_get_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/base64UrlEncoding" + url = '/string/base64UrlEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_base64_url_encoded_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_base64_url_encoded_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put value that is base64url encoded. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -342,22 +429,31 @@ def build_put_base64_url_encoded_request(*, json: JSONType = None, content: Any json = bytes("bytes", encoding="utf-8") # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/base64UrlEncoding" + url = '/string/base64UrlEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_null_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_null_base64_url_encoded_request( + **kwargs: Any +) -> HttpRequest: """Get null value that is expected to be base64url encoded. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -371,10 +467,16 @@ def build_get_null_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/nullBase64UrlEncoding" + url = '/string/nullBase64UrlEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/setup.py index f9bbe0b13fa..ae0d28c8999 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/__init__.py index 56812fdf84f..53543c20c80 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestTimeTestService"] +__all__ = ['AutoRestTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_auto_rest_time_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_auto_rest_time_test_service.py index cc7535723b7..5222819f5c2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_auto_rest_time_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_auto_rest_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestTimeTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_configuration.py index ddd9c651ac4..352745eeef4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestTimeTestServiceConfiguration(Configuration): +class AutoRestTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresttimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresttimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/__init__.py index fc22a80891c..2bd831529fc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_time_test_service import AutoRestTimeTestService - -__all__ = ["AutoRestTimeTestService"] +__all__ = ['AutoRestTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_auto_rest_time_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_auto_rest_time_test_service.py index 44aeea4563a..f6517d88e53 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_auto_rest_time_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_auto_rest_time_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestTimeTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `bodytimelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_configuration.py index b77c2f46895..16d51d576b8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestTimeTestServiceConfiguration(Configuration): +class AutoRestTimeTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestTimeTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresttimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresttimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py index 355267c5498..a44e716f9fd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_put_request # type: ignore __all__ = [ - "build_get_request", - "build_put_request", + 'build_get_request', + 'build_put_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py index 3fbdd66b8f0..219871b0f35 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py @@ -5,7 +5,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import TYPE_CHECKING from azure.core.rest import HttpRequest @@ -14,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -99,3 +97,4 @@ def build_put_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py index 8eba07037b0..ef81adbf4c2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py @@ -5,20 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request(**kwargs: Any) -> HttpRequest: +def build_get_request( + **kwargs: Any +) -> HttpRequest: """Get time value "11:34:56". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,16 +32,26 @@ def build_get_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/time/get" + url = '/time/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put time value "08:07:56". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -65,16 +75,24 @@ def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: A json = "12:30:00" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/time/put" + url = '/time/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/setup.py index 4c61b19cc21..83bbaeff6d5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/__init__.py index 6010eb2ed79..1fbf0c53df8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerConstantService"] +__all__ = ['AutoRestSwaggerConstantService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_auto_rest_swagger_constant_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_auto_rest_swagger_constant_service.py index f314a2cfd6d..e6a347e2735 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_auto_rest_swagger_constant_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_auto_rest_swagger_constant_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerConstantService: """Test Infrastructure for AutoRest Swagger Constant. @@ -39,8 +38,13 @@ class AutoRestSwaggerConstantService: :paramtype path_constant: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerConstantServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -48,6 +52,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_configuration.py index dba2058bcc0..69d830fd5f5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_configuration.py @@ -14,42 +14,53 @@ from ._version import VERSION -class AutoRestSwaggerConstantServiceConfiguration(Configuration): +class AutoRestSwaggerConstantServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerConstantService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword header_constant: Constant header property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is True. Note that overriding this default value may result in unsupported behavior. + :keyword header_constant: Constant header property on the client that is a required parameter + for operation 'constants_putClientConstants'. The default value is True. Note that overriding + this default value may result in unsupported behavior. :paramtype header_constant: bool - :keyword query_constant: Constant query property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is 100. Note that overriding this default value may result in unsupported behavior. + :keyword query_constant: Constant query property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is 100. Note that overriding this + default value may result in unsupported behavior. :paramtype query_constant: int - :keyword path_constant: Constant path property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is "path". Note that overriding this default value may result in unsupported behavior. + :keyword path_constant: Constant path property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is "path". Note that overriding + this default value may result in unsupported behavior. :paramtype path_constant: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerConstantServiceConfiguration, self).__init__(**kwargs) - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str + self.header_constant = header_constant self.query_constant = query_constant self.path_constant = path_constant - kwargs.setdefault("sdk_moniker", "autorestswaggerconstantservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerconstantservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/__init__.py index 84d9e53e91d..06b58b00b84 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_constant_service import AutoRestSwaggerConstantService - -__all__ = ["AutoRestSwaggerConstantService"] +__all__ = ['AutoRestSwaggerConstantService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_auto_rest_swagger_constant_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_auto_rest_swagger_constant_service.py index b188713e582..11a57f5dcea 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_auto_rest_swagger_constant_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_auto_rest_swagger_constant_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerConstantService: """Test Infrastructure for AutoRest Swagger Constant. @@ -39,7 +38,12 @@ class AutoRestSwaggerConstantService: :paramtype path_constant: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerConstantServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -47,7 +51,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `constantslowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_configuration.py index 0f10bc85b73..7b9bc4f8ac9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/aio/_configuration.py @@ -14,39 +14,52 @@ from .._version import VERSION -class AutoRestSwaggerConstantServiceConfiguration(Configuration): +class AutoRestSwaggerConstantServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerConstantService. Note that all parameters used to create this instance are saved as instance attributes. - :keyword header_constant: Constant header property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is True. Note that overriding this default value may result in unsupported behavior. + :keyword header_constant: Constant header property on the client that is a required parameter + for operation 'constants_putClientConstants'. The default value is True. Note that overriding + this default value may result in unsupported behavior. :paramtype header_constant: bool - :keyword query_constant: Constant query property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is 100. Note that overriding this default value may result in unsupported behavior. + :keyword query_constant: Constant query property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is 100. Note that overriding this + default value may result in unsupported behavior. :paramtype query_constant: int - :keyword path_constant: Constant path property on the client that is a required parameter for operation 'constants_putClientConstants'. The default value is "path". Note that overriding this default value may result in unsupported behavior. + :keyword path_constant: Constant path property on the client that is a required parameter for + operation 'constants_putClientConstants'. The default value is "path". Note that overriding + this default value may result in unsupported behavior. :paramtype path_constant: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerConstantServiceConfiguration, self).__init__(**kwargs) - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str + self.header_constant = header_constant self.query_constant = query_constant self.path_constant = path_constant - kwargs.setdefault("sdk_moniker", "autorestswaggerconstantservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerconstantservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py index 3d9ad535b0e..264a455cbab 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py @@ -44,21 +44,21 @@ from ._request_builders import build_put_client_constants_request # type: ignore __all__ = [ - "build_put_no_model_as_string_no_required_two_value_no_default_request", - "build_put_no_model_as_string_no_required_two_value_default_request", - "build_put_no_model_as_string_no_required_one_value_no_default_request", - "build_put_no_model_as_string_no_required_one_value_default_request", - "build_put_no_model_as_string_required_two_value_no_default_request", - "build_put_no_model_as_string_required_two_value_default_request", - "build_put_no_model_as_string_required_one_value_no_default_request", - "build_put_no_model_as_string_required_one_value_default_request", - "build_put_model_as_string_no_required_two_value_no_default_request", - "build_put_model_as_string_no_required_two_value_default_request", - "build_put_model_as_string_no_required_one_value_no_default_request", - "build_put_model_as_string_no_required_one_value_default_request", - "build_put_model_as_string_required_two_value_no_default_request", - "build_put_model_as_string_required_two_value_default_request", - "build_put_model_as_string_required_one_value_no_default_request", - "build_put_model_as_string_required_one_value_default_request", - "build_put_client_constants_request", + 'build_put_no_model_as_string_no_required_two_value_no_default_request', + 'build_put_no_model_as_string_no_required_two_value_default_request', + 'build_put_no_model_as_string_no_required_one_value_no_default_request', + 'build_put_no_model_as_string_no_required_one_value_default_request', + 'build_put_no_model_as_string_required_two_value_no_default_request', + 'build_put_no_model_as_string_required_two_value_default_request', + 'build_put_no_model_as_string_required_one_value_no_default_request', + 'build_put_no_model_as_string_required_one_value_default_request', + 'build_put_model_as_string_no_required_two_value_no_default_request', + 'build_put_model_as_string_no_required_two_value_default_request', + 'build_put_model_as_string_no_required_one_value_no_default_request', + 'build_put_model_as_string_no_required_one_value_default_request', + 'build_put_model_as_string_required_two_value_no_default_request', + 'build_put_model_as_string_required_two_value_default_request', + 'build_put_model_as_string_required_one_value_no_default_request', + 'build_put_model_as_string_required_one_value_default_request', + 'build_put_client_constants_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py index 7ce88232523..2337c4220ce 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py @@ -650,3 +650,4 @@ def build_put_client_constants_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py index f47bbc0389a..9d528928e6a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py @@ -17,7 +17,9 @@ def build_put_no_model_as_string_no_required_two_value_no_default_request( - *, input: Optional[str] = None, **kwargs: Any + *, + input: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -35,18 +37,25 @@ def build_put_no_model_as_string_no_required_two_value_no_default_request( """ # Construct URL - url = "/constants/putNoModelAsStringNoRequiredTwoValueNoDefault" + url = '/constants/putNoModelAsStringNoRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_no_model_as_string_no_required_two_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -64,18 +73,25 @@ def build_put_no_model_as_string_no_required_two_value_default_request( """ # Construct URL - url = "/constants/putNoModelAsStringNoRequiredTwoValueDefault" + url = '/constants/putNoModelAsStringNoRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_no_model_as_string_no_required_one_value_no_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -93,18 +109,25 @@ def build_put_no_model_as_string_no_required_one_value_no_default_request( """ # Construct URL - url = "/constants/putNoModelAsStringNoRequiredOneValueNoDefault" + url = '/constants/putNoModelAsStringNoRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_no_model_as_string_no_required_one_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -122,17 +145,26 @@ def build_put_no_model_as_string_no_required_one_value_default_request( """ # Construct URL - url = "/constants/putNoModelAsStringNoRequiredOneValueDefault" + url = '/constants/putNoModelAsStringNoRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_put_no_model_as_string_required_two_value_no_default_request(*, input: str, **kwargs: Any) -> HttpRequest: +def build_put_no_model_as_string_required_two_value_no_default_request( + *, + input: str, + **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -149,17 +181,24 @@ def build_put_no_model_as_string_required_two_value_no_default_request(*, input: """ # Construct URL - url = "/constants/putNoModelAsStringRequiredTwoValueNoDefault" + url = '/constants/putNoModelAsStringRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_no_model_as_string_required_two_value_default_request( - *, input: str = "value1", **kwargs: Any + *, + input: str = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -177,16 +216,23 @@ def build_put_no_model_as_string_required_two_value_default_request( """ # Construct URL - url = "/constants/putNoModelAsStringRequiredTwoValueDefault" + url = '/constants/putNoModelAsStringRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_put_no_model_as_string_required_one_value_no_default_request(**kwargs: Any) -> HttpRequest: +def build_put_no_model_as_string_required_one_value_no_default_request( + **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -203,19 +249,26 @@ def build_put_no_model_as_string_required_one_value_no_default_request(**kwargs: :rtype: ~azure.core.rest.HttpRequest """ - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str # Construct URL - url = "/constants/putNoModelAsStringRequiredOneValueNoDefault" + url = '/constants/putNoModelAsStringRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_put_no_model_as_string_required_one_value_default_request(**kwargs: Any) -> HttpRequest: +def build_put_no_model_as_string_required_one_value_default_request( + **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -232,20 +285,27 @@ def build_put_no_model_as_string_required_one_value_default_request(**kwargs: An :rtype: ~azure.core.rest.HttpRequest """ - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str # Construct URL - url = "/constants/putNoModelAsStringRequiredOneValueDefault" + url = '/constants/putNoModelAsStringRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_model_as_string_no_required_two_value_no_default_request( - *, input: Optional[str] = None, **kwargs: Any + *, + input: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -263,18 +323,25 @@ def build_put_model_as_string_no_required_two_value_no_default_request( """ # Construct URL - url = "/constants/putModelAsStringNoRequiredTwoValueNoDefault" + url = '/constants/putModelAsStringNoRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_model_as_string_no_required_two_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -292,18 +359,25 @@ def build_put_model_as_string_no_required_two_value_default_request( """ # Construct URL - url = "/constants/putModelAsStringNoRequiredTwoValueDefault" + url = '/constants/putModelAsStringNoRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_model_as_string_no_required_one_value_no_default_request( - *, input: Optional[str] = None, **kwargs: Any + *, + input: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -321,18 +395,25 @@ def build_put_model_as_string_no_required_one_value_no_default_request( """ # Construct URL - url = "/constants/putModelAsStringNoRequiredOneValueNoDefault" + url = '/constants/putModelAsStringNoRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_model_as_string_no_required_one_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -350,17 +431,26 @@ def build_put_model_as_string_no_required_one_value_default_request( """ # Construct URL - url = "/constants/putModelAsStringNoRequiredOneValueDefault" + url = '/constants/putModelAsStringNoRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_put_model_as_string_required_two_value_no_default_request(*, input: str, **kwargs: Any) -> HttpRequest: +def build_put_model_as_string_required_two_value_no_default_request( + *, + input: str, + **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -377,17 +467,24 @@ def build_put_model_as_string_required_two_value_no_default_request(*, input: st """ # Construct URL - url = "/constants/putModelAsStringRequiredTwoValueNoDefault" + url = '/constants/putModelAsStringRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_model_as_string_required_two_value_default_request( - *, input: str = "value1", **kwargs: Any + *, + input: str = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -405,16 +502,25 @@ def build_put_model_as_string_required_two_value_default_request( """ # Construct URL - url = "/constants/putModelAsStringRequiredTwoValueDefault" + url = '/constants/putModelAsStringRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_put_model_as_string_required_one_value_no_default_request(*, input: str, **kwargs: Any) -> HttpRequest: +def build_put_model_as_string_required_one_value_no_default_request( + *, + input: str, + **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -431,17 +537,24 @@ def build_put_model_as_string_required_one_value_no_default_request(*, input: st """ # Construct URL - url = "/constants/putModelAsStringRequiredOneValueNoDefault" + url = '/constants/putModelAsStringRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_put_model_as_string_required_one_value_default_request( - *, input: str = "value1", **kwargs: Any + *, + input: str = "value1", + **kwargs: Any ) -> HttpRequest: """Puts constants to the testserver. @@ -459,16 +572,23 @@ def build_put_model_as_string_required_one_value_default_request( """ # Construct URL - url = "/constants/putModelAsStringRequiredOneValueDefault" + url = '/constants/putModelAsStringRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_put_client_constants_request(**kwargs: Any) -> HttpRequest: +def build_put_client_constants_request( + **kwargs: Any +) -> HttpRequest: """Pass constants from the client to this function. Will pass in constant path, query, and header parameters. @@ -481,24 +601,31 @@ def build_put_client_constants_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str # Construct URL - url = "/constants/clientConstants/{path-constant}" + url = '/constants/clientConstants/{path-constant}' path_format_arguments = { - "path-constant": _SERIALIZER.url("path_constant", path_constant, "str"), + "path-constant": _SERIALIZER.url("path_constant", path_constant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["query-constant"] = _SERIALIZER.query("query_constant", query_constant, "int") + query_parameters['query-constant'] = _SERIALIZER.query("query_constant", query_constant, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["header-constant"] = _SERIALIZER.header("header_constant", header_constant, "bool") + header_parameters['header-constant'] = _SERIALIZER.header("header_constant", header_constant, 'bool') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/setup.py index 56088d4f1fe..5bad33ccda0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger Constant. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py index bcd7bcd9fec..6ef996852a7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py index 9f064aca224..91a77b59b4c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_auto_rest_parameterized_host_test_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -27,14 +26,19 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest @@ -62,7 +66,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py index 128274f962d..840dcb8cfa4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -24,25 +24,30 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py index 0fe5782d645..3b422c27c1d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient - -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py index b0a9260303c..abe7ade42be 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_auto_rest_parameterized_host_test_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -27,15 +26,24 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `custombaseurllowlevel.rest`. @@ -58,7 +66,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py index cf7cbb01aaf..789b6e8a4d7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedHostTestClientConfiguration(Configuration): +class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py index 5daa0aa077d..aa0aa1f1613 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_empty_request # type: ignore __all__ = [ - "build_get_empty_request", + 'build_get_empty_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py index 718db040ff1..3bf53989133 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py @@ -47,3 +47,4 @@ def build_get_empty_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py index 728ef604371..957ad8a3f6a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py @@ -13,7 +13,9 @@ _SERIALIZER = Serializer() -def build_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_request( + **kwargs: Any +) -> HttpRequest: """Get a 200 to test a valid base uri. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -27,10 +29,16 @@ def build_get_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/customuri" + url = '/customuri' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py index c250c733c08..63bc16d691a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/__init__.py index d7e63b40724..d8d75b9e768 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedCustomHostTestClient"] +__all__ = ['AutoRestParameterizedCustomHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_auto_rest_parameterized_custom_host_test_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_auto_rest_parameterized_custom_host_test_client.py index 2bde02690a0..9eeb211a161 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_auto_rest_parameterized_custom_host_test_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_auto_rest_parameterized_custom_host_test_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedCustomHostTestClient: """Test Infrastructure for AutoRest. @@ -30,17 +29,21 @@ class AutoRestParameterizedCustomHostTestClient: :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: - _endpoint = "{vault}{secret}{dnsSuffix}" - self._config = AutoRestParameterizedCustomHostTestClientConfiguration( - subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs - ) + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: + _endpoint = '{vault}{secret}{dnsSuffix}' + self._config = AutoRestParameterizedCustomHostTestClientConfiguration(subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest @@ -68,9 +71,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_configuration.py index 81ffb7c8afa..4f48e8e8f71 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): +class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedCustomHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -22,11 +22,17 @@ class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): :param subscription_id: The subscription id with value 'test12'. :type subscription_id: str - :param dns_suffix: A string value that is used as a global part of the parameterized host. Default value 'host'. + :param dns_suffix: A string value that is used as a global part of the parameterized host. + Default value 'host'. :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedCustomHostTestClientConfiguration, self).__init__(**kwargs) if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -35,19 +41,20 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self.subscription_id = subscription_id self.dns_suffix = dns_suffix - kwargs.setdefault("sdk_moniker", "autorestparameterizedcustomhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedcustomhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/__init__.py index 2a17c79123c..d3a3857329b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_custom_host_test_client import AutoRestParameterizedCustomHostTestClient - -__all__ = ["AutoRestParameterizedCustomHostTestClient"] +__all__ = ['AutoRestParameterizedCustomHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_auto_rest_parameterized_custom_host_test_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_auto_rest_parameterized_custom_host_test_client.py index f9a2420a954..07fc93d569a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_auto_rest_parameterized_custom_host_test_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_auto_rest_parameterized_custom_host_test_client.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedCustomHostTestClient: """Test Infrastructure for AutoRest. @@ -30,18 +29,26 @@ class AutoRestParameterizedCustomHostTestClient: :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: - _endpoint = "{vault}{secret}{dnsSuffix}" - self._config = AutoRestParameterizedCustomHostTestClientConfiguration( - subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs - ) + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: + _endpoint = '{vault}{secret}{dnsSuffix}' + self._config = AutoRestParameterizedCustomHostTestClientConfiguration(subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `custombaseurlmoreoptionslowlevel.rest`. @@ -64,9 +71,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_configuration.py index b99c9e62730..8e3df826b37 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): +class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedCustomHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -22,11 +22,17 @@ class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): :param subscription_id: The subscription id with value 'test12'. :type subscription_id: str - :param dns_suffix: A string value that is used as a global part of the parameterized host. Default value 'host'. + :param dns_suffix: A string value that is used as a global part of the parameterized host. + Default value 'host'. :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedCustomHostTestClientConfiguration, self).__init__(**kwargs) if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -35,16 +41,19 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self.subscription_id = subscription_id self.dns_suffix = dns_suffix - kwargs.setdefault("sdk_moniker", "autorestparameterizedcustomhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedcustomhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py index 5daa0aa077d..aa0aa1f1613 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_empty_request # type: ignore __all__ = [ - "build_get_empty_request", + 'build_get_empty_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py index d6fea273198..0d6a90f715a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py @@ -72,3 +72,4 @@ def build_get_empty_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py index 93c7133e6ee..188e8385735 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py @@ -17,7 +17,11 @@ def build_get_empty_request( - key_name: str, subscription_id: str, *, key_version: Optional[str] = "v1", **kwargs: Any + key_name: str, + subscription_id: str, + *, + key_version: Optional[str] = "v1", + **kwargs: Any ) -> HttpRequest: """Get a 200 to test a valid base uri. @@ -38,10 +42,10 @@ def build_get_empty_request( accept = "application/json" # Construct URL - url = "/customuri/{subscriptionId}/{keyName}" + url = '/customuri/{subscriptionId}/{keyName}' path_format_arguments = { - "keyName": _SERIALIZER.url("key_name", key_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "keyName": _SERIALIZER.url("key_name", key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -49,10 +53,17 @@ def build_get_empty_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if key_version is not None: - query_parameters["keyVersion"] = _SERIALIZER.query("key_version", key_version, "str") + query_parameters['keyVersion'] = _SERIALIZER.query("key_version", key_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/setup.py index d2c84ca63b8..633bfcb7cf4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/__init__.py index e0c77f64b36..28acd6da58d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["PetStoreInc"] +__all__ = ['PetStoreInc'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_configuration.py index db48107b56a..b50cc3d70f1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class PetStoreIncConfiguration(Configuration): +class PetStoreIncConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for PetStoreInc. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(PetStoreIncConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "petstoreinc/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'petstoreinc/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_pet_store_inc.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_pet_store_inc.py index eb655843b0d..daf4242a0b0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_pet_store_inc.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_pet_store_inc.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class PetStoreInc: """PetStore. @@ -27,8 +26,13 @@ class PetStoreInc: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = PetStoreIncConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/__init__.py index 98a70166f99..668e6ffc1a8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._pet_store_inc import PetStoreInc - -__all__ = ["PetStoreInc"] +__all__ = ['PetStoreInc'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_configuration.py index f20dc3de00b..b49c97d8170 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class PetStoreIncConfiguration(Configuration): +class PetStoreIncConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for PetStoreInc. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(PetStoreIncConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "petstoreinc/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'petstoreinc/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_pet_store_inc.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_pet_store_inc.py index 25317d3b57b..7e99c29faee 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_pet_store_inc.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/aio/_pet_store_inc.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class PetStoreInc: """PetStore. @@ -27,7 +26,12 @@ class PetStoreInc: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = PetStoreIncConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `extensibleenumsswaggerlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py index c2d46d43efe..e916fa01304 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_add_pet_request # type: ignore __all__ = [ - "build_get_by_pet_id_request", - "build_add_pet_request", + 'build_get_by_pet_id_request', + 'build_add_pet_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py index 72c4cf6e6f9..83a831de85d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py @@ -15,8 +15,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -46,7 +45,9 @@ def build_get_by_pet_id_request( # response body for status code(s): 200 response.json() == { - "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". Default value: "Friday". + "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. + Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", "Sunday". Default value: "Friday". "IntEnum": "str", # Required. Possible values include: "1", "2", "3". "name": "str" # Optional. name. } @@ -98,14 +99,18 @@ def build_add_pet_request( # JSON input template you can fill out and use as your body input. json = { - "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". Default value: "Friday". + "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. + Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", "Sunday". Default value: "Friday". "IntEnum": "str", # Required. Possible values include: "1", "2", "3". "name": "str" # Optional. name. } # response body for status code(s): 200 response.json() == { - "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". Default value: "Friday". + "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. + Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", "Sunday". Default value: "Friday". "IntEnum": "str", # Required. Possible values include: "1", "2", "3". "name": "str" # Optional. name. } @@ -129,3 +134,4 @@ def build_add_pet_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py index a8143ebdb13..4951c26d8bf 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py @@ -11,15 +11,17 @@ from msrest import Serializer from ..._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_by_pet_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: +def build_get_by_pet_id_request( + pet_id: str, + **kwargs: Any +) -> HttpRequest: """get pet by id. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -37,7 +39,9 @@ def build_get_by_pet_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". Default value: "Friday". + "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. + Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", "Sunday". Default value: "Friday". "IntEnum": "str", # Required. Possible values include: "1", "2", "3". "name": "str" # Optional. name. } @@ -45,21 +49,31 @@ def build_get_by_pet_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/extensibleenums/pet/{petId}" + url = '/extensibleenums/pet/{petId}' path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, "str"), + "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_add_pet_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_add_pet_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """add pet. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -81,29 +95,41 @@ def build_add_pet_request(*, json: JSONType = None, content: Any = None, **kwarg # JSON input template you can fill out and use as your body input. json = { - "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". Default value: "Friday". + "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. + Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", "Sunday". Default value: "Friday". "IntEnum": "str", # Required. Possible values include: "1", "2", "3". "name": "str" # Optional. name. } # response body for status code(s): 200 response.json() == { - "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". Default value: "Friday". + "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. + Possible values include: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", "Sunday". Default value: "Friday". "IntEnum": "str", # Required. Possible values include: "1", "2", "3". "name": "str" # Optional. name. } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/extensibleenums/pet/addPet" + url = '/extensibleenums/pet/addPet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/setup.py index a7ea89c9d01..e8dfe80d67d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ PetStore. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/__init__.py index 3fe0f0f8751..d10c57f2e46 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATHeaderService"] +__all__ = ['AutoRestSwaggerBATHeaderService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_auto_rest_swagger_bat_header_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_auto_rest_swagger_bat_header_service.py index 7dc53768937..451bac69b10 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_auto_rest_swagger_bat_header_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_auto_rest_swagger_bat_header_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATHeaderService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATHeaderService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATHeaderServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_configuration.py index ba4c2d7dbf9..5a3e89b090a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): +class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATHeaderService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATHeaderServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatheaderservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatheaderservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/__init__.py index cf7d0b372e7..2df70cd716b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_header_service import AutoRestSwaggerBATHeaderService - -__all__ = ["AutoRestSwaggerBATHeaderService"] +__all__ = ['AutoRestSwaggerBATHeaderService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_auto_rest_swagger_bat_header_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_auto_rest_swagger_bat_header_service.py index 91c547ee739..634ec7166b1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_auto_rest_swagger_bat_header_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_auto_rest_swagger_bat_header_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATHeaderService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATHeaderService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATHeaderServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `headerlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_configuration.py index d7e96d2334c..352eabee6af 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): +class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATHeaderService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATHeaderServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatheaderservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatheaderservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py index 62ca0400102..97a9d62a36a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py @@ -68,33 +68,33 @@ from ._request_builders import build_custom_request_id_request # type: ignore __all__ = [ - "build_param_existing_key_request", - "build_response_existing_key_request", - "build_param_protected_key_request", - "build_response_protected_key_request", - "build_param_integer_request", - "build_response_integer_request", - "build_param_long_request", - "build_response_long_request", - "build_param_float_request", - "build_response_float_request", - "build_param_double_request", - "build_response_double_request", - "build_param_bool_request", - "build_response_bool_request", - "build_param_string_request", - "build_response_string_request", - "build_param_date_request", - "build_response_date_request", - "build_param_datetime_request", - "build_response_datetime_request", - "build_param_datetime_rfc1123_request", - "build_response_datetime_rfc1123_request", - "build_param_duration_request", - "build_response_duration_request", - "build_param_byte_request", - "build_response_byte_request", - "build_param_enum_request", - "build_response_enum_request", - "build_custom_request_id_request", + 'build_param_existing_key_request', + 'build_response_existing_key_request', + 'build_param_protected_key_request', + 'build_response_protected_key_request', + 'build_param_integer_request', + 'build_response_integer_request', + 'build_param_long_request', + 'build_response_long_request', + 'build_param_float_request', + 'build_response_float_request', + 'build_param_double_request', + 'build_response_double_request', + 'build_param_bool_request', + 'build_response_bool_request', + 'build_param_string_request', + 'build_response_string_request', + 'build_param_date_request', + 'build_response_date_request', + 'build_param_datetime_request', + 'build_response_datetime_request', + 'build_param_datetime_rfc1123_request', + 'build_response_datetime_rfc1123_request', + 'build_param_duration_request', + 'build_response_duration_request', + 'build_param_byte_request', + 'build_response_byte_request', + 'build_param_enum_request', + 'build_response_enum_request', + 'build_custom_request_id_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py index 012a39da0de..1da6ebbfe00 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py @@ -1116,3 +1116,4 @@ def build_custom_request_id_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py index 857c44c5319..b14973bb3de 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py @@ -15,7 +15,11 @@ _SERIALIZER.client_side_validation = False -def build_param_existing_key_request(*, user_agent_parameter: str, **kwargs: Any) -> HttpRequest: +def build_param_existing_key_request( + *, + user_agent_parameter: str, + **kwargs: Any +) -> HttpRequest: """Send a post request with header value "User-Agent": "overwrite". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,17 +35,24 @@ def build_param_existing_key_request(*, user_agent_parameter: str, **kwargs: Any accept = "application/json" # Construct URL - url = "/header/param/existingkey" + url = '/header/param/existingkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["User-Agent"] = _SERIALIZER.header("user_agent_parameter", user_agent_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['User-Agent'] = _SERIALIZER.header("user_agent_parameter", user_agent_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_response_existing_key_request(**kwargs: Any) -> HttpRequest: +def build_response_existing_key_request( + **kwargs: Any +) -> HttpRequest: """Get a response with header value "User-Agent": "overwrite". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -55,16 +66,23 @@ def build_response_existing_key_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/existingkey" + url = '/header/response/existingkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_param_protected_key_request(**kwargs: Any) -> HttpRequest: +def build_param_protected_key_request( + **kwargs: Any +) -> HttpRequest: """Send a post request with header value "Content-Type": "text/html". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -76,21 +94,28 @@ def build_param_protected_key_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type") # type: str + content_type = kwargs.pop('content_type') # type: str accept = "application/json" # Construct URL - url = "/header/param/protectedkey" + url = '/header/param/protectedkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_response_protected_key_request(**kwargs: Any) -> HttpRequest: +def build_response_protected_key_request( + **kwargs: Any +) -> HttpRequest: """Get a response with header value "Content-Type": "text/html". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -104,16 +129,26 @@ def build_response_protected_key_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/protectedkey" + url = '/header/response/protectedkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_param_integer_request(*, scenario: str, value: int, **kwargs: Any) -> HttpRequest: +def build_param_integer_request( + *, + scenario: str, + value: int, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 1 or "scenario": "negative", "value": -2. @@ -132,18 +167,27 @@ def build_param_integer_request(*, scenario: str, value: int, **kwargs: Any) -> accept = "application/json" # Construct URL - url = "/header/param/prim/integer" + url = '/header/param/prim/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_integer_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_integer_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header value "value": 1 or -2. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -159,17 +203,27 @@ def build_response_integer_request(*, scenario: str, **kwargs: Any) -> HttpReque accept = "application/json" # Construct URL - url = "/header/response/prim/integer" + url = '/header/response/prim/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_long_request(*, scenario: str, value: int, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_long_request( + *, + scenario: str, + value: int, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 105 or "scenario": "negative", "value": -2. @@ -188,18 +242,27 @@ def build_param_long_request(*, scenario: str, value: int, **kwargs: Any) -> Htt accept = "application/json" # Construct URL - url = "/header/param/prim/long" + url = '/header/param/prim/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "long") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_long_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'long') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_long_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header value "value": 105 or -2. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -215,17 +278,27 @@ def build_response_long_request(*, scenario: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/long" + url = '/header/response/prim/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_float_request(*, scenario: str, value: float, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_float_request( + *, + scenario: str, + value: float, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": "negative", "value": -3.0. @@ -244,18 +317,27 @@ def build_param_float_request(*, scenario: str, value: float, **kwargs: Any) -> accept = "application/json" # Construct URL - url = "/header/param/prim/float" + url = '/header/param/prim/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "float") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_float_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'float') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_float_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header value "value": 0.07 or -3.0. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -271,17 +353,27 @@ def build_response_float_request(*, scenario: str, **kwargs: Any) -> HttpRequest accept = "application/json" # Construct URL - url = "/header/response/prim/float" + url = '/header/response/prim/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_double_request(*, scenario: str, value: float, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_double_request( + *, + scenario: str, + value: float, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": "negative", "value": -3.0. @@ -300,18 +392,27 @@ def build_param_double_request(*, scenario: str, value: float, **kwargs: Any) -> accept = "application/json" # Construct URL - url = "/header/param/prim/double" + url = '/header/param/prim/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "float") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_double_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'float') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_double_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header value "value": 7e120 or -3.0. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -327,17 +428,27 @@ def build_response_double_request(*, scenario: str, **kwargs: Any) -> HttpReques accept = "application/json" # Construct URL - url = "/header/response/prim/double" + url = '/header/response/prim/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_bool_request(*, scenario: str, value: bool, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_bool_request( + *, + scenario: str, + value: bool, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "true", "value": true or "scenario": "false", "value": false. @@ -356,18 +467,27 @@ def build_param_bool_request(*, scenario: str, value: bool, **kwargs: Any) -> Ht accept = "application/json" # Construct URL - url = "/header/param/prim/bool" + url = '/header/param/prim/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "bool") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_bool_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'bool') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_bool_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header value "value": true or false. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -383,17 +503,27 @@ def build_response_bool_request(*, scenario: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/bool" + url = '/header/response/prim/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_string_request(*, scenario: str, value: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_string_request( + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps over the lazy dog" or "scenario": "null", "value": null or "scenario": "empty", "value": "". @@ -414,19 +544,28 @@ def build_param_string_request(*, scenario: str, value: Optional[str] = None, ** accept = "application/json" # Construct URL - url = "/header/param/prim/string" + url = '/header/param/prim/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') if value is not None: - header_parameters["value"] = _SERIALIZER.header("value", value, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['value'] = _SERIALIZER.header("value", value, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_response_string_request(*, scenario: str, **kwargs: Any) -> HttpRequest: +def build_response_string_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -443,17 +582,27 @@ def build_response_string_request(*, scenario: str, **kwargs: Any) -> HttpReques accept = "application/json" # Construct URL - url = "/header/response/prim/string" + url = '/header/response/prim/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_date_request(*, scenario: str, value: datetime.date, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_date_request( + *, + scenario: str, + value: datetime.date, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "2010-01-01" or "scenario": "min", "value": "0001-01-01". @@ -472,18 +621,27 @@ def build_param_date_request(*, scenario: str, value: datetime.date, **kwargs: A accept = "application/json" # Construct URL - url = "/header/param/prim/date" + url = '/header/param/prim/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "date") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_date_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'date') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_date_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header values "2010-01-01" or "0001-01-01". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -499,17 +657,27 @@ def build_response_date_request(*, scenario: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/date" + url = '/header/response/prim/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_datetime_request(*, scenario: str, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_datetime_request( + *, + scenario: str, + value: datetime.datetime, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or "scenario": "min", "value": "0001-01-01T00:00:00Z". @@ -529,18 +697,27 @@ def build_param_datetime_request(*, scenario: str, value: datetime.datetime, **k accept = "application/json" # Construct URL - url = "/header/param/prim/datetime" + url = '/header/param/prim/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "iso-8601") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_datetime_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'iso-8601') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_datetime_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -556,18 +733,26 @@ def build_response_datetime_request(*, scenario: str, **kwargs: Any) -> HttpRequ accept = "application/json" # Construct URL - url = "/header/response/prim/datetime" + url = '/header/response/prim/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_param_datetime_rfc1123_request( - *, scenario: str, value: Optional[datetime.datetime] = None, **kwargs: Any + *, + scenario: str, + value: Optional[datetime.datetime] = None, + **kwargs: Any ) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 00:00:00 GMT". @@ -588,19 +773,28 @@ def build_param_datetime_rfc1123_request( accept = "application/json" # Construct URL - url = "/header/param/prim/datetimerfc1123" + url = '/header/param/prim/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') if value is not None: - header_parameters["value"] = _SERIALIZER.header("value", value, "rfc-1123") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['value'] = _SERIALIZER.header("value", value, 'rfc-1123') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_response_datetime_rfc1123_request(*, scenario: str, **kwargs: Any) -> HttpRequest: +def build_response_datetime_rfc1123_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT". @@ -617,17 +811,27 @@ def build_response_datetime_rfc1123_request(*, scenario: str, **kwargs: Any) -> accept = "application/json" # Construct URL - url = "/header/response/prim/datetimerfc1123" + url = '/header/response/prim/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_duration_request(*, scenario: str, value: datetime.timedelta, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_duration_request( + *, + scenario: str, + value: datetime.timedelta, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -645,18 +849,27 @@ def build_param_duration_request(*, scenario: str, value: datetime.timedelta, ** accept = "application/json" # Construct URL - url = "/header/param/prim/duration" + url = '/header/param/prim/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "duration") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_duration_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'duration') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_duration_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header values "P123DT22H14M12.011S". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -672,17 +885,27 @@ def build_response_duration_request(*, scenario: str, **kwargs: Any) -> HttpRequ accept = "application/json" # Construct URL - url = "/header/response/prim/duration" + url = '/header/response/prim/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_byte_request(*, scenario: str, value: bytearray, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_byte_request( + *, + scenario: str, + value: bytearray, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -700,18 +923,27 @@ def build_param_byte_request(*, scenario: str, value: bytearray, **kwargs: Any) accept = "application/json" # Construct URL - url = "/header/param/prim/byte" + url = '/header/param/prim/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "bytearray") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_response_byte_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'bytearray') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_response_byte_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header values "啊齄丂狛狜隣郎隣兀﨩". See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -727,17 +959,27 @@ def build_response_byte_request(*, scenario: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/byte" + url = '/header/response/prim/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_param_enum_request(*, scenario: str, value: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_param_enum_request( + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": "null", "value": null. @@ -758,19 +1000,28 @@ def build_param_enum_request(*, scenario: str, value: Optional[str] = None, **kw accept = "application/json" # Construct URL - url = "/header/param/prim/enum" + url = '/header/param/prim/enum' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') if value is not None: - header_parameters["value"] = _SERIALIZER.header("value", value, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['value'] = _SERIALIZER.header("value", value, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_response_enum_request(*, scenario: str, **kwargs: Any) -> HttpRequest: +def build_response_enum_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: """Get a response with header values "GREY" or null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -787,17 +1038,24 @@ def build_response_enum_request(*, scenario: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/enum" + url = '/header/response/prim/enum' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_custom_request_id_request(**kwargs: Any) -> HttpRequest: +def build_custom_request_id_request( + **kwargs: Any +) -> HttpRequest: """Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. @@ -812,10 +1070,16 @@ def build_custom_request_id_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0" + url = '/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/setup.py index 8749e54d402..ecf57c0041c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/__init__.py index 59e83504622..2272153c560 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHttpInfrastructureTestService"] +__all__ = ['AutoRestHttpInfrastructureTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_auto_rest_http_infrastructure_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_auto_rest_http_infrastructure_test_service.py index 2db00606ea1..c2d0ae0ff69 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_auto_rest_http_infrastructure_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_auto_rest_http_infrastructure_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestHttpInfrastructureTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestHttpInfrastructureTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestHttpInfrastructureTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_configuration.py index e88462f94c8..d9c88e34406 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): +class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHttpInfrastructureTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestHttpInfrastructureTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresthttpinfrastructuretestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresthttpinfrastructuretestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/__init__.py index b4c36fdfe1f..c0fbcc39764 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_http_infrastructure_test_service import AutoRestHttpInfrastructureTestService - -__all__ = ["AutoRestHttpInfrastructureTestService"] +__all__ = ['AutoRestHttpInfrastructureTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_auto_rest_http_infrastructure_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_auto_rest_http_infrastructure_test_service.py index bdf64648b3f..52b701a441f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_auto_rest_http_infrastructure_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_auto_rest_http_infrastructure_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestHttpInfrastructureTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestHttpInfrastructureTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestHttpInfrastructureTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `httpinfrastructurelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_configuration.py index 3e8df985edb..8751fa8fcae 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): +class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHttpInfrastructureTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestHttpInfrastructureTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresthttpinfrastructuretestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresthttpinfrastructuretestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py index 014c45ac99e..994ec14eff1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py @@ -62,30 +62,30 @@ from ._request_builders import build_head429_request # type: ignore __all__ = [ - "build_head400_request", - "build_get400_request", - "build_options400_request", - "build_put400_request", - "build_patch400_request", - "build_post400_request", - "build_delete400_request", - "build_head401_request", - "build_get402_request", - "build_options403_request", - "build_get403_request", - "build_put404_request", - "build_patch405_request", - "build_post406_request", - "build_delete407_request", - "build_put409_request", - "build_head410_request", - "build_get411_request", - "build_options412_request", - "build_get412_request", - "build_put413_request", - "build_patch414_request", - "build_post415_request", - "build_get416_request", - "build_delete417_request", - "build_head429_request", + 'build_head400_request', + 'build_get400_request', + 'build_options400_request', + 'build_put400_request', + 'build_patch400_request', + 'build_post400_request', + 'build_delete400_request', + 'build_head401_request', + 'build_get402_request', + 'build_options403_request', + 'build_get403_request', + 'build_put404_request', + 'build_patch405_request', + 'build_post406_request', + 'build_delete407_request', + 'build_put409_request', + 'build_head410_request', + 'build_get411_request', + 'build_options412_request', + 'build_get412_request', + 'build_put413_request', + 'build_patch414_request', + 'build_post415_request', + 'build_get416_request', + 'build_delete417_request', + 'build_head429_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py index 7a0de0cc7f8..861a100bdb6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -1034,3 +1033,4 @@ def build_head429_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py index a94b38d301d..8567733691b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_head400_request(**kwargs: Any) -> HttpRequest: +def build_head400_request( + **kwargs: Any +) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,23 @@ def build_head400_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get400_request(**kwargs: Any) -> HttpRequest: +def build_get400_request( + **kwargs: Any +) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -54,16 +62,23 @@ def build_get400_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_options400_request(**kwargs: Any) -> HttpRequest: +def build_options400_request( + **kwargs: Any +) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -77,16 +92,26 @@ def build_options400_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) - - -def build_put400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put400_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -110,22 +135,34 @@ def build_put400_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch400_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -149,22 +186,34 @@ def build_patch400_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post400_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -188,22 +237,34 @@ def build_post400_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete400_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete400_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -227,22 +288,31 @@ def build_delete400_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_head401_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_head401_request( + **kwargs: Any +) -> HttpRequest: """Return 401 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -256,16 +326,23 @@ def build_head401_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/401" + url = '/http/failure/client/401' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get402_request(**kwargs: Any) -> HttpRequest: +def build_get402_request( + **kwargs: Any +) -> HttpRequest: """Return 402 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -279,16 +356,23 @@ def build_get402_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/402" + url = '/http/failure/client/402' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_options403_request(**kwargs: Any) -> HttpRequest: +def build_options403_request( + **kwargs: Any +) -> HttpRequest: """Return 403 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -302,16 +386,23 @@ def build_options403_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/403" + url = '/http/failure/client/403' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get403_request(**kwargs: Any) -> HttpRequest: +def build_get403_request( + **kwargs: Any +) -> HttpRequest: """Return 403 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -325,16 +416,26 @@ def build_get403_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/403" + url = '/http/failure/client/403' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put404_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put404_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 404 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -358,22 +459,34 @@ def build_put404_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/404" + url = '/http/failure/client/404' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch405_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch405_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 405 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -397,22 +510,34 @@ def build_patch405_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/405" + url = '/http/failure/client/405' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post406_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post406_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 406 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -436,22 +561,34 @@ def build_post406_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/406" + url = '/http/failure/client/406' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete407_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete407_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 407 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -475,22 +612,34 @@ def build_delete407_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/407" + url = '/http/failure/client/407' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put409_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put409_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 409 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -514,22 +663,31 @@ def build_put409_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/409" + url = '/http/failure/client/409' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_head410_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_head410_request( + **kwargs: Any +) -> HttpRequest: """Return 410 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -543,16 +701,23 @@ def build_head410_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/410" + url = '/http/failure/client/410' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get411_request(**kwargs: Any) -> HttpRequest: +def build_get411_request( + **kwargs: Any +) -> HttpRequest: """Return 411 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -566,16 +731,23 @@ def build_get411_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/411" + url = '/http/failure/client/411' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_options412_request(**kwargs: Any) -> HttpRequest: +def build_options412_request( + **kwargs: Any +) -> HttpRequest: """Return 412 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -589,16 +761,23 @@ def build_options412_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/412" + url = '/http/failure/client/412' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get412_request(**kwargs: Any) -> HttpRequest: +def build_get412_request( + **kwargs: Any +) -> HttpRequest: """Return 412 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -612,16 +791,26 @@ def build_get412_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/412" + url = '/http/failure/client/412' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put413_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put413_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 413 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -645,22 +834,34 @@ def build_put413_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/413" + url = '/http/failure/client/413' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch414_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch414_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 414 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -684,22 +885,34 @@ def build_patch414_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/414" + url = '/http/failure/client/414' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post415_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post415_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 415 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -723,22 +936,31 @@ def build_post415_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/415" + url = '/http/failure/client/415' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get416_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get416_request( + **kwargs: Any +) -> HttpRequest: """Return 416 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -752,16 +974,26 @@ def build_get416_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/416" + url = '/http/failure/client/416' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_delete417_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_delete417_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 417 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -785,22 +1017,31 @@ def build_delete417_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/417" + url = '/http/failure/client/417' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_head429_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_head429_request( + **kwargs: Any +) -> HttpRequest: """Return 429 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -814,10 +1055,16 @@ def build_head429_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/429" + url = '/http/failure/client/429' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py index 9aa026c9102..1127331b7c8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_get_no_model_empty_request # type: ignore __all__ = [ - "build_get_empty_error_request", - "build_get_no_model_error_request", - "build_get_no_model_empty_request", + 'build_get_empty_error_request', + 'build_get_no_model_error_request', + 'build_get_no_model_empty_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py index ce0a7d61348..d494e9f45c0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py @@ -110,3 +110,4 @@ def build_get_no_model_empty_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py index 078a09800b2..017ac7081f1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER.client_side_validation = False -def build_get_empty_error_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_error_request( + **kwargs: Any +) -> HttpRequest: """Get empty error form server. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -28,16 +30,23 @@ def build_get_empty_error_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/emptybody/error" + url = '/http/failure/emptybody/error' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_no_model_error_request(**kwargs: Any) -> HttpRequest: +def build_get_no_model_error_request( + **kwargs: Any +) -> HttpRequest: """Get empty error form server. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -51,16 +60,23 @@ def build_get_no_model_error_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/nomodel/error" + url = '/http/failure/nomodel/error' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_no_model_empty_request(**kwargs: Any) -> HttpRequest: +def build_get_no_model_empty_request( + **kwargs: Any +) -> HttpRequest: """Get empty response from server. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -74,10 +90,16 @@ def build_get_no_model_empty_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/nomodel/empty" + url = '/http/failure/nomodel/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py index 32da62631a7..fc8fbc9bdc3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py @@ -42,20 +42,20 @@ from ._request_builders import build_delete307_request # type: ignore __all__ = [ - "build_head300_request", - "build_get300_request", - "build_head301_request", - "build_get301_request", - "build_put301_request", - "build_head302_request", - "build_get302_request", - "build_patch302_request", - "build_post303_request", - "build_head307_request", - "build_get307_request", - "build_options307_request", - "build_put307_request", - "build_patch307_request", - "build_post307_request", - "build_delete307_request", + 'build_head300_request', + 'build_get300_request', + 'build_head301_request', + 'build_get301_request', + 'build_put301_request', + 'build_head302_request', + 'build_get302_request', + 'build_patch302_request', + 'build_post303_request', + 'build_head307_request', + 'build_get307_request', + 'build_options307_request', + 'build_put307_request', + 'build_patch307_request', + 'build_post307_request', + 'build_delete307_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py index bd7cd196d91..2c06daef33c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -639,3 +638,4 @@ def build_delete307_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py index daef0bb10f1..0a223a2d34e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_head300_request(**kwargs: Any) -> HttpRequest: +def build_head300_request( + **kwargs: Any +) -> HttpRequest: """Return 300 status code and redirect to /http/success/200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,23 @@ def build_head300_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/300" + url = '/http/redirect/300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get300_request(**kwargs: Any) -> HttpRequest: +def build_get300_request( + **kwargs: Any +) -> HttpRequest: """Return 300 status code and redirect to /http/success/200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -62,16 +70,23 @@ def build_get300_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/300" + url = '/http/redirect/300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_head301_request(**kwargs: Any) -> HttpRequest: +def build_head301_request( + **kwargs: Any +) -> HttpRequest: """Return 301 status code and redirect to /http/success/200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -85,16 +100,23 @@ def build_head301_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/301" + url = '/http/redirect/301' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get301_request(**kwargs: Any) -> HttpRequest: +def build_get301_request( + **kwargs: Any +) -> HttpRequest: """Return 301 status code and redirect to /http/success/200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -108,16 +130,26 @@ def build_get301_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/301" + url = '/http/redirect/301' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put301_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put301_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 to the caller for evaluation. @@ -142,22 +174,31 @@ def build_put301_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/301" + url = '/http/redirect/301' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_head302_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_head302_request( + **kwargs: Any +) -> HttpRequest: """Return 302 status code and redirect to /http/success/200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -171,16 +212,23 @@ def build_head302_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/302" + url = '/http/redirect/302' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get302_request(**kwargs: Any) -> HttpRequest: +def build_get302_request( + **kwargs: Any +) -> HttpRequest: """Return 302 status code and redirect to /http/success/200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -194,16 +242,26 @@ def build_get302_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/302" + url = '/http/redirect/302' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_patch302_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_patch302_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation. @@ -228,22 +286,34 @@ def build_patch302_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/302" + url = '/http/redirect/302' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post303_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post303_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code. @@ -268,22 +338,31 @@ def build_post303_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/303" + url = '/http/redirect/303' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_head307_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_head307_request( + **kwargs: Any +) -> HttpRequest: """Redirect with 307, resulting in a 200 success. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -297,16 +376,23 @@ def build_head307_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get307_request(**kwargs: Any) -> HttpRequest: +def build_get307_request( + **kwargs: Any +) -> HttpRequest: """Redirect get with 307, resulting in a 200 success. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -320,16 +406,23 @@ def build_get307_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_options307_request(**kwargs: Any) -> HttpRequest: +def build_options307_request( + **kwargs: Any +) -> HttpRequest: """options redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -343,16 +436,26 @@ def build_options307_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) - - -def build_put307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -376,22 +479,34 @@ def build_put307_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Patch redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -415,22 +530,34 @@ def build_patch307_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Post redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -454,22 +581,34 @@ def build_post307_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Delete redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -493,16 +632,24 @@ def build_delete307_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py index c645a81dabd..cd3735ae5f0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py @@ -28,13 +28,13 @@ from ._request_builders import build_patch504_request # type: ignore __all__ = [ - "build_head408_request", - "build_put500_request", - "build_patch500_request", - "build_get502_request", - "build_options502_request", - "build_post503_request", - "build_delete503_request", - "build_put504_request", - "build_patch504_request", + 'build_head408_request', + 'build_put500_request', + 'build_patch500_request', + 'build_get502_request', + 'build_options502_request', + 'build_post503_request', + 'build_delete503_request', + 'build_put504_request', + 'build_patch504_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py index ef8306ed239..0fb4c416dd1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -395,3 +394,4 @@ def build_patch504_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py index 7924e870310..0be59e1319f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_head408_request(**kwargs: Any) -> HttpRequest: +def build_head408_request( + **kwargs: Any +) -> HttpRequest: """Return 408 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,26 @@ def build_head408_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/retry/408" + url = '/http/retry/408' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) - - -def build_put500_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put500_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 500 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -64,22 +75,34 @@ def build_put500_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/500" + url = '/http/retry/500' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch500_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch500_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 500 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -103,22 +126,31 @@ def build_patch500_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/500" + url = '/http/retry/500' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get502_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get502_request( + **kwargs: Any +) -> HttpRequest: """Return 502 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -132,16 +164,23 @@ def build_get502_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/retry/502" + url = '/http/retry/502' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_options502_request(**kwargs: Any) -> HttpRequest: +def build_options502_request( + **kwargs: Any +) -> HttpRequest: """Return 502 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -155,16 +194,26 @@ def build_options502_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/retry/502" + url = '/http/retry/502' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) - - -def build_post503_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_post503_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 503 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -188,22 +237,34 @@ def build_post503_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/503" + url = '/http/retry/503' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete503_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete503_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 503 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -227,22 +288,34 @@ def build_delete503_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/503" + url = '/http/retry/503' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put504_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put504_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 504 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -266,22 +339,34 @@ def build_put504_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/504" + url = '/http/retry/504' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch504_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch504_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 504 status code, then 200 after retry. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -305,16 +390,24 @@ def build_patch504_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/504" + url = '/http/retry/504' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py index 6c9509398a2..b3e489234fb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_delete505_request # type: ignore __all__ = [ - "build_head501_request", - "build_get501_request", - "build_post505_request", - "build_delete505_request", + 'build_head501_request', + 'build_get501_request', + 'build_post505_request', + 'build_delete505_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py index f866bcc8e7c..d3362352544 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -176,3 +175,4 @@ def build_delete505_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py index 97252af2eca..b0be9ea5eb3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_head501_request(**kwargs: Any) -> HttpRequest: +def build_head501_request( + **kwargs: Any +) -> HttpRequest: """Return 501 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,23 @@ def build_head501_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/server/501" + url = '/http/failure/server/501' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get501_request(**kwargs: Any) -> HttpRequest: +def build_get501_request( + **kwargs: Any +) -> HttpRequest: """Return 501 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -54,16 +62,26 @@ def build_get501_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/server/501" + url = '/http/failure/server/501' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_post505_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_post505_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 505 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -87,22 +105,34 @@ def build_post505_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/server/505" + url = '/http/failure/server/505' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete505_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete505_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Return 505 status code - should be represented in the client as an error. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -126,16 +156,24 @@ def build_delete505_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/server/505" + url = '/http/failure/server/505' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py index 6d355239b28..54a0d5d50f2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py @@ -48,23 +48,23 @@ from ._request_builders import build_head404_request # type: ignore __all__ = [ - "build_head200_request", - "build_get200_request", - "build_options200_request", - "build_put200_request", - "build_patch200_request", - "build_post200_request", - "build_delete200_request", - "build_put201_request", - "build_post201_request", - "build_put202_request", - "build_patch202_request", - "build_post202_request", - "build_delete202_request", - "build_head204_request", - "build_put204_request", - "build_patch204_request", - "build_post204_request", - "build_delete204_request", - "build_head404_request", + 'build_head200_request', + 'build_get200_request', + 'build_options200_request', + 'build_put200_request', + 'build_patch200_request', + 'build_post200_request', + 'build_delete200_request', + 'build_put201_request', + 'build_post201_request', + 'build_put202_request', + 'build_patch202_request', + 'build_post202_request', + 'build_delete202_request', + 'build_head204_request', + 'build_put204_request', + 'build_patch204_request', + 'build_post204_request', + 'build_delete204_request', + 'build_head404_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py index ec595be088b..81c0febee00 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -833,3 +832,4 @@ def build_head404_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py index a4eff06885d..075e454cf44 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_head200_request(**kwargs: Any) -> HttpRequest: +def build_head200_request( + **kwargs: Any +) -> HttpRequest: """Return 200 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,16 +32,23 @@ def build_head200_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_request(**kwargs: Any) -> HttpRequest: +def build_get200_request( + **kwargs: Any +) -> HttpRequest: """Get 200 success. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -54,16 +62,23 @@ def build_get200_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_options200_request(**kwargs: Any) -> HttpRequest: +def build_options200_request( + **kwargs: Any +) -> HttpRequest: """Options 200 success. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -77,16 +92,26 @@ def build_options200_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) - - -def build_put200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put boolean value true returning 200 success. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -110,22 +135,34 @@ def build_put200_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Patch true Boolean value in request returning 200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -149,22 +186,34 @@ def build_patch200_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Post bollean value true in request that returns a 200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -188,22 +237,34 @@ def build_post200_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Delete simple boolean value true returns 200. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -227,22 +288,34 @@ def build_delete200_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put201_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put201_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put true Boolean value in request returns 201. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -266,22 +339,34 @@ def build_put201_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/201" + url = '/http/success/201' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post201_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post201_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Post true Boolean value in request returns 201 (Created). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -305,22 +390,34 @@ def build_post201_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/201" + url = '/http/success/201' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put true Boolean value in request returns 202 (Accepted). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -344,22 +441,34 @@ def build_put202_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Patch true Boolean value in request returns 202. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -383,22 +492,34 @@ def build_patch202_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Post true Boolean value in request returns 202 (Accepted). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -422,22 +543,34 @@ def build_post202_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Delete true Boolean value in request returns 202 (accepted). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -461,22 +594,31 @@ def build_delete202_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_head204_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_head204_request( + **kwargs: Any +) -> HttpRequest: """Return 204 status code if successful. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -490,16 +632,26 @@ def build_head204_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) - - -def build_put204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -523,22 +675,34 @@ def build_put204_request(*, json: JSONType = None, content: Any = None, **kwargs json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_patch204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_patch204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Patch true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -562,22 +726,34 @@ def build_patch204_request(*, json: JSONType = None, content: Any = None, **kwar json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Post true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -601,22 +777,34 @@ def build_post204_request(*, json: JSONType = None, content: Any = None, **kwarg json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_delete204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Delete true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -640,22 +828,31 @@ def build_delete204_request(*, json: JSONType = None, content: Any = None, **kwa json = True # Optional. Default value is True. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_head404_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_head404_request( + **kwargs: Any +) -> HttpRequest: """Return 404 status code. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -669,10 +866,16 @@ def build_head404_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/404" + url = '/http/success/404' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py index 6a4f9bc9a49..50a463d4084 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py @@ -78,38 +78,38 @@ from ._request_builders import build_get200_model_a202_valid_request # type: ignore __all__ = [ - "build_get200_model204_no_model_default_error200_valid_request", - "build_get200_model204_no_model_default_error204_valid_request", - "build_get200_model204_no_model_default_error201_invalid_request", - "build_get200_model204_no_model_default_error202_none_request", - "build_get200_model204_no_model_default_error400_valid_request", - "build_get200_model201_model_default_error200_valid_request", - "build_get200_model201_model_default_error201_valid_request", - "build_get200_model201_model_default_error400_valid_request", - "build_get200_model_a201_model_c404_model_d_default_error200_valid_request", - "build_get200_model_a201_model_c404_model_d_default_error201_valid_request", - "build_get200_model_a201_model_c404_model_d_default_error404_valid_request", - "build_get200_model_a201_model_c404_model_d_default_error400_valid_request", - "build_get202_none204_none_default_error202_none_request", - "build_get202_none204_none_default_error204_none_request", - "build_get202_none204_none_default_error400_valid_request", - "build_get202_none204_none_default_none202_invalid_request", - "build_get202_none204_none_default_none204_none_request", - "build_get202_none204_none_default_none400_none_request", - "build_get202_none204_none_default_none400_invalid_request", - "build_get_default_model_a200_valid_request", - "build_get_default_model_a200_none_request", - "build_get_default_model_a400_valid_request", - "build_get_default_model_a400_none_request", - "build_get_default_none200_invalid_request", - "build_get_default_none200_none_request", - "build_get_default_none400_invalid_request", - "build_get_default_none400_none_request", - "build_get200_model_a200_none_request", - "build_get200_model_a200_valid_request", - "build_get200_model_a200_invalid_request", - "build_get200_model_a400_none_request", - "build_get200_model_a400_valid_request", - "build_get200_model_a400_invalid_request", - "build_get200_model_a202_valid_request", + 'build_get200_model204_no_model_default_error200_valid_request', + 'build_get200_model204_no_model_default_error204_valid_request', + 'build_get200_model204_no_model_default_error201_invalid_request', + 'build_get200_model204_no_model_default_error202_none_request', + 'build_get200_model204_no_model_default_error400_valid_request', + 'build_get200_model201_model_default_error200_valid_request', + 'build_get200_model201_model_default_error201_valid_request', + 'build_get200_model201_model_default_error400_valid_request', + 'build_get200_model_a201_model_c404_model_d_default_error200_valid_request', + 'build_get200_model_a201_model_c404_model_d_default_error201_valid_request', + 'build_get200_model_a201_model_c404_model_d_default_error404_valid_request', + 'build_get200_model_a201_model_c404_model_d_default_error400_valid_request', + 'build_get202_none204_none_default_error202_none_request', + 'build_get202_none204_none_default_error204_none_request', + 'build_get202_none204_none_default_error400_valid_request', + 'build_get202_none204_none_default_none202_invalid_request', + 'build_get202_none204_none_default_none204_none_request', + 'build_get202_none204_none_default_none400_none_request', + 'build_get202_none204_none_default_none400_invalid_request', + 'build_get_default_model_a200_valid_request', + 'build_get_default_model_a200_none_request', + 'build_get_default_model_a400_valid_request', + 'build_get_default_model_a400_none_request', + 'build_get_default_none200_invalid_request', + 'build_get_default_none200_none_request', + 'build_get_default_none400_invalid_request', + 'build_get_default_none400_none_request', + 'build_get200_model_a200_none_request', + 'build_get200_model_a200_valid_request', + 'build_get200_model_a200_invalid_request', + 'build_get200_model_a400_none_request', + 'build_get200_model_a400_valid_request', + 'build_get200_model_a400_invalid_request', + 'build_get200_model_a202_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py index f4122f67833..7cc9b13c3df 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py @@ -1239,3 +1239,4 @@ def build_get200_model_a202_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py index ae0ae62ba6c..a21a56b1f46 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER.client_side_validation = False -def build_get200_model204_no_model_default_error200_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model204_no_model_default_error200_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -36,16 +38,23 @@ def build_get200_model204_no_model_default_error200_valid_request(**kwargs: Any) accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/200/valid" + url = '/http/payloads/200/A/204/none/default/Error/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model204_no_model_default_error204_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model204_no_model_default_error204_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 204 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -67,16 +76,23 @@ def build_get200_model204_no_model_default_error204_valid_request(**kwargs: Any) accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/204/none" + url = '/http/payloads/200/A/204/none/default/Error/response/204/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model204_no_model_default_error201_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model204_no_model_default_error201_invalid_request( + **kwargs: Any +) -> HttpRequest: """Send a 201 response with valid payload: {'statusCode': '201'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -98,16 +114,23 @@ def build_get200_model204_no_model_default_error201_invalid_request(**kwargs: An accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/201/valid" + url = '/http/payloads/200/A/204/none/default/Error/response/201/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model204_no_model_default_error202_none_request(**kwargs: Any) -> HttpRequest: +def build_get200_model204_no_model_default_error202_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 202 response with no payload:. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -129,16 +152,23 @@ def build_get200_model204_no_model_default_error202_none_request(**kwargs: Any) accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/202/none" + url = '/http/payloads/200/A/204/none/default/Error/response/202/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model204_no_model_default_error400_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model204_no_model_default_error400_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -160,16 +190,23 @@ def build_get200_model204_no_model_default_error400_valid_request(**kwargs: Any) accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/400/valid" + url = '/http/payloads/200/A/204/none/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model201_model_default_error200_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model201_model_default_error200_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -196,16 +233,23 @@ def build_get200_model201_model_default_error200_valid_request(**kwargs: Any) -> accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/B/default/Error/response/200/valid" + url = '/http/payloads/200/A/201/B/default/Error/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model201_model_default_error201_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model201_model_default_error201_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -232,16 +276,23 @@ def build_get200_model201_model_default_error201_valid_request(**kwargs: Any) -> accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/B/default/Error/response/201/valid" + url = '/http/payloads/200/A/201/B/default/Error/response/201/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model201_model_default_error400_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model201_model_default_error400_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -268,16 +319,23 @@ def build_get200_model201_model_default_error400_valid_request(**kwargs: Any) -> accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/B/default/Error/response/400/valid" + url = '/http/payloads/200/A/201/B/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a201_model_c404_model_d_default_error200_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a201_model_c404_model_d_default_error200_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -307,16 +365,23 @@ def build_get200_model_a201_model_c404_model_d_default_error200_valid_request(** accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a201_model_c404_model_d_default_error201_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a201_model_c404_model_d_default_error201_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with valid payload: {'httpCode': '201'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -346,16 +411,23 @@ def build_get200_model_a201_model_c404_model_d_default_error201_valid_request(** accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a201_model_c404_model_d_default_error404_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a201_model_c404_model_d_default_error404_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with valid payload: {'httpStatusCode': '404'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -385,16 +457,23 @@ def build_get200_model_a201_model_c404_model_d_default_error404_valid_request(** accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a201_model_c404_model_d_default_error400_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a201_model_c404_model_d_default_error400_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -424,16 +503,23 @@ def build_get200_model_a201_model_c404_model_d_default_error400_valid_request(** accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get202_none204_none_default_error202_none_request(**kwargs: Any) -> HttpRequest: +def build_get202_none204_none_default_error202_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 202 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -447,16 +533,23 @@ def build_get202_none204_none_default_error202_none_request(**kwargs: Any) -> Ht accept = "application/json" # Construct URL - url = "/http/payloads/202/none/204/none/default/Error/response/202/none" + url = '/http/payloads/202/none/204/none/default/Error/response/202/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get202_none204_none_default_error204_none_request(**kwargs: Any) -> HttpRequest: +def build_get202_none204_none_default_error204_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 204 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -470,16 +563,23 @@ def build_get202_none204_none_default_error204_none_request(**kwargs: Any) -> Ht accept = "application/json" # Construct URL - url = "/http/payloads/202/none/204/none/default/Error/response/204/none" + url = '/http/payloads/202/none/204/none/default/Error/response/204/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get202_none204_none_default_error400_valid_request(**kwargs: Any) -> HttpRequest: +def build_get202_none204_none_default_error400_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -493,16 +593,23 @@ def build_get202_none204_none_default_error400_valid_request(**kwargs: Any) -> H accept = "application/json" # Construct URL - url = "/http/payloads/202/none/204/none/default/Error/response/400/valid" + url = '/http/payloads/202/none/204/none/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get202_none204_none_default_none202_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get202_none204_none_default_none202_invalid_request( + **kwargs: Any +) -> HttpRequest: """Send a 202 response with an unexpected payload {'property': 'value'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -515,12 +622,18 @@ def build_get202_none204_none_default_none202_invalid_request(**kwargs: Any) -> """ # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/202/invalid" + url = '/http/payloads/202/none/204/none/default/none/response/202/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get202_none204_none_default_none204_none_request(**kwargs: Any) -> HttpRequest: +def build_get202_none204_none_default_none204_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 204 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -533,12 +646,18 @@ def build_get202_none204_none_default_none204_none_request(**kwargs: Any) -> Htt """ # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/204/none" + url = '/http/payloads/202/none/204/none/default/none/response/204/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get202_none204_none_default_none400_none_request(**kwargs: Any) -> HttpRequest: +def build_get202_none204_none_default_none400_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -551,12 +670,18 @@ def build_get202_none204_none_default_none400_none_request(**kwargs: Any) -> Htt """ # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/400/none" + url = '/http/payloads/202/none/204/none/default/none/response/400/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get202_none204_none_default_none400_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get202_none204_none_default_none400_invalid_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with an unexpected payload {'property': 'value'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -569,12 +694,18 @@ def build_get202_none204_none_default_none400_invalid_request(**kwargs: Any) -> """ # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/400/invalid" + url = '/http/payloads/202/none/204/none/default/none/response/400/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get_default_model_a200_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_default_model_a200_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -596,16 +727,23 @@ def build_get_default_model_a200_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/200/valid" + url = '/http/payloads/default/A/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_default_model_a200_none_request(**kwargs: Any) -> HttpRequest: +def build_get_default_model_a200_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -627,16 +765,23 @@ def build_get_default_model_a200_none_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/200/none" + url = '/http/payloads/default/A/response/200/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_default_model_a400_valid_request(**kwargs: Any) -> HttpRequest: +def build_get_default_model_a400_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with valid payload: {'statusCode': '400'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -650,16 +795,23 @@ def build_get_default_model_a400_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/400/valid" + url = '/http/payloads/default/A/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_default_model_a400_none_request(**kwargs: Any) -> HttpRequest: +def build_get_default_model_a400_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -673,16 +825,23 @@ def build_get_default_model_a400_none_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/400/none" + url = '/http/payloads/default/A/response/400/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_default_none200_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_default_none200_invalid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with invalid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -695,12 +854,18 @@ def build_get_default_none200_invalid_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/payloads/default/none/response/200/invalid" + url = '/http/payloads/default/none/response/200/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get_default_none200_none_request(**kwargs: Any) -> HttpRequest: +def build_get_default_none200_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -713,12 +878,18 @@ def build_get_default_none200_none_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/payloads/default/none/response/200/none" + url = '/http/payloads/default/none/response/200/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get_default_none400_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get_default_none400_invalid_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with valid payload: {'statusCode': '400'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -731,12 +902,18 @@ def build_get_default_none400_invalid_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/payloads/default/none/response/400/invalid" + url = '/http/payloads/default/none/response/400/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get_default_none400_none_request(**kwargs: Any) -> HttpRequest: +def build_get_default_none400_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with no payload. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -749,12 +926,18 @@ def build_get_default_none400_none_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/http/payloads/default/none/response/400/none" + url = '/http/payloads/default/none/response/400/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get200_model_a200_none_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a200_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A. @@ -777,16 +960,23 @@ def build_get200_model_a200_none_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/200/none" + url = '/http/payloads/200/A/response/200/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a200_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a200_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with payload {'statusCode': '200'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -808,16 +998,23 @@ def build_get200_model_a200_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/200/valid" + url = '/http/payloads/200/A/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a200_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a200_invalid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -839,16 +1036,23 @@ def build_get200_model_a200_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/200/invalid" + url = '/http/payloads/200/A/response/200/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a400_none_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a400_none_request( + **kwargs: Any +) -> HttpRequest: """Send a 400 response with no payload client should treat as an http error with no error model. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -870,16 +1074,23 @@ def build_get200_model_a400_none_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/400/none" + url = '/http/payloads/200/A/response/400/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a400_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a400_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with payload {'statusCode': '400'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -901,16 +1112,23 @@ def build_get200_model_a400_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/400/valid" + url = '/http/payloads/200/A/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a400_invalid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a400_invalid_request( + **kwargs: Any +) -> HttpRequest: """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -932,16 +1150,23 @@ def build_get200_model_a400_invalid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/400/invalid" + url = '/http/payloads/200/A/response/400/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get200_model_a202_valid_request(**kwargs: Any) -> HttpRequest: +def build_get200_model_a202_valid_request( + **kwargs: Any +) -> HttpRequest: """Send a 202 response with payload {'statusCode': '202'}. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -963,10 +1188,16 @@ def build_get200_model_a202_valid_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/202/valid" + url = '/http/payloads/200/A/response/202/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/setup.py index 69f380ec95e..af804916116 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/__init__.py index f4cc0652a6a..327d291fc6e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["IncorrectReturnedErrorModel"] +__all__ = ['IncorrectReturnedErrorModel'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_configuration.py index 3d38c91d7f8..23d9c22f926 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class IncorrectReturnedErrorModelConfiguration(Configuration): +class IncorrectReturnedErrorModelConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IncorrectReturnedErrorModel. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(IncorrectReturnedErrorModelConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "incorrectreturnederrormodel/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'incorrectreturnederrormodel/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_incorrect_returned_error_model.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_incorrect_returned_error_model.py index 063941fadd1..5f2f741f756 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_incorrect_returned_error_model.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_incorrect_returned_error_model.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,16 +19,21 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class IncorrectReturnedErrorModel: - """Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. + """Test to see when throwing an HttpResponseError whether we swallow error model deserialization + errors. :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = IncorrectReturnedErrorModelConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/__init__.py index 2a4a1d94e74..13d865896d6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._incorrect_returned_error_model import IncorrectReturnedErrorModel - -__all__ = ["IncorrectReturnedErrorModel"] +__all__ = ['IncorrectReturnedErrorModel'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_configuration.py index 556842de3fd..f1b3366ed98 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class IncorrectReturnedErrorModelConfiguration(Configuration): +class IncorrectReturnedErrorModelConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for IncorrectReturnedErrorModel. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(IncorrectReturnedErrorModelConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "incorrectreturnederrormodel/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'incorrectreturnederrormodel/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_incorrect_returned_error_model.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_incorrect_returned_error_model.py index b740bb63c7f..e4ee7fad4b1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_incorrect_returned_error_model.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/aio/_incorrect_returned_error_model.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,15 +19,20 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class IncorrectReturnedErrorModel: - """Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. + """Test to see when throwing an HttpResponseError whether we swallow error model deserialization + errors. :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = IncorrectReturnedErrorModelConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `incorrecterrorresponselowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py index dc1410e2374..7ae91496475 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_incorrect_error_from_server_request # type: ignore __all__ = [ - "build_get_incorrect_error_from_server_request", + 'build_get_incorrect_error_from_server_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py index 2edb0a8b7e1..349cc1da4c4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py @@ -43,3 +43,4 @@ def build_get_incorrect_error_from_server_request( url=url, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py index e0fee70dfe2..02e1859b228 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER.client_side_validation = False -def build_get_incorrect_error_from_server_request(**kwargs: Any) -> HttpRequest: +def build_get_incorrect_error_from_server_request( + **kwargs: Any +) -> HttpRequest: """Get an error response from the server that is not as described in our Error object. Want to swallow the deserialization error and still return an HttpResponseError to the users. @@ -28,6 +30,11 @@ def build_get_incorrect_error_from_server_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/incorrectError" + url = '/incorrectError' + + return HttpRequest( + method="GET", + url=url, + **kwargs + ) - return HttpRequest(method="GET", url=url, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/setup.py index 883660291b0..c15c8094059 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/__init__.py index d92d78cce53..cf828cedf2d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MediaTypesClient"] +__all__ = ['MediaTypesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_configuration.py index eba56985c57..e16ea21bfda 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class MediaTypesClientConfiguration(Configuration): +class MediaTypesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MediaTypesClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MediaTypesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mediatypesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mediatypesclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_media_types_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_media_types_client.py index 3593c9a66f4..12add9a31a1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_media_types_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_media_types_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MediaTypesClient: """Play with produces/consumes and media-types in general. @@ -27,8 +26,13 @@ class MediaTypesClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = MediaTypesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/__init__.py index f0f38f71e24..647fe0041e3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._media_types_client import MediaTypesClient - -__all__ = ["MediaTypesClient"] +__all__ = ['MediaTypesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_configuration.py index 4048232998c..03eeae896ad 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class MediaTypesClientConfiguration(Configuration): +class MediaTypesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MediaTypesClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MediaTypesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mediatypesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mediatypesclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_media_types_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_media_types_client.py index 0c5adde84c1..4c50c2ec48d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_media_types_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/aio/_media_types_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MediaTypesClient: """Play with produces/consumes and media-types in general. @@ -27,7 +26,12 @@ class MediaTypesClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MediaTypesClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `mediatypeslowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py index 9486a1d36b8..447c67773ca 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py @@ -22,10 +22,10 @@ from ._request_builders import build_put_text_and_json_body_request # type: ignore __all__ = [ - "build_analyze_body_request", - "build_analyze_body_no_accept_header_request", - "build_content_type_with_encoding_request", - "build_binary_body_with_two_content_types_request", - "build_binary_body_with_three_content_types_request", - "build_put_text_and_json_body_request", + 'build_analyze_body_request', + 'build_analyze_body_no_accept_header_request', + 'build_content_type_with_encoding_request', + 'build_binary_body_with_two_content_types_request', + 'build_binary_body_with_three_content_types_request', + 'build_put_text_and_json_body_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py index 88d9af91073..06dd59a13b1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, Optional, TypeVar, Union - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar, Union + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -306,3 +305,4 @@ def build_put_text_and_json_body_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py index e093284d80c..9cae8064427 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py @@ -5,19 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, Optional, TypeVar, Union +from typing import Any, Dict, Optional, TypeVar, Union from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_analyze_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_analyze_body_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Analyze body, that could be different media types. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -44,23 +48,33 @@ def build_analyze_body_request(*, json: JSONType = None, content: Any = None, ** json = b'bytes' # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/mediatypes/analyze" + url = '/mediatypes/analyze' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_analyze_body_no_accept_header_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -89,20 +103,31 @@ def build_analyze_body_no_accept_header_request( json = b'bytes' # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/mediatypes/analyzeNoAccept" + url = '/mediatypes/analyzeNoAccept' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_content_type_with_encoding_request(*, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_content_type_with_encoding_request( + *, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Pass in contentType 'text/plain; charset=UTF-8' to pass test. Value for input does not matter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -117,23 +142,32 @@ def build_content_type_with_encoding_request(*, content: Any = None, **kwargs: A :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/mediatypes/contentTypeWithEncoding" + url = '/mediatypes/contentTypeWithEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_binary_body_with_two_content_types_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream. @@ -159,23 +193,33 @@ def build_binary_body_with_two_content_types_request( json = b'bytes' # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "text/plain" # Construct URL - url = "/mediatypes/binaryBodyTwoContentTypes" + url = '/mediatypes/binaryBodyTwoContentTypes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_binary_body_with_three_content_types_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Binary body with three content types. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for @@ -205,22 +249,34 @@ def build_binary_body_with_three_content_types_request( json = b'bytes' # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "text/plain" # Construct URL - url = "/mediatypes/binaryBodyThreeContentTypes" + url = '/mediatypes/binaryBodyThreeContentTypes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_text_and_json_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_text_and_json_body_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Body that's either text/plain or application/json. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -246,16 +302,24 @@ def build_put_text_and_json_body_request(*, json: JSONType = None, content: Any json = "str" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "text/plain" # Construct URL - url = "/mediatypes/textAndJson" + url = '/mediatypes/textAndJson' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/setup.py index 5c8489e8153..ca942bf04fb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Play with produces/consumes and media-types in general. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/__init__.py index 3195481e948..abe8ddc2864 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MergePatchJsonClient"] +__all__ = ['MergePatchJsonClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_configuration.py index b31020fdb87..03b1420e448 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class MergePatchJsonClientConfiguration(Configuration): +class MergePatchJsonClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MergePatchJsonClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MergePatchJsonClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mergepatchjsonclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mergepatchjsonclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_merge_patch_json_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_merge_patch_json_client.py index 8352217a63b..b90f673ce25 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_merge_patch_json_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_merge_patch_json_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MergePatchJsonClient: """Service client for testing merge patch json. @@ -27,8 +26,13 @@ class MergePatchJsonClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = MergePatchJsonClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_object_type_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_object_type_client.py deleted file mode 100644 index 73f0dc13be7..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_object_type_client.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING - -from azure.core import PipelineClient -from azure.core.rest import HttpRequest, HttpResponse -from msrest import Deserializer, Serializer - -from ._configuration import ObjectTypeClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Dict - - -class ObjectTypeClient: - """Service client for testing basic type: object swaggers. - - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. - :paramtype endpoint: str - """ - - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - - self._config = ObjectTypeClientConfiguration(**kwargs) - self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request( - self, - request, # type: HttpRequest - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - We have helper methods to create requests specific to this service in `mergepatchjsonlowlevel.rest`. - Use these helper methods to create the request you pass to this method. - - >>> from mergepatchjsonlowlevel.rest import build_patch_single_request - >>> request = build_patch_single_request(json=json, content=content, **kwargs) - - >>> response = client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> ObjectTypeClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/__init__.py index 350a9ddb952..bd5eb1ce33d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._merge_patch_json_client import MergePatchJsonClient - -__all__ = ["MergePatchJsonClient"] +__all__ = ['MergePatchJsonClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_configuration.py index 89b78fceea2..b163ea72dd7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class MergePatchJsonClientConfiguration(Configuration): +class MergePatchJsonClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MergePatchJsonClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MergePatchJsonClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mergepatchjsonclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mergepatchjsonclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_merge_patch_json_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_merge_patch_json_client.py index 9c5dece37e4..995dde2b50c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_merge_patch_json_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_merge_patch_json_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MergePatchJsonClient: """Service client for testing merge patch json. @@ -27,7 +26,12 @@ class MergePatchJsonClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MergePatchJsonClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `mergepatchjsonlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_object_type_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_object_type_client.py deleted file mode 100644 index 9a7e4ecd93b..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/aio/_object_type_client.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING - -from azure.core import AsyncPipelineClient -from azure.core.rest import AsyncHttpResponse, HttpRequest -from msrest import Deserializer, Serializer - -from ._configuration import ObjectTypeClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Dict - - -class ObjectTypeClient: - """Service client for testing basic type: object swaggers. - - :keyword endpoint: Service URL. Default value is 'http://localhost:3000'. - :paramtype endpoint: str - """ - - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = ObjectTypeClientConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) - - self._serialize = Serializer() - self._deserialize = Deserializer() - self._serialize.client_side_validation = False - - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - We have helper methods to create requests specific to this service in `mergepatchjsonlowlevel.rest`. - Use these helper methods to create the request you pass to this method. - - >>> from mergepatchjsonlowlevel.rest import build_patch_single_request - >>> request = build_patch_single_request(json=json, content=content, **kwargs) - - >>> response = await client.send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ObjectTypeClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py index aa5ee9fff29..1a5affdc389 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_patch_single_request # type: ignore __all__ = [ - "build_patch_single_request", + 'build_patch_single_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py index 7bc9de19ecb..8a79f7d5bfe 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -69,3 +68,4 @@ def build_patch_single_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py index 3aca61c2185..4f58431d365 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py @@ -9,15 +9,19 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_patch_single_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_patch_single_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Basic patch with an object. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -43,16 +47,24 @@ def build_patch_single_request(*, json: JSONType = None, content: Any = None, ** json = {} # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/mergePatchJson/single" + url = '/mergePatchJson/single' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/setup.py index 4b34ab99a32..01a8c8d1749 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing merge patch json. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/__init__.py index 52cd05a592d..dd34ba75521 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestResourceFlatteningTestService"] +__all__ = ['AutoRestResourceFlatteningTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_auto_rest_resource_flattening_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_auto_rest_resource_flattening_test_service.py index 7342b94dc44..b1938bf6c28 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_auto_rest_resource_flattening_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_auto_rest_resource_flattening_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestResourceFlatteningTestService: """Resource Flattening for AutoRest. @@ -27,8 +26,13 @@ class AutoRestResourceFlatteningTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestResourceFlatteningTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_configuration.py index bc7007dfa73..f8a79cfd7d8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): +class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestResourceFlatteningTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestResourceFlatteningTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestresourceflatteningtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestresourceflatteningtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/__init__.py index 0063e0ded58..86f206c8bec 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_resource_flattening_test_service import AutoRestResourceFlatteningTestService - -__all__ = ["AutoRestResourceFlatteningTestService"] +__all__ = ['AutoRestResourceFlatteningTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_auto_rest_resource_flattening_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_auto_rest_resource_flattening_test_service.py index cf325edc0b2..43131559379 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_auto_rest_resource_flattening_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_auto_rest_resource_flattening_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestResourceFlatteningTestService: """Resource Flattening for AutoRest. @@ -27,7 +26,12 @@ class AutoRestResourceFlatteningTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestResourceFlatteningTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `modelflatteninglowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_configuration.py index c4cc1600aaf..dc0f961acfb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): +class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestResourceFlatteningTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestResourceFlatteningTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestresourceflatteningtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestresourceflatteningtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py index f56a51a7756..3f1714a2d42 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py @@ -32,15 +32,15 @@ from ._request_builders import build_put_simple_product_with_grouping_request # type: ignore __all__ = [ - "build_put_array_request", - "build_get_array_request", - "build_put_wrapped_array_request", - "build_get_wrapped_array_request", - "build_put_dictionary_request", - "build_get_dictionary_request", - "build_put_resource_collection_request", - "build_get_resource_collection_request", - "build_put_simple_product_request", - "build_post_flattened_simple_product_request", - "build_put_simple_product_with_grouping_request", + 'build_put_array_request', + 'build_get_array_request', + 'build_put_wrapped_array_request', + 'build_get_wrapped_array_request', + 'build_put_dictionary_request', + 'build_get_dictionary_request', + 'build_put_resource_collection_request', + 'build_get_resource_collection_request', + 'build_put_simple_product_request', + 'build_post_flattened_simple_product_request', + 'build_put_simple_product_with_grouping_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py index 32fab5cd388..ceff1628df0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py @@ -14,9 +14,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -54,7 +53,8 @@ def build_put_array_request( "location": "str", # Optional. Resource Location. "name": "str", # Optional. Resource Name. "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -107,11 +107,15 @@ def build_get_array_request( "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -262,11 +266,15 @@ def build_put_dictionary_request( "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -319,11 +327,15 @@ def build_get_dictionary_request( "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -379,11 +391,15 @@ def build_put_resource_collection_request( "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -394,13 +410,20 @@ def build_put_resource_collection_request( "location": "str", # Optional. Resource Location. "name": "str", # Optional. Resource Name. "properties": { - "p.name": "str", # Optional. Dictionary of :code:``. - "provisioningState": "str", # Optional. Dictionary of :code:``. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". - "type": "str" # Optional. Dictionary of :code:``. + "p.name": "str", # Optional. Dictionary of + :code:``. + "provisioningState": "str", # Optional. Dictionary + of :code:``. + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". + "type": "str" # Optional. Dictionary of + :code:``. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -412,11 +435,15 @@ def build_put_resource_collection_request( "properties": { "p.name": "str", # Optional. Flattened product. "provisioningState": "str", # Optional. Flattened product. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. Flattened product. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -470,11 +497,15 @@ def build_get_resource_collection_request( "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -485,13 +516,20 @@ def build_get_resource_collection_request( "location": "str", # Optional. Resource Location. "name": "str", # Optional. Resource Name. "properties": { - "p.name": "str", # Optional. Dictionary of :code:``. - "provisioningState": "str", # Optional. Dictionary of :code:``. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". - "type": "str" # Optional. Dictionary of :code:``. + "p.name": "str", # Optional. Dictionary of + :code:``. + "provisioningState": "str", # Optional. Dictionary + of :code:``. + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". + "type": "str" # Optional. Dictionary of + :code:``. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -503,11 +541,15 @@ def build_get_resource_collection_request( "properties": { "p.name": "str", # Optional. Flattened product. "provisioningState": "str", # Optional. Flattened product. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. Flattened product. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -556,10 +598,14 @@ def build_put_simple_product_request( # JSON input template you can fill out and use as your body input. json = { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -570,10 +616,14 @@ def build_put_simple_product_request( # response body for status code(s): 200 response.json() == { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -628,10 +678,14 @@ def build_post_flattened_simple_product_request( # JSON input template you can fill out and use as your body input. json = { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -642,10 +696,14 @@ def build_post_flattened_simple_product_request( # response body for status code(s): 200 response.json() == { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -703,10 +761,14 @@ def build_put_simple_product_with_grouping_request( # JSON input template you can fill out and use as your body input. json = { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -717,10 +779,14 @@ def build_put_simple_product_with_grouping_request( # response body for status code(s): 200 response.json() == { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -752,3 +818,4 @@ def build_put_simple_product_with_grouping_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py index 3fb13fe18ff..cad0e36374a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py @@ -5,21 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, List, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_array_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put External Resource as an Array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -46,29 +50,39 @@ def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwa "location": "str", # Optional. Resource Location. "name": "str", # Optional. Resource Name. "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/array" + url = '/model-flatten/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_array_request(**kwargs: Any) -> HttpRequest: +def build_get_array_request( + **kwargs: Any +) -> HttpRequest: """Get External Resource as an Array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -91,11 +105,15 @@ def build_get_array_request(**kwargs: Any) -> HttpRequest: "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -104,16 +122,26 @@ def build_get_array_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/array" + url = '/model-flatten/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_wrapped_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_wrapped_array_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -142,22 +170,31 @@ def build_put_wrapped_array_request(*, json: JSONType = None, content: Any = Non ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/wrappedarray" + url = '/model-flatten/wrappedarray' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_wrapped_array_request(**kwargs: Any) -> HttpRequest: +def build_get_wrapped_array_request( + **kwargs: Any +) -> HttpRequest: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -184,16 +221,26 @@ def build_get_wrapped_array_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/wrappedarray" + url = '/model-flatten/wrappedarray' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_dictionary_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_dictionary_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put External Resource as a Dictionary. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -222,33 +269,46 @@ def build_put_dictionary_request(*, json: JSONType = None, content: Any = None, "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/dictionary" + url = '/model-flatten/dictionary' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_dictionary_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_request( + **kwargs: Any +) -> HttpRequest: """Get External Resource as a Dictionary. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -271,11 +331,15 @@ def build_get_dictionary_request(**kwargs: Any) -> HttpRequest: "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -284,16 +348,26 @@ def build_get_dictionary_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/dictionary" + url = '/model-flatten/dictionary' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_resource_collection_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_resource_collection_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put External Resource as a ResourceCollection. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -323,11 +397,15 @@ def build_put_resource_collection_request(*, json: JSONType = None, content: Any "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -338,13 +416,20 @@ def build_put_resource_collection_request(*, json: JSONType = None, content: Any "location": "str", # Optional. Resource Location. "name": "str", # Optional. Resource Name. "properties": { - "p.name": "str", # Optional. Dictionary of :code:``. - "provisioningState": "str", # Optional. Dictionary of :code:``. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". - "type": "str" # Optional. Dictionary of :code:``. + "p.name": "str", # Optional. Dictionary of + :code:``. + "provisioningState": "str", # Optional. Dictionary + of :code:``. + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". + "type": "str" # Optional. Dictionary of + :code:``. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -356,33 +441,46 @@ def build_put_resource_collection_request(*, json: JSONType = None, content: Any "properties": { "p.name": "str", # Optional. Flattened product. "provisioningState": "str", # Optional. Flattened product. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. Flattened product. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/resourcecollection" + url = '/model-flatten/resourcecollection' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: +def build_get_resource_collection_request( + **kwargs: Any +) -> HttpRequest: """Get External Resource as a ResourceCollection. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -406,11 +504,15 @@ def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: "properties": { "p.name": "str", # Optional. "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". "type": "str" # Optional. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -421,13 +523,20 @@ def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: "location": "str", # Optional. Resource Location. "name": "str", # Optional. Resource Name. "properties": { - "p.name": "str", # Optional. Dictionary of :code:``. - "provisioningState": "str", # Optional. Dictionary of :code:``. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". - "type": "str" # Optional. Dictionary of :code:``. + "p.name": "str", # Optional. Dictionary of + :code:``. + "provisioningState": "str", # Optional. Dictionary + of :code:``. + "provisioningStateValues": "str", # Optional. + Possible values include: "Succeeded", "Failed", "canceled", + "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", + "Deleted", "OK". + "type": "str" # Optional. Dictionary of + :code:``. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary + of :code:``. }, "type": "str" # Optional. Resource Type. } @@ -439,11 +548,15 @@ def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: "properties": { "p.name": "str", # Optional. Flattened product. "provisioningState": "str", # Optional. Flattened product. - "provisioningStateValues": "str", # Optional. Possible values include: "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", "OK". + "provisioningStateValues": "str", # Optional. Possible + values include: "Succeeded", "Failed", "canceled", "Accepted", + "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", + "OK". "type": "str" # Optional. Flattened product. }, "tags": { - "str": "str" # Optional. A set of tags. Dictionary of :code:``. + "str": "str" # Optional. A set of tags. Dictionary of + :code:``. }, "type": "str" # Optional. Resource Type. } @@ -452,16 +565,26 @@ def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/resourcecollection" + url = '/model-flatten/resourcecollection' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_simple_product_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_simple_product_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -484,10 +607,14 @@ def build_put_simple_product_request(*, json: JSONType = None, content: Any = No # JSON input template you can fill out and use as your body input. json = { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -498,10 +625,14 @@ def build_put_simple_product_request(*, json: JSONType = None, content: Any = No # response body for status code(s): 200 response.json() == { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -510,23 +641,33 @@ def build_put_simple_product_request(*, json: JSONType = None, content: Any = No } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/customFlattening" + url = '/model-flatten/customFlattening' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_flattened_simple_product_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put Flattened Simple Product with client flattening true on the parameter. @@ -550,10 +691,14 @@ def build_post_flattened_simple_product_request( # JSON input template you can fill out and use as your body input. json = { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -564,10 +709,14 @@ def build_post_flattened_simple_product_request( # response body for status code(s): 200 response.json() == { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -576,23 +725,34 @@ def build_post_flattened_simple_product_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/customFlattening" + url = '/model-flatten/customFlattening' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_simple_product_with_grouping_request( - name: str, *, json: JSONType = None, content: Any = None, **kwargs: Any + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Put Simple Product with client flattening true on the model. @@ -618,10 +778,14 @@ def build_put_simple_product_with_grouping_request( # JSON input template you can fill out and use as your body input. json = { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -632,10 +796,14 @@ def build_put_simple_product_with_grouping_request( # response body for status code(s): 200 response.json() == { "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Required. Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. + "base_product_id": "str", # Required. Unique identifier representing a + specific product for a given latitude & longitude. For example, uberX in San + Francisco will have a different product_id than uberX in Los Angeles. "details": { - "max_product_capacity": "Large", # Default value is "Large". Capacity of product. For example, 4 people. Has constant value: "Large". - "max_product_display_name": "str", # Required. Display name of product. + "max_product_capacity": "Large", # Default value is "Large". + Capacity of product. For example, 4 people. Has constant value: "Large". + "max_product_display_name": "str", # Required. Display name of + product. "max_product_image": { "@odata.value": "str", # Optional. URL value. "generic_value": "str" # Optional. Generic URL value. @@ -644,13 +812,13 @@ def build_put_simple_product_with_grouping_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/customFlattening/parametergrouping/{name}/" + url = '/model-flatten/customFlattening/parametergrouping/{name}/' path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "name": _SERIALIZER.url("name", name, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -658,7 +826,15 @@ def build_put_simple_product_with_grouping_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/setup.py index 8d1edff1db1..39383fce365 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Resource Flattening for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/__init__.py index 38868bb00ab..41f59902549 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MultipleInheritanceServiceClient"] +__all__ = ['MultipleInheritanceServiceClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_configuration.py index 16c67d7a275..3f7be9fee2d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class MultipleInheritanceServiceClientConfiguration(Configuration): +class MultipleInheritanceServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultipleInheritanceServiceClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "multipleinheritanceserviceclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_multiple_inheritance_service_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_multiple_inheritance_service_client.py index 4809b059262..c24e48a0254 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_multiple_inheritance_service_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_multiple_inheritance_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MultipleInheritanceServiceClient: """Service client for multiinheritance client testing. @@ -27,8 +26,13 @@ class MultipleInheritanceServiceClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/__init__.py index c1cb6dab943..5f66ffeb27e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._multiple_inheritance_service_client import MultipleInheritanceServiceClient - -__all__ = ["MultipleInheritanceServiceClient"] +__all__ = ['MultipleInheritanceServiceClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_configuration.py index 795387844ed..1e4b897da2a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class MultipleInheritanceServiceClientConfiguration(Configuration): +class MultipleInheritanceServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for MultipleInheritanceServiceClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "multipleinheritanceserviceclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_multiple_inheritance_service_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_multiple_inheritance_service_client.py index 4a972cb5cd9..377134b7dbb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_multiple_inheritance_service_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/aio/_multiple_inheritance_service_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MultipleInheritanceServiceClient: """Service client for multiinheritance client testing. @@ -27,7 +26,12 @@ class MultipleInheritanceServiceClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `multipleinheritancelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py index 007cd269e83..9cfc770c2cd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py @@ -30,14 +30,14 @@ from ._request_builders import build_put_kitten_request # type: ignore __all__ = [ - "build_get_horse_request", - "build_put_horse_request", - "build_get_pet_request", - "build_put_pet_request", - "build_get_feline_request", - "build_put_feline_request", - "build_get_cat_request", - "build_put_cat_request", - "build_get_kitten_request", - "build_put_kitten_request", + 'build_get_horse_request', + 'build_put_horse_request', + 'build_get_pet_request', + 'build_put_pet_request', + 'build_get_feline_request', + 'build_put_feline_request', + 'build_get_cat_request', + 'build_put_cat_request', + 'build_get_kitten_request', + 'build_put_kitten_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py index 044e0ec718e..8b4260a1735 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -42,7 +41,7 @@ def build_get_horse_request( # response body for status code(s): 200 response.json() == { "isAShowHorse": bool, # Optional. - "name": "str" # Required. + "name": "str" # Required. } """ @@ -88,7 +87,7 @@ def build_put_horse_request( # JSON input template you can fill out and use as your body input. json = { "isAShowHorse": bool, # Optional. - "name": "str" # Required. + "name": "str" # Required. } """ @@ -131,7 +130,7 @@ def build_get_pet_request( # response body for status code(s): 200 response.json() == { - "name": "str" # Required. + "name": "str" # Required. } """ @@ -176,7 +175,7 @@ def build_put_pet_request( # JSON input template you can fill out and use as your body input. json = { - "name": "str" # Required. + "name": "str" # Required. } """ @@ -312,7 +311,7 @@ def build_get_cat_request( "hisses": bool, # Optional. "likesMilk": bool, # Optional. "meows": bool, # Optional. - "name": "str" # Required. + "name": "str" # Required. } """ @@ -362,7 +361,7 @@ def build_put_cat_request( "hisses": bool, # Optional. "likesMilk": bool, # Optional. "meows": bool, # Optional. - "name": "str" # Required. + "name": "str" # Required. } """ @@ -410,7 +409,7 @@ def build_get_kitten_request( "hisses": bool, # Optional. "likesMilk": bool, # Optional. "meows": bool, # Optional. - "name": "str" # Required. + "name": "str" # Required. } """ @@ -462,7 +461,7 @@ def build_put_kitten_request( "hisses": bool, # Optional. "likesMilk": bool, # Optional. "meows": bool, # Optional. - "name": "str" # Required. + "name": "str" # Required. } """ @@ -484,3 +483,4 @@ def build_put_kitten_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py index 7fe362f8b48..57ec2b5b906 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_horse_request(**kwargs: Any) -> HttpRequest: +def build_get_horse_request( + **kwargs: Any +) -> HttpRequest: """Get a horse with name 'Fred' and isAShowHorse true. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -40,16 +41,26 @@ def build_get_horse_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/horse" + url = '/multipleInheritance/horse' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_horse_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_horse_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a horse with name 'General' and isAShowHorse false. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -76,22 +87,31 @@ def build_put_horse_request(*, json: JSONType = None, content: Any = None, **kwa } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/horse" + url = '/multipleInheritance/horse' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_pet_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_pet_request( + **kwargs: Any +) -> HttpRequest: """Get a pet with name 'Peanut'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -113,16 +133,26 @@ def build_get_pet_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/pet" + url = '/multipleInheritance/pet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_pet_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_pet_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a pet with name 'Butter'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -148,22 +178,31 @@ def build_put_pet_request(*, json: JSONType = None, content: Any = None, **kwarg } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/pet" + url = '/multipleInheritance/pet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_feline_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_feline_request( + **kwargs: Any +) -> HttpRequest: """Get a feline where meows and hisses are true. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -186,16 +225,26 @@ def build_get_feline_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/feline" + url = '/multipleInheritance/feline' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_feline_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_feline_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a feline who hisses and doesn't meow. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -222,22 +271,31 @@ def build_put_feline_request(*, json: JSONType = None, content: Any = None, **kw } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/feline" + url = '/multipleInheritance/feline' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_cat_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_cat_request( + **kwargs: Any +) -> HttpRequest: """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -262,16 +320,26 @@ def build_get_cat_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/cat" + url = '/multipleInheritance/cat' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_cat_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_cat_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -302,22 +370,31 @@ def build_put_cat_request(*, json: JSONType = None, content: Any = None, **kwarg } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/cat" + url = '/multipleInheritance/cat' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_kitten_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_kitten_request( + **kwargs: Any +) -> HttpRequest: """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet is false. @@ -344,16 +421,26 @@ def build_get_kitten_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/kitten" + url = '/multipleInheritance/kitten' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_kitten_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_kitten_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -386,16 +473,24 @@ def build_put_kitten_request(*, json: JSONType = None, content: Any = None, **kw } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/kitten" + url = '/multipleInheritance/kitten' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/setup.py index 5d90113dd65..cfdb6a2a981 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for multiinheritance client testing. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/nooperationslowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/nooperationslowlevel/__init__.py index d55ccad1f57..5960c353a89 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/nooperationslowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/nooperationslowlevel/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/setup.py index 66ffc7560f0..e89f95f6531 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NoOperationsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client with no operations. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/__init__.py index 0d39634a248..339a2c819ef 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["NonStringEnumsClient"] +__all__ = ['NonStringEnumsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_configuration.py index de2a150d4e9..e66fec6105e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class NonStringEnumsClientConfiguration(Configuration): +class NonStringEnumsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for NonStringEnumsClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(NonStringEnumsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "nonstringenumsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'nonstringenumsclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_non_string_enums_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_non_string_enums_client.py index ffe5cd23861..347b724dfb1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_non_string_enums_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_non_string_enums_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class NonStringEnumsClient: """Testing non-string enums. @@ -27,8 +26,13 @@ class NonStringEnumsClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = NonStringEnumsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/__init__.py index affc03b809b..32ad006d576 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._non_string_enums_client import NonStringEnumsClient - -__all__ = ["NonStringEnumsClient"] +__all__ = ['NonStringEnumsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_configuration.py index 7daa742b2c9..ce96ec5284b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class NonStringEnumsClientConfiguration(Configuration): +class NonStringEnumsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for NonStringEnumsClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(NonStringEnumsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "nonstringenumsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'nonstringenumsclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_non_string_enums_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_non_string_enums_client.py index d32b67cbe09..07e55cc7a2d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_non_string_enums_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/aio/_non_string_enums_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class NonStringEnumsClient: """Testing non-string enums. @@ -27,7 +26,12 @@ class NonStringEnumsClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = NonStringEnumsClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `nonstringenumslowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py index caeb33f5416..5f2cc43c99f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_get_request # type: ignore __all__ = [ - "build_put_request", - "build_get_request", + 'build_put_request', + 'build_get_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py index 01e33e87b5c..cc1d41b46f5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -104,3 +103,4 @@ def build_get_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py index 24c1294ea7a..3cea7bb6209 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py @@ -9,15 +9,19 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put a float enum. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -41,22 +45,31 @@ def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: A json = 0.0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/nonStringEnums/float/put" + url = '/nonStringEnums/float/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + **kwargs: Any +) -> HttpRequest: """Get a float enum. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -76,10 +89,16 @@ def build_get_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/nonStringEnums/float/get" + url = '/nonStringEnums/float/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py index caeb33f5416..5f2cc43c99f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_get_request # type: ignore __all__ = [ - "build_put_request", - "build_get_request", + 'build_put_request', + 'build_get_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py index 3e50200712d..f866dd91285 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -104,3 +103,4 @@ def build_get_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py index 4d386f7a6a2..54f2b79117d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py @@ -9,15 +9,19 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Put an int enum. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -41,22 +45,31 @@ def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: A json = 0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/nonStringEnums/int/put" + url = '/nonStringEnums/int/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + **kwargs: Any +) -> HttpRequest: """Get an int enum. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -76,10 +89,16 @@ def build_get_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/nonStringEnums/int/get" + url = '/nonStringEnums/int/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/setup.py index 67f8f2e27c2..d67d567521a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Testing non-string enums. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/__init__.py index 09dfe0c03cd..e56ee1488d0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ObjectTypeClient"] +__all__ = ['ObjectTypeClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_configuration.py index d1a68d81dd5..5b8dc84693d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class ObjectTypeClientConfiguration(Configuration): +class ObjectTypeClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ObjectTypeClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ObjectTypeClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "objecttypeclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'objecttypeclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_object_type_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_object_type_client.py index 14f95eca158..a9b15c57722 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_object_type_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_object_type_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ObjectTypeClient: """Service client for testing basic type: object swaggers. @@ -27,8 +26,13 @@ class ObjectTypeClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = ObjectTypeClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/__init__.py index c1ad6e24f4d..2ab3dbf0215 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._object_type_client import ObjectTypeClient - -__all__ = ["ObjectTypeClient"] +__all__ = ['ObjectTypeClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_configuration.py index 5c8877fc3b9..6780a0e6232 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class ObjectTypeClientConfiguration(Configuration): +class ObjectTypeClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ObjectTypeClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ObjectTypeClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "objecttypeclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'objecttypeclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_object_type_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_object_type_client.py index cf2e42b3458..47eb78c3b88 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_object_type_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/aio/_object_type_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ObjectTypeClient: """Service client for testing basic type: object swaggers. @@ -27,7 +26,12 @@ class ObjectTypeClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = ObjectTypeClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `objecttypelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py index 355267c5498..a44e716f9fd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_put_request # type: ignore __all__ = [ - "build_get_request", - "build_put_request", + 'build_get_request', + 'build_put_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py index 62dd4794260..c857d41b0d9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py @@ -13,8 +13,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -102,3 +101,4 @@ def build_put_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py index cbe2b1c6b58..438cf145c00 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py @@ -9,15 +9,16 @@ from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request(**kwargs: Any) -> HttpRequest: +def build_get_request( + **kwargs: Any +) -> HttpRequest: """Basic get that returns an object. Returns object { 'message': 'An object was successfully returned' }. @@ -32,16 +33,26 @@ def build_get_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/objectType/get" + url = '/objectType/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) - - -def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Basic put that puts an object. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -68,16 +79,24 @@ def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: A json = {} # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/objectType/put" + url = '/objectType/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/setup.py index fae955ee4ad..8c6b57e7416 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing basic type: object swaggers. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/__init__.py index 89734cff0ef..e3a59770bd4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterFlattening"] +__all__ = ['AutoRestParameterFlattening'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_auto_rest_parameter_flattening.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_auto_rest_parameter_flattening.py index 6791b4cc950..649d3ce98a8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_auto_rest_parameter_flattening.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_auto_rest_parameter_flattening.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterFlattening: """Resource Flattening for AutoRest. @@ -27,8 +26,13 @@ class AutoRestParameterFlattening: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestParameterFlatteningConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_configuration.py index 8d4039139ce..0727c744512 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestParameterFlatteningConfiguration(Configuration): +class AutoRestParameterFlatteningConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterFlattening. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterFlatteningConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparameterflattening/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterflattening/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/__init__.py index afd7446dd4f..79225d2b2ed 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameter_flattening import AutoRestParameterFlattening - -__all__ = ["AutoRestParameterFlattening"] +__all__ = ['AutoRestParameterFlattening'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_auto_rest_parameter_flattening.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_auto_rest_parameter_flattening.py index 2be90274afb..8c6b8854d2d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_auto_rest_parameter_flattening.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_auto_rest_parameter_flattening.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterFlattening: """Resource Flattening for AutoRest. @@ -27,7 +26,12 @@ class AutoRestParameterFlattening: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestParameterFlatteningConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `parameterflatteninglowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_configuration.py index 2def2fa1a10..62d5d8180ef 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestParameterFlatteningConfiguration(Configuration): +class AutoRestParameterFlatteningConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterFlattening. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterFlatteningConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparameterflattening/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterflattening/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py index 0f9c14f9c76..5e5dd247e4f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_update_request # type: ignore __all__ = [ - "build_update_request", + 'build_update_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py index 187bb655295..9b9c3320bc6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py @@ -15,8 +15,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -56,7 +55,8 @@ def build_update_request( # JSON input template you can fill out and use as your body input. json = { "tags": { - "str": "str" # Required. A set of tags. A description about the set of tags. + "str": "str" # Required. A set of tags. A description about the set + of tags. } } """ @@ -83,3 +83,4 @@ def build_update_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py index 1a8557a3095..dc408208f19 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py @@ -11,8 +11,7 @@ from msrest import Serializer from ..._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -20,7 +19,12 @@ def build_update_request( - resource_group_name: str, avset: str, *, json: JSONType = None, content: Any = None, **kwargs: Any + resource_group_name: str, + avset: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Updates the tags for an availability set. @@ -48,18 +52,19 @@ def build_update_request( # JSON input template you can fill out and use as your body input. json = { "tags": { - "str": "str" # Required. A set of tags. A description about the set of tags. + "str": "str" # Required. A set of tags. A description about the set + of tags. } } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/parameterFlattening/{resourceGroupName}/{availabilitySetName}" + url = '/parameterFlattening/{resourceGroupName}/{availabilitySetName}' path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("avset", avset, "str", max_length=80, min_length=0), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("avset", avset, 'str', max_length=80, min_length=0), } url = _format_url_section(url, **path_format_arguments) @@ -67,6 +72,14 @@ def build_update_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/setup.py index 5deb8606bc4..9da8a75fb55 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Resource Flattening for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/__init__.py index b8ba21b64e7..2668d267b05 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ParmaterizedEndpointClient"] +__all__ = ['ParmaterizedEndpointClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_configuration.py index dc30b496cc3..30a6c8ce041 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class ParmaterizedEndpointClientConfiguration(Configuration): +class ParmaterizedEndpointClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ParmaterizedEndpointClient. Note that all parameters used to create this instance are saved as instance @@ -24,25 +24,30 @@ class ParmaterizedEndpointClientConfiguration(Configuration): :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: super(ParmaterizedEndpointClientConfiguration, self).__init__(**kwargs) if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "parmaterizedendpointclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'parmaterizedendpointclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_parmaterized_endpoint_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_parmaterized_endpoint_client.py index 00e07b046e7..2f6d6e451b8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_parmaterized_endpoint_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/_parmaterized_endpoint_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ParmaterizedEndpointClient: """Service client for testing parameterized hosts with the name 'endpoint'. @@ -27,8 +26,12 @@ class ParmaterizedEndpointClient: :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: - _endpoint = "{endpoint}" + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: + _endpoint = '{endpoint}' self._config = ParmaterizedEndpointClientConfiguration(endpoint=endpoint, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -36,6 +39,7 @@ def __init__(self, endpoint: str, **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest @@ -63,7 +67,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/__init__.py index cc7178494ae..59521cea44d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._parmaterized_endpoint_client import ParmaterizedEndpointClient - -__all__ = ["ParmaterizedEndpointClient"] +__all__ = ['ParmaterizedEndpointClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_configuration.py index ea820d0034b..cbdabb5aa79 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class ParmaterizedEndpointClientConfiguration(Configuration): +class ParmaterizedEndpointClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ParmaterizedEndpointClient. Note that all parameters used to create this instance are saved as instance @@ -24,22 +24,29 @@ class ParmaterizedEndpointClientConfiguration(Configuration): :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: super(ParmaterizedEndpointClientConfiguration, self).__init__(**kwargs) if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "parmaterizedendpointclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'parmaterizedendpointclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_parmaterized_endpoint_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_parmaterized_endpoint_client.py index d7c8ab8fef0..d7e8ad2a0e5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_parmaterized_endpoint_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/aio/_parmaterized_endpoint_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ParmaterizedEndpointClient: """Service client for testing parameterized hosts with the name 'endpoint'. @@ -27,8 +26,12 @@ class ParmaterizedEndpointClient: :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: - _endpoint = "{endpoint}" + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: + _endpoint = '{endpoint}' self._config = ParmaterizedEndpointClientConfiguration(endpoint=endpoint, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -36,7 +39,12 @@ def __init__(self, endpoint: str, **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `parameterizedendpointlowlevel.rest`. @@ -59,7 +67,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py index a2bcc31a29b..f47a7ffdd40 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_get_request # type: ignore __all__ = [ - "build_get_request", + 'build_get_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py index ca3ca3c7eed..959ccdd0432 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py @@ -42,3 +42,4 @@ def build_get_request( url=url, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py index c2bccad6020..8c1d10331cf 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER.client_side_validation = False -def build_get_request(**kwargs: Any) -> HttpRequest: +def build_get_request( + **kwargs: Any +) -> HttpRequest: """Basic get to make sure base url formatting of 'endpoint' works. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -27,6 +29,11 @@ def build_get_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/parameterizedEndpoint/get" + url = '/parameterizedEndpoint/get' + + return HttpRequest( + method="GET", + url=url, + **kwargs + ) - return HttpRequest(method="GET", url=url, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/setup.py index b4cd6534537..64afd119cb9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing parameterized hosts with the name 'endpoint'. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py index 194a940b001..3c47c0e71b8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestReportService"] +__all__ = ['AutoRestReportService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py index c44b3888d82..cb7b654cbcf 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_auto_rest_report_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestReportService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestReportServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py index ac1fc82cda4..05acbc00632 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestReportServiceConfiguration(Configuration): +class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py index 7db91454410..d2bc65f6452 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_report_service import AutoRestReportService - -__all__ = ["AutoRestReportService"] +__all__ = ['AutoRestReportService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py index 9e44601b422..ea8b071f91d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_auto_rest_report_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestReportService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestReportServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `reportlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py index 0b086b995d9..07f1640ca40 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestReportServiceConfiguration(Configuration): +class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestReportService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py index 7d62f26b1bd..e3dcf286061 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py @@ -14,6 +14,6 @@ from ._request_builders import build_get_optional_report_request # type: ignore __all__ = [ - "build_get_report_request", - "build_get_optional_report_request", + 'build_get_report_request', + 'build_get_optional_report_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py index 2aaa9b9fd8b..64457dc4641 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py @@ -119,3 +119,4 @@ def build_get_optional_report_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py index fd541dad2b9..f0e3ffe34e1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py @@ -14,7 +14,11 @@ _SERIALIZER.client_side_validation = False -def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_get_report_request( + *, + qualifier: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get test coverage report. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -40,21 +44,31 @@ def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) accept = "application/json" # Construct URL - url = "/report" + url = '/report' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if qualifier is not None: - query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_get_optional_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_optional_report_request( + *, + qualifier: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get optional test coverage report. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -80,15 +94,22 @@ def build_get_optional_report_request(*, qualifier: Optional[str] = None, **kwar accept = "application/json" # Construct URL - url = "/report/optional" + url = '/report/optional' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if qualifier is not None: - query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py index 2f4459980ef..a1b05ebd53f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/__init__.py index c9a1faeed62..aeb3ff59763 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestRequiredOptionalTestService"] +__all__ = ['AutoRestRequiredOptionalTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_auto_rest_required_optional_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_auto_rest_required_optional_test_service.py index 5a5db4f905c..47daec83454 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_auto_rest_required_optional_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_auto_rest_required_optional_test_service.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRequiredOptionalTestService: """Test Infrastructure for AutoRest. @@ -42,18 +41,14 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = AutoRestRequiredOptionalTestServiceConfiguration( - required_global_path=required_global_path, - required_global_query=required_global_query, - optional_global_query=optional_global_query, - **kwargs - ) + + self._config = AutoRestRequiredOptionalTestServiceConfiguration(required_global_path=required_global_path, required_global_query=required_global_query, optional_global_query=optional_global_query, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_configuration.py index 08eb585b33d..3242034dd67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): +class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRequiredOptionalTestService. Note that all parameters used to create this instance are saved as instance @@ -44,19 +44,20 @@ def __init__( self.required_global_path = required_global_path self.required_global_query = required_global_query self.optional_global_query = optional_global_query - kwargs.setdefault("sdk_moniker", "autorestrequiredoptionaltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrequiredoptionaltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/__init__.py index 0648b590400..455a4888284 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_required_optional_test_service import AutoRestRequiredOptionalTestService - -__all__ = ["AutoRestRequiredOptionalTestService"] +__all__ = ['AutoRestRequiredOptionalTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_auto_rest_required_optional_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_auto_rest_required_optional_test_service.py index 99d8733d3d2..9b7fbee1a03 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_auto_rest_required_optional_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_auto_rest_required_optional_test_service.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRequiredOptionalTestService: """Test Infrastructure for AutoRest. @@ -42,18 +41,18 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestRequiredOptionalTestServiceConfiguration( - required_global_path=required_global_path, - required_global_query=required_global_query, - optional_global_query=optional_global_query, - **kwargs - ) + self._config = AutoRestRequiredOptionalTestServiceConfiguration(required_global_path=required_global_path, required_global_query=required_global_query, optional_global_query=optional_global_query, **kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `requiredoptionallowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_configuration.py index 2a219b5169e..1c395c72058 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): +class AutoRestRequiredOptionalTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestRequiredOptionalTestService. Note that all parameters used to create this instance are saved as instance @@ -44,16 +44,19 @@ def __init__( self.required_global_path = required_global_path self.required_global_query = required_global_query self.optional_global_query = optional_global_query - kwargs.setdefault("sdk_moniker", "autorestrequiredoptionaltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrequiredoptionaltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py index 573a6e28340..d1a1c130845 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py @@ -58,28 +58,28 @@ from ._request_builders import build_post_optional_array_header_request # type: ignore __all__ = [ - "build_put_optional_binary_body_request", - "build_put_required_binary_body_request", - "build_post_required_integer_parameter_request", - "build_post_optional_integer_parameter_request", - "build_post_required_integer_property_request", - "build_post_optional_integer_property_request", - "build_post_required_integer_header_request", - "build_post_optional_integer_header_request", - "build_post_required_string_parameter_request", - "build_post_optional_string_parameter_request", - "build_post_required_string_property_request", - "build_post_optional_string_property_request", - "build_post_required_string_header_request", - "build_post_optional_string_header_request", - "build_post_required_class_parameter_request", - "build_post_optional_class_parameter_request", - "build_post_required_class_property_request", - "build_post_optional_class_property_request", - "build_post_required_array_parameter_request", - "build_post_optional_array_parameter_request", - "build_post_required_array_property_request", - "build_post_optional_array_property_request", - "build_post_required_array_header_request", - "build_post_optional_array_header_request", + 'build_put_optional_binary_body_request', + 'build_put_required_binary_body_request', + 'build_post_required_integer_parameter_request', + 'build_post_optional_integer_parameter_request', + 'build_post_required_integer_property_request', + 'build_post_optional_integer_property_request', + 'build_post_required_integer_header_request', + 'build_post_optional_integer_header_request', + 'build_post_required_string_parameter_request', + 'build_post_optional_string_parameter_request', + 'build_post_required_string_property_request', + 'build_post_optional_string_property_request', + 'build_post_required_string_header_request', + 'build_post_optional_string_header_request', + 'build_post_required_class_parameter_request', + 'build_post_optional_class_parameter_request', + 'build_post_required_class_property_request', + 'build_post_optional_class_property_request', + 'build_post_required_array_parameter_request', + 'build_post_optional_array_parameter_request', + 'build_post_required_array_property_request', + 'build_post_optional_array_property_request', + 'build_post_required_array_header_request', + 'build_post_optional_array_header_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py index 4b9c1a0a36d..1366a559266 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, List, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -218,7 +217,7 @@ def build_post_required_integer_property_request( # JSON input template you can fill out and use as your body input. json = { - "value": 0 # Required. + "value": 0 # Required. } """ @@ -486,7 +485,7 @@ def build_post_required_string_property_request( # JSON input template you can fill out and use as your body input. json = { - "value": "str" # Required. + "value": "str" # Required. } """ @@ -659,7 +658,7 @@ def build_post_required_class_parameter_request( # JSON input template you can fill out and use as your body input. json = { - "id": 0, # Required. + "id": 0, # Required. "name": "str" # Optional. } """ @@ -709,7 +708,7 @@ def build_post_optional_class_parameter_request( # JSON input template you can fill out and use as your body input. json = { - "id": 0, # Required. + "id": 0, # Required. "name": "str" # Optional. } """ @@ -761,8 +760,8 @@ def build_post_required_class_property_request( # JSON input template you can fill out and use as your body input. json = { "value": { - "id": 0, # Required. - "name": "str" # Optional. Required. + "id": 0, # Required. + "name": "str" # Optional. Required. } } """ @@ -813,7 +812,7 @@ def build_post_optional_class_property_request( # JSON input template you can fill out and use as your body input. json = { "value": { - "id": 0, # Required. + "id": 0, # Required. "name": "str" # Optional. } } @@ -965,7 +964,7 @@ def build_post_required_array_property_request( # JSON input template you can fill out and use as your body input. json = { "value": [ - "str" # Required. + "str" # Required. ] } """ @@ -1113,3 +1112,4 @@ def build_post_optional_array_header_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py index cd4cb16c46b..c793244494e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py @@ -5,18 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, List, Optional, TypeVar +from typing import Any, Dict, List, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_put_optional_binary_body_request(*, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_put_optional_binary_body_request( + *, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Test explicitly optional body parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,22 +34,32 @@ def build_put_optional_binary_body_request(*, content: Any = None, **kwargs: Any :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/explicit/optional/binary-body" + url = '/reqopt/explicit/optional/binary-body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) - - -def build_put_required_binary_body_request(*, content: Any, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) + + +def build_put_required_binary_body_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Test explicitly required body parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -61,23 +74,32 @@ def build_put_required_binary_body_request(*, content: Any, **kwargs: Any) -> Ht :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/explicit/required/binary-body" + url = '/reqopt/explicit/required/binary-body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_post_required_integer_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required integer. Please put null and the client library should throw before the request is sent. @@ -103,23 +125,33 @@ def build_post_required_integer_parameter_request( json = 0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/integer/parameter" + url = '/reqopt/requied/integer/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_integer_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional integer. Please put null. @@ -144,23 +176,33 @@ def build_post_optional_integer_parameter_request( json = 0 # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/integer/parameter" + url = '/reqopt/optional/integer/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_required_integer_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -188,23 +230,33 @@ def build_post_required_integer_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/integer/property" + url = '/reqopt/requied/integer/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_integer_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. @@ -231,22 +283,33 @@ def build_post_optional_integer_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/integer/property" + url = '/reqopt/optional/integer/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post_required_integer_header_request(*, header_parameter: int, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post_required_integer_header_request( + *, + header_parameter: int, + **kwargs: Any +) -> HttpRequest: """Test explicitly required integer. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -263,17 +326,26 @@ def build_post_required_integer_header_request(*, header_parameter: int, **kwarg accept = "application/json" # Construct URL - url = "/reqopt/requied/integer/header" + url = '/reqopt/requied/integer/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_optional_integer_header_request(*, header_parameter: Optional[int] = None, **kwargs: Any) -> HttpRequest: +def build_post_optional_integer_header_request( + *, + header_parameter: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: """Test explicitly optional integer. Please put a header 'headerParameter' => null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -289,19 +361,27 @@ def build_post_optional_integer_header_request(*, header_parameter: Optional[int accept = "application/json" # Construct URL - url = "/reqopt/optional/integer/header" + url = '/reqopt/optional/integer/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_parameter is not None: - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_post_required_string_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required string. Please put null and the client library should throw before the request is sent. @@ -327,23 +407,33 @@ def build_post_required_string_parameter_request( json = "str" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/string/parameter" + url = '/reqopt/requied/string/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_string_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional string. Please put null. @@ -368,23 +458,33 @@ def build_post_optional_string_parameter_request( json = "str" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/string/parameter" + url = '/reqopt/optional/string/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_required_string_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -412,23 +512,33 @@ def build_post_required_string_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/string/property" + url = '/reqopt/requied/string/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_string_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. @@ -455,22 +565,33 @@ def build_post_optional_string_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/string/property" + url = '/reqopt/optional/string/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post_required_string_header_request(*, header_parameter: str, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post_required_string_header_request( + *, + header_parameter: str, + **kwargs: Any +) -> HttpRequest: """Test explicitly required string. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -487,17 +608,26 @@ def build_post_required_string_header_request(*, header_parameter: str, **kwargs accept = "application/json" # Construct URL - url = "/reqopt/requied/string/header" + url = '/reqopt/requied/string/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_post_optional_string_header_request(*, body_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_post_optional_string_header_request( + *, + body_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Test explicitly optional string. Please put a header 'headerParameter' => null. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -513,19 +643,27 @@ def build_post_optional_string_header_request(*, body_parameter: Optional[str] = accept = "application/json" # Construct URL - url = "/reqopt/optional/string/header" + url = '/reqopt/optional/string/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if body_parameter is not None: - header_parameters["bodyParameter"] = _SERIALIZER.header("body_parameter", body_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['bodyParameter'] = _SERIALIZER.header("body_parameter", body_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_post_required_class_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -554,23 +692,33 @@ def build_post_required_class_parameter_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/class/parameter" + url = '/reqopt/requied/class/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_class_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional complex object. Please put null. @@ -598,23 +746,33 @@ def build_post_optional_class_parameter_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/class/parameter" + url = '/reqopt/optional/class/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_required_class_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -645,23 +803,33 @@ def build_post_required_class_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/class/property" + url = '/reqopt/requied/class/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_class_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. @@ -691,23 +859,33 @@ def build_post_optional_class_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/class/property" + url = '/reqopt/optional/class/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_required_array_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -735,23 +913,33 @@ def build_post_required_array_parameter_request( ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/array/parameter" + url = '/reqopt/requied/array/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_array_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional array. Please put null. @@ -778,23 +966,33 @@ def build_post_optional_array_parameter_request( ] """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/array/parameter" + url = '/reqopt/optional/array/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_required_array_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -824,23 +1022,33 @@ def build_post_required_array_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/array/property" + url = '/reqopt/requied/array/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_optional_array_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. @@ -869,22 +1077,33 @@ def build_post_optional_array_property_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/array/property" + url = '/reqopt/optional/array/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_post_required_array_header_request(*, header_parameter: List[str], **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_post_required_array_header_request( + *, + header_parameter: List[str], + **kwargs: Any +) -> HttpRequest: """Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -901,18 +1120,25 @@ def build_post_required_array_header_request(*, header_parameter: List[str], **k accept = "application/json" # Construct URL - url = "/reqopt/requied/array/header" + url = '/reqopt/requied/array/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "[str]", div=",") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_post_optional_array_header_request( - *, header_parameter: Optional[List[str]] = None, **kwargs: Any + *, + header_parameter: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: """Test explicitly optional integer. Please put a header 'headerParameter' => null. @@ -929,14 +1155,18 @@ def build_post_optional_array_header_request( accept = "application/json" # Construct URL - url = "/reqopt/optional/array/header" + url = '/reqopt/optional/array/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_parameter is not None: - header_parameters["headerParameter"] = _SERIALIZER.header( - "header_parameter", header_parameter, "[str]", div="," - ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py index 7963f152b24..452778f844d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py @@ -26,12 +26,12 @@ from ._request_builders import build_get_optional_global_query_request # type: ignore __all__ = [ - "build_get_required_path_request", - "build_put_optional_query_request", - "build_put_optional_header_request", - "build_put_optional_body_request", - "build_put_optional_binary_body_request", - "build_get_required_global_path_request", - "build_get_required_global_query_request", - "build_get_optional_global_query_request", + 'build_get_required_path_request', + 'build_put_optional_query_request', + 'build_put_optional_header_request', + 'build_put_optional_body_request', + 'build_put_optional_binary_body_request', + 'build_get_required_global_path_request', + 'build_get_required_global_query_request', + 'build_get_optional_global_query_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py index c90a8231701..f9a3575023c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py @@ -14,9 +14,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -343,3 +342,4 @@ def build_get_optional_global_query_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py index 6e4cebbdead..749954c0044 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py @@ -5,20 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer from ..._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() -def build_get_required_path_request(path_parameter: str, **kwargs: Any) -> HttpRequest: +def build_get_required_path_request( + path_parameter: str, + **kwargs: Any +) -> HttpRequest: """Test implicitly required path parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -34,21 +36,30 @@ def build_get_required_path_request(path_parameter: str, **kwargs: Any) -> HttpR accept = "application/json" # Construct URL - url = "/reqopt/implicit/required/path/{pathParameter}" + url = '/reqopt/implicit/required/path/{pathParameter}' path_format_arguments = { - "pathParameter": _SERIALIZER.url("path_parameter", path_parameter, "str"), + "pathParameter": _SERIALIZER.url("path_parameter", path_parameter, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_optional_query_request(*, query_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_put_optional_query_request( + *, + query_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Test implicitly optional query parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -64,21 +75,31 @@ def build_put_optional_query_request(*, query_parameter: Optional[str] = None, * accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/query" + url = '/reqopt/implicit/optional/query' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query_parameter is not None: - query_parameters["queryParameter"] = _SERIALIZER.query("query_parameter", query_parameter, "str") + query_parameters['queryParameter'] = _SERIALIZER.query("query_parameter", query_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_put_optional_header_request(*, query_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_put_optional_header_request( + *, + query_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Test implicitly optional header parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -94,18 +115,28 @@ def build_put_optional_header_request(*, query_parameter: Optional[str] = None, accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/header" + url = '/reqopt/implicit/optional/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if query_parameter is not None: - header_parameters["queryParameter"] = _SERIALIZER.header("query_parameter", query_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, **kwargs) - - -def build_put_optional_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['queryParameter'] = _SERIALIZER.header("query_parameter", query_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_put_optional_body_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Test implicitly optional body parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -129,22 +160,33 @@ def build_put_optional_body_request(*, json: JSONType = None, content: Any = Non json = "str" # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/body" + url = '/reqopt/implicit/optional/body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_optional_binary_body_request(*, content: Any = None, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_optional_binary_body_request( + *, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """Test implicitly optional body parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -159,22 +201,31 @@ def build_put_optional_binary_body_request(*, content: Any = None, **kwargs: Any :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/binary-body" + url = '/reqopt/implicit/optional/binary-body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_required_global_path_request(required_global_path: str, **kwargs: Any) -> HttpRequest: +def build_get_required_global_path_request( + required_global_path: str, + **kwargs: Any +) -> HttpRequest: """Test implicitly required path parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -190,21 +241,30 @@ def build_get_required_global_path_request(required_global_path: str, **kwargs: accept = "application/json" # Construct URL - url = "/reqopt/global/required/path/{required-global-path}" + url = '/reqopt/global/required/path/{required-global-path}' path_format_arguments = { - "required-global-path": _SERIALIZER.url("required_global_path", required_global_path, "str"), + "required-global-path": _SERIALIZER.url("required_global_path", required_global_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_required_global_query_request(*, required_global_query: str, **kwargs: Any) -> HttpRequest: +def build_get_required_global_query_request( + *, + required_global_query: str, + **kwargs: Any +) -> HttpRequest: """Test implicitly required query parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -220,21 +280,29 @@ def build_get_required_global_query_request(*, required_global_query: str, **kwa accept = "application/json" # Construct URL - url = "/reqopt/global/required/query" + url = '/reqopt/global/required/query' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["required-global-query"] = _SERIALIZER.query("required_global_query", required_global_query, "str") + query_parameters['required-global-query'] = _SERIALIZER.query("required_global_query", required_global_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_get_optional_global_query_request( - *, optional_global_query: Optional[int] = None, **kwargs: Any + *, + optional_global_query: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: """Test implicitly optional query parameter. @@ -251,17 +319,22 @@ def build_get_optional_global_query_request( accept = "application/json" # Construct URL - url = "/reqopt/global/optional/query" + url = '/reqopt/global/optional/query' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if optional_global_query is not None: - query_parameters["optional-global-query"] = _SERIALIZER.query( - "optional_global_query", optional_global_query, "int" - ) + query_parameters['optional-global-query'] = _SERIALIZER.query("optional_global_query", optional_global_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/setup.py index b6d2db16006..835a295dbfa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/__init__.py index eaeb1bc5c6d..db01ca1ca8b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ReservedWordsClient"] +__all__ = ['ReservedWordsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_configuration.py index 58f4688d8d6..6d56a115447 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class ReservedWordsClientConfiguration(Configuration): +class ReservedWordsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ReservedWordsClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ReservedWordsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "reservedwordsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'reservedwordsclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_reserved_words_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_reserved_words_client.py index 4f3aeaf3bef..86c2ebdde6f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_reserved_words_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_reserved_words_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ReservedWordsClient: """Swagger that has operation groups etc. with reserved words. @@ -27,8 +26,13 @@ class ReservedWordsClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = ReservedWordsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/__init__.py index fc28320f86d..b05173059c0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._reserved_words_client import ReservedWordsClient - -__all__ = ["ReservedWordsClient"] +__all__ = ['ReservedWordsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_configuration.py index b3c39889d49..3219c3ec4f5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class ReservedWordsClientConfiguration(Configuration): +class ReservedWordsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ReservedWordsClient. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ReservedWordsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "reservedwordsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'reservedwordsclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_reserved_words_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_reserved_words_client.py index d49c53102fe..1a29f83f844 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_reserved_words_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/aio/_reserved_words_client.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ReservedWordsClient: """Swagger that has operation groups etc. with reserved words. @@ -27,7 +26,12 @@ class ReservedWordsClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = ReservedWordsClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `reservedwordslowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py index 91c75cf4717..d653f111434 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_operation_with_files_param_request # type: ignore __all__ = [ - "build_operation_with_content_param_request", - "build_operation_with_json_param_request", - "build_operation_with_data_param_request", - "build_operation_with_files_param_request", + 'build_operation_with_content_param_request', + 'build_operation_with_json_param_request', + 'build_operation_with_data_param_request', + 'build_operation_with_files_param_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py index 0d9932de97a..e6dbc21f951 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, IO, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -205,3 +204,4 @@ def build_operation_with_files_param_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py index 4c54c60efe1..a98415fb14c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py @@ -5,19 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, IO, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_operation_with_content_param_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_operation_with_content_param_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Operation with body param called content. Pass in b'hello, world'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -32,23 +35,32 @@ def build_operation_with_content_param_request(*, content: Any, **kwargs: Any) - :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/content" + url = '/reservedWords/operation/content' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_operation_with_json_param_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Operation with body param called 'json'. Pass in {'hello': 'world'}. @@ -73,23 +85,33 @@ def build_operation_with_json_param_request( json = {} # Optional. """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/json" + url = '/reservedWords/operation/json' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_operation_with_data_param_request( - *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + data: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Operation with urlencoded body param called 'data'. @@ -117,23 +139,33 @@ def build_operation_with_data_param_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/data" + url = '/reservedWords/operation/data' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, data=data, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + data=data, + content=content, + **kwargs + ) def build_operation_with_files_param_request( - *, files: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + files: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """Operation with multipart body param called 'files'. @@ -161,16 +193,24 @@ def build_operation_with_files_param_request( } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/files" + url = '/reservedWords/operation/files' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + files=files, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, files=files, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/__init__.py index 670686a56ad..42742434b5c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/__init__.py @@ -12,5 +12,5 @@ from ._request_builders import build_operation_one_request # type: ignore __all__ = [ - "build_operation_one_request", + 'build_operation_one_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders.py index 281b08ff693..d55075b2db2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders.py @@ -57,3 +57,4 @@ def build_operation_one_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders_py3.py index 51d3d713a8f..4661b75dd54 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_builders/_request_builders_py3.py @@ -14,7 +14,11 @@ _SERIALIZER.client_side_validation = False -def build_operation_one_request(*, parameter1: str, **kwargs: Any) -> HttpRequest: +def build_operation_one_request( + *, + parameter1: str, + **kwargs: Any +) -> HttpRequest: """Operation in operation group import, a reserved word. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -30,14 +34,21 @@ def build_operation_one_request(*, parameter1: str, **kwargs: Any) -> HttpReques accept = "application/json" # Construct URL - url = "/reservedWords/operationGroup/import" + url = '/reservedWords/operationGroup/import' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter1"] = _SERIALIZER.query("parameter1", parameter1, "str") + query_parameters['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/setup.py index 938b1069b30..f2973a2700c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Swagger that has operation groups etc. with reserved words. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/setup.py index 3eeeb1be90b..7b354e37d86 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/__init__.py index 56522eab3d5..e9117c1dd2d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestUrlTestService"] +__all__ = ['AutoRestUrlTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_auto_rest_url_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_auto_rest_url_test_service.py index 3187d9e45a0..beb3f901187 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_auto_rest_url_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_auto_rest_url_test_service.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlTestService: """Test Infrastructure for AutoRest. @@ -39,15 +38,14 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = AutoRestUrlTestServiceConfiguration( - global_string_path=global_string_path, global_string_query=global_string_query, **kwargs - ) + + self._config = AutoRestUrlTestServiceConfiguration(global_string_path=global_string_path, global_string_query=global_string_query, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_configuration.py index f1e4b947ee5..a616d3b9c98 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class AutoRestUrlTestServiceConfiguration(Configuration): +class AutoRestUrlTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlTestService. Note that all parameters used to create this instance are saved as instance @@ -26,26 +26,32 @@ class AutoRestUrlTestServiceConfiguration(Configuration): :type global_string_query: str """ - def __init__(self, global_string_path: str, global_string_query: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + global_string_path: str, + global_string_query: Optional[str] = None, + **kwargs: Any + ) -> None: super(AutoRestUrlTestServiceConfiguration, self).__init__(**kwargs) if global_string_path is None: raise ValueError("Parameter 'global_string_path' must not be None.") self.global_string_path = global_string_path self.global_string_query = global_string_query - kwargs.setdefault("sdk_moniker", "autoresturltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/__init__.py index 451dfcc7fc1..a9ed709fa25 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_url_test_service import AutoRestUrlTestService - -__all__ = ["AutoRestUrlTestService"] +__all__ = ['AutoRestUrlTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_auto_rest_url_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_auto_rest_url_test_service.py index abc8f89ee3d..439687e4080 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_auto_rest_url_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_auto_rest_url_test_service.py @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlTestService: """Test Infrastructure for AutoRest. @@ -39,15 +38,18 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestUrlTestServiceConfiguration( - global_string_path=global_string_path, global_string_query=global_string_query, **kwargs - ) + self._config = AutoRestUrlTestServiceConfiguration(global_string_path=global_string_path, global_string_query=global_string_query, **kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `urllowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_configuration.py index e5a929b5629..2fa1227f947 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestUrlTestServiceConfiguration(Configuration): +class AutoRestUrlTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlTestService. Note that all parameters used to create this instance are saved as instance @@ -26,23 +26,31 @@ class AutoRestUrlTestServiceConfiguration(Configuration): :type global_string_query: str """ - def __init__(self, global_string_path: str, global_string_query: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + global_string_path: str, + global_string_query: Optional[str] = None, + **kwargs: Any + ) -> None: super(AutoRestUrlTestServiceConfiguration, self).__init__(**kwargs) if global_string_path is None: raise ValueError("Parameter 'global_string_path' must not be None.") self.global_string_path = global_string_path self.global_string_query = global_string_query - kwargs.setdefault("sdk_moniker", "autoresturltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py index cd604938f2c..fa68207c779 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_get_local_path_item_query_null_request # type: ignore __all__ = [ - "build_get_all_with_values_request", - "build_get_global_query_null_request", - "build_get_global_and_local_query_null_request", - "build_get_local_path_item_query_null_request", + 'build_get_all_with_values_request', + 'build_get_global_query_null_request', + 'build_get_global_and_local_query_null_request', + 'build_get_local_path_item_query_null_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py index fc0ead87511..04e7146bfa5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py @@ -59,7 +59,7 @@ def build_get_all_with_values_request( accept = "application/json" # Construct URL - url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery' + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery' # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -129,7 +129,7 @@ def build_get_global_query_null_request( accept = "application/json" # Construct URL - url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery' + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery' # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -199,7 +199,7 @@ def build_get_global_and_local_query_null_request( accept = "application/json" # Construct URL - url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null' + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null' # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -268,7 +268,7 @@ def build_get_local_path_item_query_null_request( accept = "application/json" # Construct URL - url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null' + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null' # pylint: disable=line-too-long path_format_arguments = { "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), @@ -297,3 +297,4 @@ def build_get_local_path_item_query_null_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py index 5f271976d87..045282f1ea8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py @@ -53,11 +53,11 @@ def build_get_all_with_values_request( accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery" + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -65,19 +65,23 @@ def build_get_all_with_values_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_get_global_query_null_request( @@ -118,11 +122,11 @@ def build_get_global_query_null_request( accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery" + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -130,19 +134,23 @@ def build_get_global_query_null_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_get_global_and_local_query_null_request( @@ -183,11 +191,11 @@ def build_get_global_and_local_query_null_request( accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null" + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -195,19 +203,23 @@ def build_get_global_and_local_query_null_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_get_local_path_item_query_null_request( @@ -247,11 +259,11 @@ def build_get_local_path_item_query_null_request( accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null" + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -259,16 +271,21 @@ def build_get_local_path_item_query_null_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py index 5f24a088959..81dd5ee812a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py @@ -64,31 +64,31 @@ from ._request_builders import build_unix_time_url_request # type: ignore __all__ = [ - "build_get_boolean_true_request", - "build_get_boolean_false_request", - "build_get_int_one_million_request", - "build_get_int_negative_one_million_request", - "build_get_ten_billion_request", - "build_get_negative_ten_billion_request", - "build_float_scientific_positive_request", - "build_float_scientific_negative_request", - "build_double_decimal_positive_request", - "build_double_decimal_negative_request", - "build_string_unicode_request", - "build_string_url_encoded_request", - "build_string_url_non_encoded_request", - "build_string_empty_request", - "build_string_null_request", - "build_enum_valid_request", - "build_enum_null_request", - "build_byte_multi_byte_request", - "build_byte_empty_request", - "build_byte_null_request", - "build_date_valid_request", - "build_date_null_request", - "build_date_time_valid_request", - "build_date_time_null_request", - "build_base64_url_request", - "build_array_csv_in_path_request", - "build_unix_time_url_request", + 'build_get_boolean_true_request', + 'build_get_boolean_false_request', + 'build_get_int_one_million_request', + 'build_get_int_negative_one_million_request', + 'build_get_ten_billion_request', + 'build_get_negative_ten_billion_request', + 'build_float_scientific_positive_request', + 'build_float_scientific_negative_request', + 'build_double_decimal_positive_request', + 'build_double_decimal_negative_request', + 'build_string_unicode_request', + 'build_string_url_encoded_request', + 'build_string_url_non_encoded_request', + 'build_string_empty_request', + 'build_string_null_request', + 'build_enum_valid_request', + 'build_enum_null_request', + 'build_byte_multi_byte_request', + 'build_byte_empty_request', + 'build_byte_null_request', + 'build_date_valid_request', + 'build_date_null_request', + 'build_date_time_valid_request', + 'build_date_time_null_request', + 'build_base64_url_request', + 'build_array_csv_in_path_request', + 'build_unix_time_url_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py index dbc35d4061d..08c4ae764ad 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py @@ -1116,3 +1116,4 @@ def build_unix_time_url_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py index f1e424b5f18..ae64bf5245c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py @@ -16,7 +16,9 @@ _SERIALIZER = Serializer() -def build_get_boolean_true_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_true_request( + **kwargs: Any +) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -31,25 +33,32 @@ def build_get_boolean_true_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - bool_path = kwargs.pop("bool_path", True) # type: bool + bool_path = kwargs.pop('bool_path', True) # type: bool accept = "application/json" # Construct URL - url = "/paths/bool/true/{boolPath}" + url = '/paths/bool/true/{boolPath}' path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, "bool"), + "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_boolean_false_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_false_request( + **kwargs: Any +) -> HttpRequest: """Get false Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -64,25 +73,32 @@ def build_get_boolean_false_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - bool_path = kwargs.pop("bool_path", False) # type: bool + bool_path = kwargs.pop('bool_path', False) # type: bool accept = "application/json" # Construct URL - url = "/paths/bool/false/{boolPath}" + url = '/paths/bool/false/{boolPath}' path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, "bool"), + "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_int_one_million_request(**kwargs: Any) -> HttpRequest: +def build_get_int_one_million_request( + **kwargs: Any +) -> HttpRequest: """Get '1000000' integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -97,25 +113,32 @@ def build_get_int_one_million_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - int_path = kwargs.pop("int_path", 1000000) # type: int + int_path = kwargs.pop('int_path', 1000000) # type: int accept = "application/json" # Construct URL - url = "/paths/int/1000000/{intPath}" + url = '/paths/int/1000000/{intPath}' path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, "int"), + "intPath": _SERIALIZER.url("int_path", int_path, 'int'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: +def build_get_int_negative_one_million_request( + **kwargs: Any +) -> HttpRequest: """Get '-1000000' integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -130,25 +153,32 @@ def build_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - int_path = kwargs.pop("int_path", -1000000) # type: int + int_path = kwargs.pop('int_path', -1000000) # type: int accept = "application/json" # Construct URL - url = "/paths/int/-1000000/{intPath}" + url = '/paths/int/-1000000/{intPath}' path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, "int"), + "intPath": _SERIALIZER.url("int_path", int_path, 'int'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_ten_billion_request(**kwargs: Any) -> HttpRequest: +def build_get_ten_billion_request( + **kwargs: Any +) -> HttpRequest: """Get '10000000000' 64 bit integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -163,25 +193,32 @@ def build_get_ten_billion_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - long_path = kwargs.pop("long_path", 10000000000) # type: int + long_path = kwargs.pop('long_path', 10000000000) # type: int accept = "application/json" # Construct URL - url = "/paths/long/10000000000/{longPath}" + url = '/paths/long/10000000000/{longPath}' path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, "long"), + "longPath": _SERIALIZER.url("long_path", long_path, 'long'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: +def build_get_negative_ten_billion_request( + **kwargs: Any +) -> HttpRequest: """Get '-10000000000' 64 bit integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -196,25 +233,32 @@ def build_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - long_path = kwargs.pop("long_path", -10000000000) # type: int + long_path = kwargs.pop('long_path', -10000000000) # type: int accept = "application/json" # Construct URL - url = "/paths/long/-10000000000/{longPath}" + url = '/paths/long/-10000000000/{longPath}' path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, "long"), + "longPath": _SERIALIZER.url("long_path", long_path, 'long'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: +def build_float_scientific_positive_request( + **kwargs: Any +) -> HttpRequest: """Get '1.034E+20' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -229,25 +273,32 @@ def build_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - float_path = kwargs.pop("float_path", 103400000000000000000) # type: float + float_path = kwargs.pop('float_path', 103400000000000000000) # type: float accept = "application/json" # Construct URL - url = "/paths/float/1.034E+20/{floatPath}" + url = '/paths/float/1.034E+20/{floatPath}' path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, "float"), + "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: +def build_float_scientific_negative_request( + **kwargs: Any +) -> HttpRequest: """Get '-1.034E-20' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -262,25 +313,32 @@ def build_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - float_path = kwargs.pop("float_path", -1.034e-20) # type: float + float_path = kwargs.pop('float_path', -1.034e-20) # type: float accept = "application/json" # Construct URL - url = "/paths/float/-1.034E-20/{floatPath}" + url = '/paths/float/-1.034E-20/{floatPath}' path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, "float"), + "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: +def build_double_decimal_positive_request( + **kwargs: Any +) -> HttpRequest: """Get '9999999.999' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -295,25 +353,32 @@ def build_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - double_path = kwargs.pop("double_path", 9999999.999) # type: float + double_path = kwargs.pop('double_path', 9999999.999) # type: float accept = "application/json" # Construct URL - url = "/paths/double/9999999.999/{doublePath}" + url = '/paths/double/9999999.999/{doublePath}' path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, "float"), + "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: +def build_double_decimal_negative_request( + **kwargs: Any +) -> HttpRequest: """Get '-9999999.999' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -328,25 +393,32 @@ def build_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - double_path = kwargs.pop("double_path", -9999999.999) # type: float + double_path = kwargs.pop('double_path', -9999999.999) # type: float accept = "application/json" # Construct URL - url = "/paths/double/-9999999.999/{doublePath}" + url = '/paths/double/-9999999.999/{doublePath}' path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, "float"), + "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_unicode_request(**kwargs: Any) -> HttpRequest: +def build_string_unicode_request( + **kwargs: Any +) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -361,25 +433,32 @@ def build_string_unicode_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - string_path = kwargs.pop("string_path", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str accept = "application/json" # Construct URL - url = "/paths/string/unicode/{stringPath}" + url = '/paths/string/unicode/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_url_encoded_request(**kwargs: Any) -> HttpRequest: +def build_string_url_encoded_request( + **kwargs: Any +) -> HttpRequest: """Get 'begin!*'();:@ &=+$,/?#[]end. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -395,25 +474,32 @@ def build_string_url_encoded_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - string_path = kwargs.pop("string_path", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str accept = "application/json" # Construct URL - url = "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}" + url = '/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_url_non_encoded_request(**kwargs: Any) -> HttpRequest: +def build_string_url_non_encoded_request( + **kwargs: Any +) -> HttpRequest: """Get 'begin!*'();:@&=+$,end. https://tools.ietf.org/html/rfc3986#appendix-A 'path' accept any 'pchar' not encoded. @@ -431,25 +517,32 @@ def build_string_url_non_encoded_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - string_path = kwargs.pop("string_path", "begin!*'();:@&=+$,end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str accept = "application/json" # Construct URL - url = "/paths/string/begin!*'();:@&=+$,end/{stringPath}" + url = '/paths/string/begin!*\'();:@&=+$,end/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str", skip_quote=True), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_empty_request(**kwargs: Any) -> HttpRequest: +def build_string_empty_request( + **kwargs: Any +) -> HttpRequest: """Get ''. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -464,25 +557,33 @@ def build_string_empty_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - string_path = kwargs.pop("string_path", "") # type: str + string_path = kwargs.pop('string_path', "") # type: str accept = "application/json" # Construct URL - url = "/paths/string/empty/{stringPath}" + url = '/paths/string/empty/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_null_request(string_path: str, **kwargs: Any) -> HttpRequest: +def build_string_null_request( + string_path: str, + **kwargs: Any +) -> HttpRequest: """Get null (should throw). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -498,21 +599,29 @@ def build_string_null_request(string_path: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/string/null/{stringPath}" + url = '/paths/string/null/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_enum_valid_request(enum_path: str, **kwargs: Any) -> HttpRequest: +def build_enum_valid_request( + enum_path: str, + **kwargs: Any +) -> HttpRequest: """Get using uri with 'green color' in path parameter. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -529,21 +638,29 @@ def build_enum_valid_request(enum_path: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/enum/green%20color/{enumPath}" + url = '/paths/enum/green%20color/{enumPath}' path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, "str"), + "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_enum_null_request(enum_path: str, **kwargs: Any) -> HttpRequest: +def build_enum_null_request( + enum_path: str, + **kwargs: Any +) -> HttpRequest: """Get null (should throw on the client before the request is sent on wire). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -560,21 +677,29 @@ def build_enum_null_request(enum_path: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/string/null/{enumPath}" + url = '/paths/string/null/{enumPath}' path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, "str"), + "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_byte_multi_byte_request(byte_path: bytearray, **kwargs: Any) -> HttpRequest: +def build_byte_multi_byte_request( + byte_path: bytearray, + **kwargs: Any +) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -590,21 +715,28 @@ def build_byte_multi_byte_request(byte_path: bytearray, **kwargs: Any) -> HttpRe accept = "application/json" # Construct URL - url = "/paths/byte/multibyte/{bytePath}" + url = '/paths/byte/multibyte/{bytePath}' path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), + "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_byte_empty_request(**kwargs: Any) -> HttpRequest: +def build_byte_empty_request( + **kwargs: Any +) -> HttpRequest: """Get '' as byte array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -619,25 +751,33 @@ def build_byte_empty_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - byte_path = kwargs.pop("byte_path", bytearray("", encoding="utf-8")) # type: bytearray + byte_path = kwargs.pop('byte_path', bytearray("", encoding="utf-8")) # type: bytearray accept = "application/json" # Construct URL - url = "/paths/byte/empty/{bytePath}" + url = '/paths/byte/empty/{bytePath}' path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), + "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_byte_null_request(byte_path: bytearray, **kwargs: Any) -> HttpRequest: +def build_byte_null_request( + byte_path: bytearray, + **kwargs: Any +) -> HttpRequest: """Get null as byte array (should throw). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -653,21 +793,28 @@ def build_byte_null_request(byte_path: bytearray, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/byte/null/{bytePath}" + url = '/paths/byte/null/{bytePath}' path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), + "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_valid_request(**kwargs: Any) -> HttpRequest: +def build_date_valid_request( + **kwargs: Any +) -> HttpRequest: """Get '2012-01-01' as date. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -682,25 +829,33 @@ def build_date_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - date_path = kwargs.pop("date_path", "2012-01-01") # type: datetime.date + date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date accept = "application/json" # Construct URL - url = "/paths/date/2012-01-01/{datePath}" + url = '/paths/date/2012-01-01/{datePath}' path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, "date"), + "datePath": _SERIALIZER.url("date_path", date_path, 'date'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_null_request(date_path: datetime.date, **kwargs: Any) -> HttpRequest: +def build_date_null_request( + date_path: datetime.date, + **kwargs: Any +) -> HttpRequest: """Get null as date - this should throw or be unusable on the client side, depending on date representation. @@ -717,21 +872,28 @@ def build_date_null_request(date_path: datetime.date, **kwargs: Any) -> HttpRequ accept = "application/json" # Construct URL - url = "/paths/date/null/{datePath}" + url = '/paths/date/null/{datePath}' path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, "date"), + "datePath": _SERIALIZER.url("date_path", date_path, 'date'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_time_valid_request(**kwargs: Any) -> HttpRequest: +def build_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: """Get '2012-01-01T01:01:01Z' as date-time. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -747,25 +909,33 @@ def build_date_time_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - date_time_path = kwargs.pop("date_time_path", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime accept = "application/json" # Construct URL - url = "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}" + url = '/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}' path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, "iso-8601"), + "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_time_null_request(date_time_path: datetime.datetime, **kwargs: Any) -> HttpRequest: +def build_date_time_null_request( + date_time_path: datetime.datetime, + **kwargs: Any +) -> HttpRequest: """Get null as date-time, should be disallowed or throw depending on representation of date-time. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -781,21 +951,29 @@ def build_date_time_null_request(date_time_path: datetime.datetime, **kwargs: An accept = "application/json" # Construct URL - url = "/paths/datetime/null/{dateTimePath}" + url = '/paths/datetime/null/{dateTimePath}' path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, "iso-8601"), + "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_base64_url_request(base64_url_path: bytes, **kwargs: Any) -> HttpRequest: +def build_base64_url_request( + base64_url_path: bytes, + **kwargs: Any +) -> HttpRequest: """Get 'lorem' encoded value as 'bG9yZW0' (base64url). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -811,21 +989,29 @@ def build_base64_url_request(base64_url_path: bytes, **kwargs: Any) -> HttpReque accept = "application/json" # Construct URL - url = "/paths/string/bG9yZW0/{base64UrlPath}" + url = '/paths/string/bG9yZW0/{base64UrlPath}' path_format_arguments = { - "base64UrlPath": _SERIALIZER.url("base64_url_path", base64_url_path, "base64"), + "base64UrlPath": _SERIALIZER.url("base64_url_path", base64_url_path, 'base64'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_csv_in_path_request(array_path: List[str], **kwargs: Any) -> HttpRequest: +def build_array_csv_in_path_request( + array_path: List[str], + **kwargs: Any +) -> HttpRequest: """Get an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -843,23 +1029,29 @@ def build_array_csv_in_path_request(array_path: List[str], **kwargs: Any) -> Htt accept = "application/json" # Construct URL - url = ( - "/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}" - ) + url = '/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}' path_format_arguments = { - "arrayPath": _SERIALIZER.url("array_path", array_path, "[str]", div=","), + "arrayPath": _SERIALIZER.url("array_path", array_path, '[str]', div=','), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_unix_time_url_request(unix_time_url_path: datetime.datetime, **kwargs: Any) -> HttpRequest: +def build_unix_time_url_request( + unix_time_url_path: datetime.datetime, + **kwargs: Any +) -> HttpRequest: """Get the date 2016-04-13 encoded value as '1460505600' (Unix time). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -875,15 +1067,21 @@ def build_unix_time_url_request(unix_time_url_path: datetime.datetime, **kwargs: accept = "application/json" # Construct URL - url = "/paths/int/1460505600/{unixTimeUrlPath}" + url = '/paths/int/1460505600/{unixTimeUrlPath}' path_format_arguments = { - "unixTimeUrlPath": _SERIALIZER.url("unix_time_url_path", unix_time_url_path, "unix-time"), + "unixTimeUrlPath": _SERIALIZER.url("unix_time_url_path", unix_time_url_path, 'unix-time'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py index 3017ee4219d..85526eb0539 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py @@ -80,39 +80,39 @@ from ._request_builders import build_array_string_pipes_valid_request # type: ignore __all__ = [ - "build_get_boolean_true_request", - "build_get_boolean_false_request", - "build_get_boolean_null_request", - "build_get_int_one_million_request", - "build_get_int_negative_one_million_request", - "build_get_int_null_request", - "build_get_ten_billion_request", - "build_get_negative_ten_billion_request", - "build_get_long_null_request", - "build_float_scientific_positive_request", - "build_float_scientific_negative_request", - "build_float_null_request", - "build_double_decimal_positive_request", - "build_double_decimal_negative_request", - "build_double_null_request", - "build_string_unicode_request", - "build_string_url_encoded_request", - "build_string_empty_request", - "build_string_null_request", - "build_enum_valid_request", - "build_enum_null_request", - "build_byte_multi_byte_request", - "build_byte_empty_request", - "build_byte_null_request", - "build_date_valid_request", - "build_date_null_request", - "build_date_time_valid_request", - "build_date_time_null_request", - "build_array_string_csv_valid_request", - "build_array_string_csv_null_request", - "build_array_string_csv_empty_request", - "build_array_string_no_collection_format_empty_request", - "build_array_string_ssv_valid_request", - "build_array_string_tsv_valid_request", - "build_array_string_pipes_valid_request", + 'build_get_boolean_true_request', + 'build_get_boolean_false_request', + 'build_get_boolean_null_request', + 'build_get_int_one_million_request', + 'build_get_int_negative_one_million_request', + 'build_get_int_null_request', + 'build_get_ten_billion_request', + 'build_get_negative_ten_billion_request', + 'build_get_long_null_request', + 'build_float_scientific_positive_request', + 'build_float_scientific_negative_request', + 'build_float_null_request', + 'build_double_decimal_positive_request', + 'build_double_decimal_negative_request', + 'build_double_null_request', + 'build_string_unicode_request', + 'build_string_url_encoded_request', + 'build_string_empty_request', + 'build_string_null_request', + 'build_enum_valid_request', + 'build_enum_null_request', + 'build_byte_multi_byte_request', + 'build_byte_empty_request', + 'build_byte_null_request', + 'build_date_valid_request', + 'build_date_null_request', + 'build_date_time_valid_request', + 'build_date_time_null_request', + 'build_array_string_csv_valid_request', + 'build_array_string_csv_null_request', + 'build_array_string_csv_empty_request', + 'build_array_string_no_collection_format_empty_request', + 'build_array_string_ssv_valid_request', + 'build_array_string_tsv_valid_request', + 'build_array_string_pipes_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py index 41341abf2cf..2b54623e377 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py @@ -1465,3 +1465,4 @@ def build_array_string_pipes_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py index b6fb2bef914..23f49a0d798 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py @@ -14,7 +14,9 @@ _SERIALIZER = Serializer() -def build_get_boolean_true_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_true_request( + **kwargs: Any +) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -29,24 +31,32 @@ def build_get_boolean_true_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - bool_query = kwargs.pop("bool_query", True) # type: bool + bool_query = kwargs.pop('bool_query', True) # type: bool accept = "application/json" # Construct URL - url = "/queries/bool/true" + url = '/queries/bool/true' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") + query_parameters['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_boolean_false_request(**kwargs: Any) -> HttpRequest: +def build_get_boolean_false_request( + **kwargs: Any +) -> HttpRequest: """Get false Boolean value on path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -61,24 +71,34 @@ def build_get_boolean_false_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - bool_query = kwargs.pop("bool_query", False) # type: bool + bool_query = kwargs.pop('bool_query', False) # type: bool accept = "application/json" # Construct URL - url = "/queries/bool/false" + url = '/queries/bool/false' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") + query_parameters['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_boolean_null_request(*, bool_query: Optional[bool] = None, **kwargs: Any) -> HttpRequest: +def build_get_boolean_null_request( + *, + bool_query: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: """Get null Boolean value on query (query string should be absent). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -94,21 +114,29 @@ def build_get_boolean_null_request(*, bool_query: Optional[bool] = None, **kwarg accept = "application/json" # Construct URL - url = "/queries/bool/null" + url = '/queries/bool/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if bool_query is not None: - query_parameters["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") + query_parameters['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_int_one_million_request(**kwargs: Any) -> HttpRequest: +def build_get_int_one_million_request( + **kwargs: Any +) -> HttpRequest: """Get '1000000' integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -123,24 +151,32 @@ def build_get_int_one_million_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - int_query = kwargs.pop("int_query", 1000000) # type: int + int_query = kwargs.pop('int_query', 1000000) # type: int accept = "application/json" # Construct URL - url = "/queries/int/1000000" + url = '/queries/int/1000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") + query_parameters['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: +def build_get_int_negative_one_million_request( + **kwargs: Any +) -> HttpRequest: """Get '-1000000' integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -155,24 +191,34 @@ def build_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - int_query = kwargs.pop("int_query", -1000000) # type: int + int_query = kwargs.pop('int_query', -1000000) # type: int accept = "application/json" # Construct URL - url = "/queries/int/-1000000" + url = '/queries/int/-1000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") + query_parameters['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_int_null_request(*, int_query: Optional[int] = None, **kwargs: Any) -> HttpRequest: +def build_get_int_null_request( + *, + int_query: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: """Get null integer value (no query parameter). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -188,21 +234,29 @@ def build_get_int_null_request(*, int_query: Optional[int] = None, **kwargs: Any accept = "application/json" # Construct URL - url = "/queries/int/null" + url = '/queries/int/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if int_query is not None: - query_parameters["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") + query_parameters['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_ten_billion_request(**kwargs: Any) -> HttpRequest: +def build_get_ten_billion_request( + **kwargs: Any +) -> HttpRequest: """Get '10000000000' 64 bit integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -217,24 +271,32 @@ def build_get_ten_billion_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - long_query = kwargs.pop("long_query", 10000000000) # type: int + long_query = kwargs.pop('long_query', 10000000000) # type: int accept = "application/json" # Construct URL - url = "/queries/long/10000000000" + url = '/queries/long/10000000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["longQuery"] = _SERIALIZER.query("long_query", long_query, "long") + query_parameters['longQuery'] = _SERIALIZER.query("long_query", long_query, 'long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: +def build_get_negative_ten_billion_request( + **kwargs: Any +) -> HttpRequest: """Get '-10000000000' 64 bit integer value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -249,24 +311,34 @@ def build_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - long_query = kwargs.pop("long_query", -10000000000) # type: int + long_query = kwargs.pop('long_query', -10000000000) # type: int accept = "application/json" # Construct URL - url = "/queries/long/-10000000000" + url = '/queries/long/-10000000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["longQuery"] = _SERIALIZER.query("long_query", long_query, "long") + query_parameters['longQuery'] = _SERIALIZER.query("long_query", long_query, 'long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_long_null_request(*, long_query: Optional[int] = None, **kwargs: Any) -> HttpRequest: +def build_get_long_null_request( + *, + long_query: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: """Get 'null 64 bit integer value (no query param in uri). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -282,21 +354,29 @@ def build_get_long_null_request(*, long_query: Optional[int] = None, **kwargs: A accept = "application/json" # Construct URL - url = "/queries/long/null" + url = '/queries/long/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if long_query is not None: - query_parameters["longQuery"] = _SERIALIZER.query("long_query", long_query, "long") + query_parameters['longQuery'] = _SERIALIZER.query("long_query", long_query, 'long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: +def build_float_scientific_positive_request( + **kwargs: Any +) -> HttpRequest: """Get '1.034E+20' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -311,24 +391,32 @@ def build_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - float_query = kwargs.pop("float_query", 103400000000000000000) # type: float + float_query = kwargs.pop('float_query', 103400000000000000000) # type: float accept = "application/json" # Construct URL - url = "/queries/float/1.034E+20" + url = '/queries/float/1.034E+20' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") + query_parameters['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: +def build_float_scientific_negative_request( + **kwargs: Any +) -> HttpRequest: """Get '-1.034E-20' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -343,24 +431,34 @@ def build_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - float_query = kwargs.pop("float_query", -1.034e-20) # type: float + float_query = kwargs.pop('float_query', -1.034e-20) # type: float accept = "application/json" # Construct URL - url = "/queries/float/-1.034E-20" + url = '/queries/float/-1.034E-20' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") + query_parameters['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_float_null_request(*, float_query: Optional[float] = None, **kwargs: Any) -> HttpRequest: +def build_float_null_request( + *, + float_query: Optional[float] = None, + **kwargs: Any +) -> HttpRequest: """Get null numeric value (no query parameter). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -376,21 +474,29 @@ def build_float_null_request(*, float_query: Optional[float] = None, **kwargs: A accept = "application/json" # Construct URL - url = "/queries/float/null" + url = '/queries/float/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if float_query is not None: - query_parameters["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") + query_parameters['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: +def build_double_decimal_positive_request( + **kwargs: Any +) -> HttpRequest: """Get '9999999.999' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -405,24 +511,32 @@ def build_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - double_query = kwargs.pop("double_query", 9999999.999) # type: float + double_query = kwargs.pop('double_query', 9999999.999) # type: float accept = "application/json" # Construct URL - url = "/queries/double/9999999.999" + url = '/queries/double/9999999.999' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") + query_parameters['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: +def build_double_decimal_negative_request( + **kwargs: Any +) -> HttpRequest: """Get '-9999999.999' numeric value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -437,24 +551,34 @@ def build_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - double_query = kwargs.pop("double_query", -9999999.999) # type: float + double_query = kwargs.pop('double_query', -9999999.999) # type: float accept = "application/json" # Construct URL - url = "/queries/double/-9999999.999" + url = '/queries/double/-9999999.999' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") + query_parameters['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_double_null_request(*, double_query: Optional[float] = None, **kwargs: Any) -> HttpRequest: +def build_double_null_request( + *, + double_query: Optional[float] = None, + **kwargs: Any +) -> HttpRequest: """Get null numeric value (no query parameter). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -470,21 +594,29 @@ def build_double_null_request(*, double_query: Optional[float] = None, **kwargs: accept = "application/json" # Construct URL - url = "/queries/double/null" + url = '/queries/double/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if double_query is not None: - query_parameters["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") + query_parameters['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_string_unicode_request(**kwargs: Any) -> HttpRequest: +def build_string_unicode_request( + **kwargs: Any +) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -499,24 +631,32 @@ def build_string_unicode_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - string_query = kwargs.pop("string_query", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_query = kwargs.pop('string_query', "啊齄丂狛狜隣郎隣兀﨩") # type: str accept = "application/json" # Construct URL - url = "/queries/string/unicode/" + url = '/queries/string/unicode/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_string_url_encoded_request(**kwargs: Any) -> HttpRequest: +def build_string_url_encoded_request( + **kwargs: Any +) -> HttpRequest: """Get 'begin!*'();:@ &=+$,/?#[]end. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -532,24 +672,32 @@ def build_string_url_encoded_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - string_query = kwargs.pop("string_query", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_query = kwargs.pop('string_query', "begin!*'();:@ &=+$,/?#[]end") # type: str accept = "application/json" # Construct URL - url = "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend" + url = '/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_string_empty_request(**kwargs: Any) -> HttpRequest: +def build_string_empty_request( + **kwargs: Any +) -> HttpRequest: """Get ''. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -564,24 +712,34 @@ def build_string_empty_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - string_query = kwargs.pop("string_query", "") # type: str + string_query = kwargs.pop('string_query', "") # type: str accept = "application/json" # Construct URL - url = "/queries/string/empty" + url = '/queries/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_string_null_request(*, string_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_string_null_request( + *, + string_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get null (no query parameter in url). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -597,21 +755,31 @@ def build_string_null_request(*, string_query: Optional[str] = None, **kwargs: A accept = "application/json" # Construct URL - url = "/queries/string/null" + url = '/queries/string/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if string_query is not None: - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_enum_valid_request(*, enum_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_enum_valid_request( + *, + enum_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get using uri with query parameter 'green color'. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -628,21 +796,31 @@ def build_enum_valid_request(*, enum_query: Optional[str] = None, **kwargs: Any) accept = "application/json" # Construct URL - url = "/queries/enum/green%20color" + url = '/queries/enum/green%20color' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if enum_query is not None: - query_parameters["enumQuery"] = _SERIALIZER.query("enum_query", enum_query, "str") + query_parameters['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_enum_null_request(*, enum_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_enum_null_request( + *, + enum_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Get null (no query parameter in url). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -659,21 +837,31 @@ def build_enum_null_request(*, enum_query: Optional[str] = None, **kwargs: Any) accept = "application/json" # Construct URL - url = "/queries/enum/null" + url = '/queries/enum/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if enum_query is not None: - query_parameters["enumQuery"] = _SERIALIZER.query("enum_query", enum_query, "str") + query_parameters['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_byte_multi_byte_request(*, byte_query: Optional[bytearray] = None, **kwargs: Any) -> HttpRequest: +def build_byte_multi_byte_request( + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any +) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -689,21 +877,29 @@ def build_byte_multi_byte_request(*, byte_query: Optional[bytearray] = None, **k accept = "application/json" # Construct URL - url = "/queries/byte/multibyte" + url = '/queries/byte/multibyte' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if byte_query is not None: - query_parameters["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") + query_parameters['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_byte_empty_request(**kwargs: Any) -> HttpRequest: +def build_byte_empty_request( + **kwargs: Any +) -> HttpRequest: """Get '' as byte array. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -718,24 +914,34 @@ def build_byte_empty_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - byte_query = kwargs.pop("byte_query", bytearray("", encoding="utf-8")) # type: bytearray + byte_query = kwargs.pop('byte_query', bytearray("", encoding="utf-8")) # type: bytearray accept = "application/json" # Construct URL - url = "/queries/byte/empty" + url = '/queries/byte/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") + query_parameters['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_byte_null_request(*, byte_query: Optional[bytearray] = None, **kwargs: Any) -> HttpRequest: +def build_byte_null_request( + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any +) -> HttpRequest: """Get null as byte array (no query parameters in uri). See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -751,21 +957,29 @@ def build_byte_null_request(*, byte_query: Optional[bytearray] = None, **kwargs: accept = "application/json" # Construct URL - url = "/queries/byte/null" + url = '/queries/byte/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if byte_query is not None: - query_parameters["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") + query_parameters['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_date_valid_request(**kwargs: Any) -> HttpRequest: +def build_date_valid_request( + **kwargs: Any +) -> HttpRequest: """Get '2012-01-01' as date. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -780,24 +994,34 @@ def build_date_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - date_query = kwargs.pop("date_query", "2012-01-01") # type: datetime.date + date_query = kwargs.pop('date_query', "2012-01-01") # type: datetime.date accept = "application/json" # Construct URL - url = "/queries/date/2012-01-01" + url = '/queries/date/2012-01-01' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["dateQuery"] = _SERIALIZER.query("date_query", date_query, "date") + query_parameters['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_date_null_request(*, date_query: Optional[datetime.date] = None, **kwargs: Any) -> HttpRequest: +def build_date_null_request( + *, + date_query: Optional[datetime.date] = None, + **kwargs: Any +) -> HttpRequest: """Get null as date - this should result in no query parameters in uri. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -813,21 +1037,29 @@ def build_date_null_request(*, date_query: Optional[datetime.date] = None, **kwa accept = "application/json" # Construct URL - url = "/queries/date/null" + url = '/queries/date/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if date_query is not None: - query_parameters["dateQuery"] = _SERIALIZER.query("date_query", date_query, "date") + query_parameters['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_date_time_valid_request(**kwargs: Any) -> HttpRequest: +def build_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: """Get '2012-01-01T01:01:01Z' as date-time. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -843,24 +1075,34 @@ def build_date_time_valid_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - date_time_query = kwargs.pop("date_time_query", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_query = kwargs.pop('date_time_query', "2012-01-01T01:01:01Z") # type: datetime.datetime accept = "application/json" # Construct URL - url = "/queries/datetime/2012-01-01T01%3A01%3A01Z" + url = '/queries/datetime/2012-01-01T01%3A01%3A01Z' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["dateTimeQuery"] = _SERIALIZER.query("date_time_query", date_time_query, "iso-8601") + query_parameters['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_date_time_null_request(*, date_time_query: Optional[datetime.datetime] = None, **kwargs: Any) -> HttpRequest: +def build_date_time_null_request( + *, + date_time_query: Optional[datetime.datetime] = None, + **kwargs: Any +) -> HttpRequest: """Get null as date-time, should result in no query parameters in uri. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -876,21 +1118,31 @@ def build_date_time_null_request(*, date_time_query: Optional[datetime.datetime] accept = "application/json" # Construct URL - url = "/queries/datetime/null" + url = '/queries/datetime/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if date_time_query is not None: - query_parameters["dateTimeQuery"] = _SERIALIZER.query("date_time_query", date_time_query, "iso-8601") + query_parameters['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_array_string_csv_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: +def build_array_string_csv_valid_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -908,21 +1160,31 @@ def build_array_string_csv_valid_request(*, array_query: Optional[List[str]] = N accept = "application/json" # Construct URL - url = "/queries/array/csv/string/valid" + url = '/queries/array/csv/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_array_string_csv_null_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: +def build_array_string_csv_null_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get a null array of string using the csv-array format. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -938,21 +1200,31 @@ def build_array_string_csv_null_request(*, array_query: Optional[List[str]] = No accept = "application/json" # Construct URL - url = "/queries/array/csv/string/null" + url = '/queries/array/csv/string/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_array_string_csv_empty_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: +def build_array_string_csv_empty_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get an empty array [] of string using the csv-array format. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -968,22 +1240,30 @@ def build_array_string_csv_empty_request(*, array_query: Optional[List[str]] = N accept = "application/json" # Construct URL - url = "/queries/array/csv/string/empty" + url = '/queries/array/csv/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_array_string_no_collection_format_empty_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: """Array query has no defined collection format, should default to csv. Pass in ['hello', 'nihao', 'bonjour'] for the 'arrayQuery' parameter to the service. @@ -1001,21 +1281,31 @@ def build_array_string_no_collection_format_empty_request( accept = "application/json" # Construct URL - url = "/queries/array/none/string/empty" + url = '/queries/array/none/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_array_string_ssv_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: +def build_array_string_ssv_valid_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format. @@ -1033,21 +1323,31 @@ def build_array_string_ssv_valid_request(*, array_query: Optional[List[str]] = N accept = "application/json" # Construct URL - url = "/queries/array/ssv/string/valid" + url = '/queries/array/ssv/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=" ") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_array_string_tsv_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: +def build_array_string_tsv_valid_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format. @@ -1065,21 +1365,31 @@ def build_array_string_tsv_valid_request(*, array_query: Optional[List[str]] = N accept = "application/json" # Construct URL - url = "/queries/array/tsv/string/valid" + url = '/queries/array/tsv/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=" ") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_array_string_pipes_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: +def build_array_string_pipes_valid_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format. @@ -1097,15 +1407,22 @@ def build_array_string_pipes_valid_request(*, array_query: Optional[List[str]] = accept = "application/json" # Construct URL - url = "/queries/array/pipes/string/valid" + url = '/queries/array/pipes/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div="|") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div='|') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/setup.py index 8c5a64d2402..1a1b2e567d4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/__init__.py index 4126273e3d8..4681c978cb1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestUrlMutliCollectionFormatTestService"] +__all__ = ['AutoRestUrlMutliCollectionFormatTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_auto_rest_url_mutli_collection_format_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_auto_rest_url_mutli_collection_format_test_service.py index 97c01b02d4e..ba8b3f066f5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_auto_rest_url_mutli_collection_format_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_auto_rest_url_mutli_collection_format_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlMutliCollectionFormatTestService: """Test Infrastructure for AutoRest. @@ -27,8 +26,13 @@ class AutoRestUrlMutliCollectionFormatTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestUrlMutliCollectionFormatTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_configuration.py index 48a6a8e6163..a1823a406ad 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): +class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlMutliCollectionFormatTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestUrlMutliCollectionFormatTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresturlmutlicollectionformattestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturlmutlicollectionformattestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/__init__.py index dc51912a904..2116fb21264 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_url_mutli_collection_format_test_service import AutoRestUrlMutliCollectionFormatTestService - -__all__ = ["AutoRestUrlMutliCollectionFormatTestService"] +__all__ = ['AutoRestUrlMutliCollectionFormatTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_auto_rest_url_mutli_collection_format_test_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_auto_rest_url_mutli_collection_format_test_service.py index 237de794da0..8acd2f00318 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_auto_rest_url_mutli_collection_format_test_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_auto_rest_url_mutli_collection_format_test_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlMutliCollectionFormatTestService: """Test Infrastructure for AutoRest. @@ -27,7 +26,12 @@ class AutoRestUrlMutliCollectionFormatTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestUrlMutliCollectionFormatTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `urlmulticollectionformatlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_configuration.py index 30b9cb9fe74..2e326f2c85b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): +class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlMutliCollectionFormatTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestUrlMutliCollectionFormatTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresturlmutlicollectionformattestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturlmutlicollectionformattestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py index deed18c33fd..b145ea5eb5c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_array_string_multi_valid_request # type: ignore __all__ = [ - "build_array_string_multi_null_request", - "build_array_string_multi_empty_request", - "build_array_string_multi_valid_request", + 'build_array_string_multi_null_request', + 'build_array_string_multi_empty_request', + 'build_array_string_multi_valid_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py index 4751a8d2f58..337e3107386 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py @@ -142,3 +142,4 @@ def build_array_string_multi_valid_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py index 51a4811a090..5d8856f36b2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py @@ -14,7 +14,11 @@ _SERIALIZER.client_side_validation = False -def build_array_string_multi_null_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: +def build_array_string_multi_null_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get a null array of string using the multi-array format. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -30,23 +34,31 @@ def build_array_string_multi_null_request(*, array_query: Optional[List[str]] = accept = "application/json" # Construct URL - url = "/queries/array/multi/string/null" + url = '/queries/array/multi/string/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = [ - _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query - ] + query_parameters['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_array_string_multi_empty_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_array_string_multi_empty_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get an empty array [] of string using the multi-array format. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -62,23 +74,31 @@ def build_array_string_multi_empty_request(*, array_query: Optional[List[str]] = accept = "application/json" # Construct URL - url = "/queries/array/multi/string/empty" + url = '/queries/array/multi/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = [ - _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query - ] + query_parameters['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_array_string_multi_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_array_string_multi_valid_request( + *, + array_query: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the mult-array format. @@ -96,17 +116,22 @@ def build_array_string_multi_valid_request(*, array_query: Optional[List[str]] = accept = "application/json" # Construct URL - url = "/queries/array/multi/string/valid" + url = '/queries/array/multi/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = [ - _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query - ] + query_parameters['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/setup.py index 1ec830f56e0..05d986a5b18 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. No server backend exists for these tests. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/__init__.py index c8dbba243f7..a7fe6d7f4b4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestValidationTest"] +__all__ = ['AutoRestValidationTest'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_auto_rest_validation_test.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_auto_rest_validation_test.py index 0b34decbf20..6968c3c9187 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_auto_rest_validation_test.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_auto_rest_validation_test.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestValidationTest: """Test Infrastructure for AutoRest. No server backend exists for these tests. @@ -32,14 +31,21 @@ class AutoRestValidationTest: :paramtype api_version: str """ - def __init__(self, subscription_id: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + subscription_id: str, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestValidationTestConfiguration(subscription_id=subscription_id, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_configuration.py index b204dd9e5a3..4ae96310066 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_configuration.py @@ -14,7 +14,7 @@ from ._version import VERSION -class AutoRestValidationTestConfiguration(Configuration): +class AutoRestValidationTestConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestValidationTest. Note that all parameters used to create this instance are saved as instance @@ -22,32 +22,38 @@ class AutoRestValidationTestConfiguration(Configuration): :param subscription_id: Subscription ID. :type subscription_id: str - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + **kwargs: Any + ) -> None: super(AutoRestValidationTestConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.subscription_id = subscription_id self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestvalidationtest/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestvalidationtest/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/__init__.py index e0ac5945ea6..ca3a949b63f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_validation_test import AutoRestValidationTest - -__all__ = ["AutoRestValidationTest"] +__all__ = ['AutoRestValidationTest'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_auto_rest_validation_test.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_auto_rest_validation_test.py index dffe62c7b5e..0fa2a468f49 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_auto_rest_validation_test.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_auto_rest_validation_test.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestValidationTest: """Test Infrastructure for AutoRest. No server backend exists for these tests. @@ -32,14 +31,25 @@ class AutoRestValidationTest: :paramtype api_version: str """ - def __init__(self, subscription_id: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestValidationTestConfiguration(subscription_id=subscription_id, **kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `validationlowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_configuration.py index b94ec5a513f..745dd7740e0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/aio/_configuration.py @@ -14,7 +14,7 @@ from .._version import VERSION -class AutoRestValidationTestConfiguration(Configuration): +class AutoRestValidationTestConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestValidationTest. Note that all parameters used to create this instance are saved as instance @@ -22,29 +22,37 @@ class AutoRestValidationTestConfiguration(Configuration): :param subscription_id: Subscription ID. :type subscription_id: str - :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this default value may result in unsupported behavior. + :keyword api_version: Api Version. The default value is "1.0.0". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + **kwargs: Any + ) -> None: super(AutoRestValidationTestConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.subscription_id = subscription_id self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestvalidationtest/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestvalidationtest/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py index 3d6cfc6b060..83fae29522c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py @@ -18,8 +18,8 @@ from ._request_builders import build_post_with_constant_in_body_request # type: ignore __all__ = [ - "build_validation_of_method_parameters_request", - "build_validation_of_body_request", - "build_get_with_constant_in_path_request", - "build_post_with_constant_in_body_request", + 'build_validation_of_method_parameters_request', + 'build_validation_of_body_request', + 'build_get_with_constant_in_path_request', + 'build_post_with_constant_in_body_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py index e66abafa14d..4e82704cfe7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py @@ -15,8 +15,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Dict, Optional, TypeVar - - T = TypeVar("T") + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -53,18 +52,25 @@ def build_validation_of_method_parameters_request( response.json() == { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } @@ -136,18 +142,25 @@ def build_validation_of_body_request( json = { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } @@ -156,18 +169,25 @@ def build_validation_of_body_request( response.json() == { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } @@ -271,18 +291,25 @@ def build_post_with_constant_in_body_request( json = { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } @@ -291,18 +318,25 @@ def build_post_with_constant_in_body_request( response.json() == { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } @@ -332,3 +366,4 @@ def build_post_with_constant_in_body_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py index 0073c6020bc..abbfd6f6e57 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py @@ -11,15 +11,17 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() def build_validation_of_method_parameters_request( - subscription_id: str, resource_group_name: str, id: int, **kwargs: Any + subscription_id: str, + resource_group_name: str, + id: int, + **kwargs: Any ) -> HttpRequest: """Validates input parameters on the method. See swagger for details. @@ -44,47 +46,58 @@ def build_validation_of_method_parameters_request( response.json() == { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } """ - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str accept = "application/json" # Construct URL - url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" + url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=10, min_length=3, pattern=r"[a-zA-Z0-9\']+" - ), - "id": _SERIALIZER.url("id", id, "int", maximum=1000, minimum=100, multiple=10), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9\']+'), + "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["apiVersion"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_validation_of_body_request( @@ -125,18 +138,25 @@ def build_validation_of_body_request( json = { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } @@ -145,55 +165,68 @@ def build_validation_of_body_request( response.json() == { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } """ - api_version = kwargs.pop("api_version", "1.0.0") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "1.0.0") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" + url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=10, min_length=3, pattern=r"[a-zA-Z0-9]+" - ), - "id": _SERIALIZER.url("id", id, "int", maximum=1000, minimum=100, multiple=10), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'), + "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["apiVersion"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) -def build_get_with_constant_in_path_request(**kwargs: Any) -> HttpRequest: +def build_get_with_constant_in_path_request( + **kwargs: Any +) -> HttpRequest: """get_with_constant_in_path. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -208,21 +241,28 @@ def build_get_with_constant_in_path_request(**kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - constant_param = kwargs.pop("constant_param", "constant") # type: str + constant_param = kwargs.pop('constant_param', "constant") # type: str # Construct URL - url = "/validation/constantsInPath/{constantParam}/value" + url = '/validation/constantsInPath/{constantParam}/value' path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, "str"), + "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), } url = _format_url_section(url, **path_format_arguments) - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) def build_post_with_constant_in_body_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: """post_with_constant_in_body. @@ -250,18 +290,25 @@ def build_post_with_constant_in_body_request( json = { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } @@ -270,31 +317,38 @@ def build_post_with_constant_in_body_request( response.json() == { "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. "child": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". "count": 0 # Optional. Count. }, "constChild": { - "constProperty": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constProperty2": "constant2" # Default value is "constant2". Constant string2. Has constant value: "constant2". + "constProperty": "constant", # Default value is "constant". Constant + string. Has constant value: "constant". + "constProperty2": "constant2" # Default value is "constant2". + Constant string2. Has constant value: "constant2". }, "constInt": 0, # Default value is 0. Constant int. Has constant value: 0. - "constString": "constant", # Default value is "constant". Constant string. Has constant value: "constant". - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is "constant_string_as_enum". Constant string as Enum. The only acceptable values to pass in are None and "constant_string_as_enum". The default value is None. + "constString": "constant", # Default value is "constant". Constant string. + Has constant value: "constant". + "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is + "constant_string_as_enum". Constant string as Enum. The only acceptable values to + pass in are None and "constant_string_as_enum". The default value is None. "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 elements. + "str" # Optional. Non required array of unique items from 0 to 6 + elements. ], "image": "str" # Optional. Image URL representing the product. } """ - constant_param = kwargs.pop("constant_param", "constant") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + constant_param = kwargs.pop('constant_param', "constant") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/validation/constantsInPath/{constantParam}/value" + url = '/validation/constantsInPath/{constantParam}/value' path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, "str"), + "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -302,7 +356,15 @@ def build_post_with_constant_in_body_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/setup.py index 08f2e587366..0336771b01f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/__init__.py index 314965dfed4..947d93c2fb2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATXMLService"] +__all__ = ['AutoRestSwaggerBATXMLService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_auto_rest_swagger_batxml_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_auto_rest_swagger_batxml_service.py index fe54fc782f5..6aade27c481 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_auto_rest_swagger_batxml_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_auto_rest_swagger_batxml_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATXMLService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,8 +26,13 @@ class AutoRestSwaggerBATXMLService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATXMLServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_configuration.py index e476b3c8743..8042eb9a355 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): +class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATXMLService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATXMLServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatxmlservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatxmlservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/__init__.py index 135889b0d43..6625d429aa0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_batxml_service import AutoRestSwaggerBATXMLService - -__all__ = ["AutoRestSwaggerBATXMLService"] +__all__ = ['AutoRestSwaggerBATXMLService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_auto_rest_swagger_batxml_service.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_auto_rest_swagger_batxml_service.py index 2c94288d04c..6016c358020 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_auto_rest_swagger_batxml_service.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_auto_rest_swagger_batxml_service.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATXMLService: """Test Infrastructure for AutoRest Swagger BAT. @@ -27,7 +26,12 @@ class AutoRestSwaggerBATXMLService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATXMLServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `xmlservicelowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_configuration.py index 8cd31cae2e5..0284a42a242 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): +class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestSwaggerBATXMLService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATXMLServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatxmlservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatxmlservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py index b64de561abc..f812121718f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py @@ -78,38 +78,38 @@ from ._request_builders import build_put_uri_request # type: ignore __all__ = [ - "build_get_complex_type_ref_no_meta_request", - "build_put_complex_type_ref_no_meta_request", - "build_get_complex_type_ref_with_meta_request", - "build_put_complex_type_ref_with_meta_request", - "build_get_simple_request", - "build_put_simple_request", - "build_get_wrapped_lists_request", - "build_put_wrapped_lists_request", - "build_get_headers_request", - "build_get_empty_list_request", - "build_put_empty_list_request", - "build_get_empty_wrapped_lists_request", - "build_put_empty_wrapped_lists_request", - "build_get_root_list_request", - "build_put_root_list_request", - "build_get_root_list_single_item_request", - "build_put_root_list_single_item_request", - "build_get_empty_root_list_request", - "build_put_empty_root_list_request", - "build_get_empty_child_element_request", - "build_put_empty_child_element_request", - "build_list_containers_request", - "build_get_service_properties_request", - "build_put_service_properties_request", - "build_get_acls_request", - "build_put_acls_request", - "build_list_blobs_request", - "build_json_input_request", - "build_json_output_request", - "build_get_xms_text_request", - "build_get_bytes_request", - "build_put_binary_request", - "build_get_uri_request", - "build_put_uri_request", + 'build_get_complex_type_ref_no_meta_request', + 'build_put_complex_type_ref_no_meta_request', + 'build_get_complex_type_ref_with_meta_request', + 'build_put_complex_type_ref_with_meta_request', + 'build_get_simple_request', + 'build_put_simple_request', + 'build_get_wrapped_lists_request', + 'build_put_wrapped_lists_request', + 'build_get_headers_request', + 'build_get_empty_list_request', + 'build_put_empty_list_request', + 'build_get_empty_wrapped_lists_request', + 'build_put_empty_wrapped_lists_request', + 'build_get_root_list_request', + 'build_put_root_list_request', + 'build_get_root_list_single_item_request', + 'build_put_root_list_single_item_request', + 'build_get_empty_root_list_request', + 'build_put_empty_root_list_request', + 'build_get_empty_child_element_request', + 'build_put_empty_child_element_request', + 'build_list_containers_request', + 'build_get_service_properties_request', + 'build_put_service_properties_request', + 'build_get_acls_request', + 'build_put_acls_request', + 'build_list_blobs_request', + 'build_json_input_request', + 'build_json_output_request', + 'build_get_xms_text_request', + 'build_get_bytes_request', + 'build_put_binary_request', + 'build_get_uri_request', + 'build_put_uri_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py index 1b6070cf96d..5fb3d2fe71e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict, List, Optional, TypeVar - - T = TypeVar("T") + from typing import Any, Dict, Optional, TypeVar + T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() @@ -559,7 +558,8 @@ def build_get_root_list_request( # response body for status code(s): 200 response.json() == [ { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which + you should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -638,7 +638,8 @@ def build_get_root_list_single_item_request( # response body for status code(s): 200 response.json() == [ { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which + you should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -717,7 +718,8 @@ def build_get_empty_root_list_request( # response body for status code(s): 200 response.json() == [ { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which + you should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -795,7 +797,8 @@ def build_get_empty_child_element_request( # response body for status code(s): 200 response.json() == { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which you + should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -878,24 +881,29 @@ def build_list_containers_request( "Containers": [ { "Metadata": { - "str": "str" # Optional. Dictionary of :code:``. + "str": "str" # Optional. Dictionary of + :code:``. }, - "Name": "str", # Required. + "Name": "str", # Required. "Properties": { - "Etag": "str", # Required. - "Last-Modified": "2020-02-20 00:00:00", # Required. - "LeaseDuration": "str", # Optional. Possible values include: "infinite", "fixed". - "LeaseState": "str", # Optional. Possible values include: "available", "leased", "expired", "breaking", "broken". - "LeaseStatus": "str", # Optional. Possible values include: "locked", "unlocked". - "PublicAccess": "str" # Optional. Possible values include: "container", "blob". + "Etag": "str", # Required. + "Last-Modified": "2020-02-20 00:00:00", # Required. + "LeaseDuration": "str", # Optional. Possible values + include: "infinite", "fixed". + "LeaseState": "str", # Optional. Possible values + include: "available", "leased", "expired", "breaking", "broken". + "LeaseStatus": "str", # Optional. Possible values + include: "locked", "unlocked". + "PublicAccess": "str" # Optional. Possible values + include: "container", "blob". } } ], "Marker": "str", # Optional. - "MaxResults": 0, # Required. - "NextMarker": "str", # Required. - "Prefix": "str", # Required. - "ServiceEndpoint": "str" # Required. + "MaxResults": 0, # Required. + "NextMarker": "str", # Required. + "Prefix": "str", # Required. + "ServiceEndpoint": "str" # Required. } """ @@ -949,45 +957,80 @@ def build_get_service_properties_request( response.json() == { "Cors": [ { - "AllowedHeaders": "str", # Required. the request headers that the origin domain may specify on the CORS request. - "AllowedMethods": "str", # Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - "AllowedOrigins": "str", # Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - "ExposedHeaders": "str", # Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - "MaxAgeInSeconds": 0 # Required. The maximum amount time that a browser should cache the preflight OPTIONS request. + "AllowedHeaders": "str", # Required. the request headers + that the origin domain may specify on the CORS request. + "AllowedMethods": "str", # Required. The methods (HTTP + request verbs) that the origin domain may use for a CORS request. (comma + separated). + "AllowedOrigins": "str", # Required. The origin domains that + are permitted to make a request against the storage service via CORS. The + origin domain is the domain from which the request originates. Note that + the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character + '*' to allow all origin domains to make requests via CORS. + "ExposedHeaders": "str", # Required. The response headers + that may be sent in the response to the CORS request and exposed by the + browser to the request issuer. + "MaxAgeInSeconds": 0 # Required. The maximum amount time + that a browser should cache the preflight OPTIONS request. } ], - "DefaultServiceVersion": "str", # Optional. The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions. + "DefaultServiceVersion": "str", # Optional. The default version to use for + requests to the Blob service if an incoming request's version is not specified. + Possible values include version 2008-10-27 and all more recent versions. "DeleteRetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that metrics or + logging or soft-deleted data should be retained. All data older than this + value will be deleted. + "Enabled": bool # Required. Indicates whether a retention policy is + enabled for the storage service. }, "HourMetrics": { - "Enabled": bool, # Required. Indicates whether metrics are enabled for the Blob service. - "IncludeAPIs": bool, # Optional. Indicates whether metrics should generate summary statistics for called API operations. + "Enabled": bool, # Required. Indicates whether metrics are enabled + for the Blob service. + "IncludeAPIs": bool, # Optional. Indicates whether metrics should + generate summary statistics for called API operations. "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that + metrics or logging or soft-deleted data should be retained. All data + older than this value will be deleted. + "Enabled": bool # Required. Indicates whether a retention + policy is enabled for the storage service. }, - "Version": "str" # Optional. The version of Storage Analytics to configure. + "Version": "str" # Optional. The version of Storage Analytics to + configure. }, "Logging": { - "Delete": bool, # Required. Indicates whether all delete requests should be logged. - "Read": bool, # Required. Indicates whether all read requests should be logged. + "Delete": bool, # Required. Indicates whether all delete requests + should be logged. + "Read": bool, # Required. Indicates whether all read requests should + be logged. "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that + metrics or logging or soft-deleted data should be retained. All data + older than this value will be deleted. + "Enabled": bool # Required. Indicates whether a retention + policy is enabled for the storage service. }, - "Version": "str", # Required. The version of Storage Analytics to configure. - "Write": bool # Required. Indicates whether all write requests should be logged. + "Version": "str", # Required. The version of Storage Analytics to + configure. + "Write": bool # Required. Indicates whether all write requests + should be logged. }, "MinuteMetrics": { - "Enabled": bool, # Required. Indicates whether metrics are enabled for the Blob service. - "IncludeAPIs": bool, # Optional. Indicates whether metrics should generate summary statistics for called API operations. + "Enabled": bool, # Required. Indicates whether metrics are enabled + for the Blob service. + "IncludeAPIs": bool, # Optional. Indicates whether metrics should + generate summary statistics for called API operations. "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that + metrics or logging or soft-deleted data should be retained. All data + older than this value will be deleted. + "Enabled": bool # Required. Indicates whether a retention + policy is enabled for the storage service. }, - "Version": "str" # Optional. The version of Storage Analytics to configure. + "Version": "str" # Optional. The version of Storage Analytics to + configure. } } """ @@ -1094,9 +1137,12 @@ def build_get_acls_request( response.json() == [ { "AccessPolicy": { - "Expiry": "2020-02-20 00:00:00", # Required. the date-time the policy expires. - "Permission": "str", # Required. the permissions for the acl policy. - "Start": "2020-02-20 00:00:00" # Required. the date-time the policy is active. + "Expiry": "2020-02-20 00:00:00", # Required. the date-time + the policy expires. + "Permission": "str", # Required. the permissions for the acl + policy. + "Start": "2020-02-20 00:00:00" # Required. the date-time the + policy is active. }, "Id": "str" # Required. a unique id. } @@ -1206,56 +1252,87 @@ def build_list_blobs_request( "Blobs": { "Blob": [ { - "Deleted": bool, # Required. + "Deleted": bool, # Required. "Metadata": { - "str": "str" # Optional. Dictionary of :code:``. + "str": "str" # Optional. Dictionary of + :code:``. }, - "Name": "str", # Required. + "Name": "str", # Required. "Properties": { - "AccessTier": "str", # Optional. Possible values include: "P4", "P6", "P10", "P20", "P30", "P40", "P50", "Hot", "Cool", "Archive". - "AccessTierInferred": bool, # Optional. Required. Properties of a blob. - "ArchiveStatus": "str", # Optional. Possible values include: "rehydrate-pending-to-hot", "rehydrate-pending-to-cool". - "BlobType": "str", # Optional. Possible values include: "BlockBlob", "PageBlob", "AppendBlob". - "Cache-Control": "str", # Optional. Required. Properties of a blob. - "Content-Disposition": "str", # Optional. Required. Properties of a blob. - "Content-Encoding": "str", # Optional. Required. Properties of a blob. - "Content-Language": "str", # Optional. Required. Properties of a blob. - "Content-Length": 0.0, # Optional. Size in bytes. - "Content-MD5": "str", # Optional. Required. Properties of a blob. - "Content-Type": "str", # Optional. Required. Properties of a blob. - "CopyCompletionTime": "2020-02-20 00:00:00", # Optional. Required. Properties of a blob. - "CopyId": "str", # Optional. Required. Properties of a blob. - "CopyProgress": "str", # Optional. Required. Properties of a blob. - "CopySource": "str", # Optional. Required. Properties of a blob. - "CopyStatus": "str", # Optional. Possible values include: "pending", "success", "aborted", "failed". - "CopyStatusDescription": "str", # Optional. Required. Properties of a blob. - "DeletedTime": "2020-02-20 00:00:00", # Optional. Required. Properties of a blob. - "DestinationSnapshot": "str", # Optional. Required. Properties of a blob. - "Etag": "str", # Required. - "IncrementalCopy": bool, # Optional. Required. Properties of a blob. - "Last-Modified": "2020-02-20 00:00:00", # Required. - "LeaseDuration": "str", # Optional. Possible values include: "infinite", "fixed". - "LeaseState": "str", # Optional. Possible values include: "available", "leased", "expired", "breaking", "broken". - "LeaseStatus": "str", # Optional. Possible values include: "locked", "unlocked". - "RemainingRetentionDays": 0, # Optional. Required. Properties of a blob. - "ServerEncrypted": bool, # Optional. Required. Properties of a blob. - "x-ms-blob-sequence-number": 0 # Optional. Required. Properties of a blob. + "AccessTier": "str", # Optional. Possible + values include: "P4", "P6", "P10", "P20", "P30", "P40", "P50", + "Hot", "Cool", "Archive". + "AccessTierInferred": bool, # Optional. + Required. Properties of a blob. + "ArchiveStatus": "str", # Optional. Possible + values include: "rehydrate-pending-to-hot", + "rehydrate-pending-to-cool". + "BlobType": "str", # Optional. Possible + values include: "BlockBlob", "PageBlob", "AppendBlob". + "Cache-Control": "str", # Optional. + Required. Properties of a blob. + "Content-Disposition": "str", # Optional. + Required. Properties of a blob. + "Content-Encoding": "str", # Optional. + Required. Properties of a blob. + "Content-Language": "str", # Optional. + Required. Properties of a blob. + "Content-Length": 0.0, # Optional. Size in + bytes. + "Content-MD5": "str", # Optional. Required. + Properties of a blob. + "Content-Type": "str", # Optional. Required. + Properties of a blob. + "CopyCompletionTime": "2020-02-20 00:00:00", + # Optional. Required. Properties of a blob. + "CopyId": "str", # Optional. Required. + Properties of a blob. + "CopyProgress": "str", # Optional. Required. + Properties of a blob. + "CopySource": "str", # Optional. Required. + Properties of a blob. + "CopyStatus": "str", # Optional. Possible + values include: "pending", "success", "aborted", "failed". + "CopyStatusDescription": "str", # Optional. + Required. Properties of a blob. + "DeletedTime": "2020-02-20 00:00:00", # + Optional. Required. Properties of a blob. + "DestinationSnapshot": "str", # Optional. + Required. Properties of a blob. + "Etag": "str", # Required. + "IncrementalCopy": bool, # Optional. + Required. Properties of a blob. + "Last-Modified": "2020-02-20 00:00:00", # + Required. + "LeaseDuration": "str", # Optional. Possible + values include: "infinite", "fixed". + "LeaseState": "str", # Optional. Possible + values include: "available", "leased", "expired", "breaking", + "broken". + "LeaseStatus": "str", # Optional. Possible + values include: "locked", "unlocked". + "RemainingRetentionDays": 0, # Optional. + Required. Properties of a blob. + "ServerEncrypted": bool, # Optional. + Required. Properties of a blob. + "x-ms-blob-sequence-number": 0 # Optional. + Required. Properties of a blob. }, - "Snapshot": "str" # Required. + "Snapshot": "str" # Required. } ], "BlobPrefix": [ { - "Name": "str" # Required. + "Name": "str" # Required. } ] }, - "ContainerName": "str", # Required. - "Delimiter": "str", # Required. - "Marker": "str", # Required. - "MaxResults": 0, # Required. - "NextMarker": "str", # Required. - "Prefix": "str", # Required. + "ContainerName": "str", # Required. + "Delimiter": "str", # Required. + "Marker": "str", # Required. + "MaxResults": 0, # Required. + "NextMarker": "str", # Required. + "Prefix": "str", # Required. "ServiceEndpoint": "str" # Optional. } """ @@ -1565,3 +1642,4 @@ def build_put_uri_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py index 348818da987..db400d8c26d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py @@ -5,19 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Dict, List, Optional, TypeVar +from typing import Any, Dict, Optional, TypeVar from azure.core.rest import HttpRequest from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_complex_type_ref_no_meta_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_type_ref_no_meta_request( + **kwargs: Any +) -> HttpRequest: """Get a complex type that has a ref to a complex type with no XML node. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -42,16 +43,25 @@ def build_get_complex_type_ref_no_meta_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/complex-type-ref-no-meta" + url = '/xml/complex-type-ref-no-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_complex_type_ref_no_meta_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_complex_type_ref_no_meta_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts a complex type that has a ref to a complex type with no XML node. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -66,20 +76,28 @@ def build_put_complex_type_ref_no_meta_request(*, content: Any, **kwargs: Any) - :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/complex-type-ref-no-meta" + url = '/xml/complex-type-ref-no-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_complex_type_ref_with_meta_request(**kwargs: Any) -> HttpRequest: +def build_get_complex_type_ref_with_meta_request( + **kwargs: Any +) -> HttpRequest: """Get a complex type that has a ref to a complex type with XML node. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -104,16 +122,25 @@ def build_get_complex_type_ref_with_meta_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/complex-type-ref-with-meta" + url = '/xml/complex-type-ref-with-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_complex_type_ref_with_meta_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_complex_type_ref_with_meta_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts a complex type that has a ref to a complex type with XML node. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -128,20 +155,28 @@ def build_put_complex_type_ref_with_meta_request(*, content: Any, **kwargs: Any) :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/complex-type-ref-with-meta" + url = '/xml/complex-type-ref-with-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_simple_request(**kwargs: Any) -> HttpRequest: +def build_get_simple_request( + **kwargs: Any +) -> HttpRequest: """Get a simple XML document. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -174,16 +209,25 @@ def build_get_simple_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/simple" + url = '/xml/simple' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_simple_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_simple_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Put a simple XML document. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -198,22 +242,30 @@ def build_put_simple_request(*, content: Any, **kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/simple" + url = '/xml/simple' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_wrapped_lists_request(**kwargs: Any) -> HttpRequest: +def build_get_wrapped_lists_request( + **kwargs: Any +) -> HttpRequest: """Get an XML document with multiple wrapped lists. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -240,16 +292,25 @@ def build_get_wrapped_lists_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/wrapped-lists" + url = '/xml/wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_wrapped_lists_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_wrapped_lists_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Put an XML document with multiple wrapped lists. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -264,22 +325,30 @@ def build_put_wrapped_lists_request(*, content: Any, **kwargs: Any) -> HttpReque :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/wrapped-lists" + url = '/xml/wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_headers_request(**kwargs: Any) -> HttpRequest: +def build_get_headers_request( + **kwargs: Any +) -> HttpRequest: """Get strongly-typed response headers. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -292,12 +361,18 @@ def build_get_headers_request(**kwargs: Any) -> HttpRequest: """ # Construct URL - url = "/xml/headers" + url = '/xml/headers' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_get_empty_list_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_list_request( + **kwargs: Any +) -> HttpRequest: """Get an empty list. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -330,16 +405,25 @@ def build_get_empty_list_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-list" + url = '/xml/empty-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_empty_list_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts an empty list. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -354,20 +438,28 @@ def build_put_empty_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-list" + url = '/xml/empty-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_empty_wrapped_lists_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_wrapped_lists_request( + **kwargs: Any +) -> HttpRequest: """Gets some empty wrapped lists. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -394,16 +486,25 @@ def build_get_empty_wrapped_lists_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-wrapped-lists" + url = '/xml/empty-wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_wrapped_lists_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_empty_wrapped_lists_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts some empty wrapped lists. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -418,20 +519,28 @@ def build_put_empty_wrapped_lists_request(*, content: Any, **kwargs: Any) -> Htt :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-wrapped-lists" + url = '/xml/empty-wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_root_list_request(**kwargs: Any) -> HttpRequest: +def build_get_root_list_request( + **kwargs: Any +) -> HttpRequest: """Gets a list as the root element. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -448,7 +557,8 @@ def build_get_root_list_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == [ { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which + you should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -457,16 +567,25 @@ def build_get_root_list_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/root-list" + url = '/xml/root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_root_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_root_list_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts a list as the root element. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -481,20 +600,28 @@ def build_put_root_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/root-list" + url = '/xml/root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_root_list_single_item_request(**kwargs: Any) -> HttpRequest: +def build_get_root_list_single_item_request( + **kwargs: Any +) -> HttpRequest: """Gets a list with a single item. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -511,7 +638,8 @@ def build_get_root_list_single_item_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == [ { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which + you should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -520,16 +648,25 @@ def build_get_root_list_single_item_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/root-list-single-item" + url = '/xml/root-list-single-item' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_root_list_single_item_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_root_list_single_item_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts a list with a single item. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -544,20 +681,28 @@ def build_put_root_list_single_item_request(*, content: Any, **kwargs: Any) -> H :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/root-list-single-item" + url = '/xml/root-list-single-item' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_empty_root_list_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_root_list_request( + **kwargs: Any +) -> HttpRequest: """Gets an empty list as the root element. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -574,7 +719,8 @@ def build_get_empty_root_list_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == [ { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which + you should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -583,16 +729,25 @@ def build_get_empty_root_list_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-root-list" + url = '/xml/empty-root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_root_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_empty_root_list_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts an empty list as the root element. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -607,20 +762,28 @@ def build_put_empty_root_list_request(*, content: Any, **kwargs: Any) -> HttpReq :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-root-list" + url = '/xml/empty-root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_empty_child_element_request(**kwargs: Any) -> HttpRequest: +def build_get_empty_child_element_request( + **kwargs: Any +) -> HttpRequest: """Gets an XML document with an empty child element. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -636,7 +799,8 @@ def build_get_empty_child_element_request(**kwargs: Any) -> HttpRequest: # response body for status code(s): 200 response.json() == { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you should reconsider eating this banana. + "expiration": "2020-02-20 00:00:00", # Optional. The time at which you + should reconsider eating this banana. "flavor": "str", # Optional. "name": "str" # Optional. } @@ -644,16 +808,25 @@ def build_get_empty_child_element_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-child-element" + url = '/xml/empty-child-element' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_empty_child_element_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_empty_child_element_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts a value with an empty child element. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -668,20 +841,28 @@ def build_put_empty_child_element_request(*, content: Any, **kwargs: Any) -> Htt :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-child-element" + url = '/xml/empty-child-element' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_list_containers_request(**kwargs: Any) -> HttpRequest: +def build_list_containers_request( + **kwargs: Any +) -> HttpRequest: """Lists containers in a storage account. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -703,16 +884,21 @@ def build_list_containers_request(**kwargs: Any) -> HttpRequest: "Containers": [ { "Metadata": { - "str": "str" # Optional. Dictionary of :code:``. + "str": "str" # Optional. Dictionary of + :code:``. }, "Name": "str", # Required. "Properties": { "Etag": "str", # Required. "Last-Modified": "2020-02-20 00:00:00", # Required. - "LeaseDuration": "str", # Optional. Possible values include: "infinite", "fixed". - "LeaseState": "str", # Optional. Possible values include: "available", "leased", "expired", "breaking", "broken". - "LeaseStatus": "str", # Optional. Possible values include: "locked", "unlocked". - "PublicAccess": "str" # Optional. Possible values include: "container", "blob". + "LeaseDuration": "str", # Optional. Possible values + include: "infinite", "fixed". + "LeaseState": "str", # Optional. Possible values + include: "available", "leased", "expired", "breaking", "broken". + "LeaseStatus": "str", # Optional. Possible values + include: "locked", "unlocked". + "PublicAccess": "str" # Optional. Possible values + include: "container", "blob". } } ], @@ -724,24 +910,32 @@ def build_list_containers_request(**kwargs: Any) -> HttpRequest: } """ - comp = kwargs.pop("comp", "list") # type: str + comp = kwargs.pop('comp', "list") # type: str accept = "application/xml" # Construct URL - url = "/xml/" + url = '/xml/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_get_service_properties_request(**kwargs: Any) -> HttpRequest: +def build_get_service_properties_request( + **kwargs: Any +) -> HttpRequest: """Gets storage service properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -765,69 +959,114 @@ def build_get_service_properties_request(**kwargs: Any) -> HttpRequest: response.json() == { "Cors": [ { - "AllowedHeaders": "str", # Required. the request headers that the origin domain may specify on the CORS request. - "AllowedMethods": "str", # Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - "AllowedOrigins": "str", # Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - "ExposedHeaders": "str", # Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - "MaxAgeInSeconds": 0 # Required. The maximum amount time that a browser should cache the preflight OPTIONS request. + "AllowedHeaders": "str", # Required. the request headers + that the origin domain may specify on the CORS request. + "AllowedMethods": "str", # Required. The methods (HTTP + request verbs) that the origin domain may use for a CORS request. (comma + separated). + "AllowedOrigins": "str", # Required. The origin domains that + are permitted to make a request against the storage service via CORS. The + origin domain is the domain from which the request originates. Note that + the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character + '*' to allow all origin domains to make requests via CORS. + "ExposedHeaders": "str", # Required. The response headers + that may be sent in the response to the CORS request and exposed by the + browser to the request issuer. + "MaxAgeInSeconds": 0 # Required. The maximum amount time + that a browser should cache the preflight OPTIONS request. } ], - "DefaultServiceVersion": "str", # Optional. The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions. + "DefaultServiceVersion": "str", # Optional. The default version to use for + requests to the Blob service if an incoming request's version is not specified. + Possible values include version 2008-10-27 and all more recent versions. "DeleteRetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that metrics or + logging or soft-deleted data should be retained. All data older than this + value will be deleted. + "Enabled": bool # Required. Indicates whether a retention policy is + enabled for the storage service. }, "HourMetrics": { - "Enabled": bool, # Required. Indicates whether metrics are enabled for the Blob service. - "IncludeAPIs": bool, # Optional. Indicates whether metrics should generate summary statistics for called API operations. + "Enabled": bool, # Required. Indicates whether metrics are enabled + for the Blob service. + "IncludeAPIs": bool, # Optional. Indicates whether metrics should + generate summary statistics for called API operations. "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that + metrics or logging or soft-deleted data should be retained. All data + older than this value will be deleted. + "Enabled": bool # Required. Indicates whether a retention + policy is enabled for the storage service. }, - "Version": "str" # Optional. The version of Storage Analytics to configure. + "Version": "str" # Optional. The version of Storage Analytics to + configure. }, "Logging": { - "Delete": bool, # Required. Indicates whether all delete requests should be logged. - "Read": bool, # Required. Indicates whether all read requests should be logged. + "Delete": bool, # Required. Indicates whether all delete requests + should be logged. + "Read": bool, # Required. Indicates whether all read requests should + be logged. "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that + metrics or logging or soft-deleted data should be retained. All data + older than this value will be deleted. + "Enabled": bool # Required. Indicates whether a retention + policy is enabled for the storage service. }, - "Version": "str", # Required. The version of Storage Analytics to configure. - "Write": bool # Required. Indicates whether all write requests should be logged. + "Version": "str", # Required. The version of Storage Analytics to + configure. + "Write": bool # Required. Indicates whether all write requests + should be logged. }, "MinuteMetrics": { - "Enabled": bool, # Required. Indicates whether metrics are enabled for the Blob service. - "IncludeAPIs": bool, # Optional. Indicates whether metrics should generate summary statistics for called API operations. + "Enabled": bool, # Required. Indicates whether metrics are enabled + for the Blob service. + "IncludeAPIs": bool, # Optional. Indicates whether metrics should + generate summary statistics for called API operations. "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted. - "Enabled": bool # Required. Indicates whether a retention policy is enabled for the storage service. + "Days": 0, # Optional. Indicates the number of days that + metrics or logging or soft-deleted data should be retained. All data + older than this value will be deleted. + "Enabled": bool # Required. Indicates whether a retention + policy is enabled for the storage service. }, - "Version": "str" # Optional. The version of Storage Analytics to configure. + "Version": "str" # Optional. The version of Storage Analytics to + configure. } } """ - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str accept = "application/xml" # Construct URL - url = "/xml/" + url = '/xml/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_put_service_properties_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_service_properties_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts storage service properties. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -848,29 +1087,36 @@ def build_put_service_properties_request(*, content: Any, **kwargs: Any) -> Http :rtype: ~azure.core.rest.HttpRequest """ - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/" + url = '/xml/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + content=content, + **kwargs ) -def build_get_acls_request(**kwargs: Any) -> HttpRequest: +def build_get_acls_request( + **kwargs: Any +) -> HttpRequest: """Gets storage ACLs for a container. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -894,35 +1140,48 @@ def build_get_acls_request(**kwargs: Any) -> HttpRequest: response.json() == [ { "AccessPolicy": { - "Expiry": "2020-02-20 00:00:00", # Required. the date-time the policy expires. - "Permission": "str", # Required. the permissions for the acl policy. - "Start": "2020-02-20 00:00:00" # Required. the date-time the policy is active. + "Expiry": "2020-02-20 00:00:00", # Required. the date-time + the policy expires. + "Permission": "str", # Required. the permissions for the acl + policy. + "Start": "2020-02-20 00:00:00" # Required. the date-time the + policy is active. }, "Id": "str" # Required. a unique id. } ] """ - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str accept = "application/xml" # Construct URL - url = "/xml/mycontainer" + url = '/xml/mycontainer' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_put_acls_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_acls_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Puts storage ACLs for a container. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -943,29 +1202,36 @@ def build_put_acls_request(*, content: Any, **kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/mycontainer" + url = '/xml/mycontainer' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + content=content, + **kwargs ) -def build_list_blobs_request(**kwargs: Any) -> HttpRequest: +def build_list_blobs_request( + **kwargs: Any +) -> HttpRequest: """Lists blobs in a storage container. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -992,38 +1258,69 @@ def build_list_blobs_request(**kwargs: Any) -> HttpRequest: { "Deleted": bool, # Required. "Metadata": { - "str": "str" # Optional. Dictionary of :code:``. + "str": "str" # Optional. Dictionary of + :code:``. }, "Name": "str", # Required. "Properties": { - "AccessTier": "str", # Optional. Possible values include: "P4", "P6", "P10", "P20", "P30", "P40", "P50", "Hot", "Cool", "Archive". - "AccessTierInferred": bool, # Optional. Required. Properties of a blob. - "ArchiveStatus": "str", # Optional. Possible values include: "rehydrate-pending-to-hot", "rehydrate-pending-to-cool". - "BlobType": "str", # Optional. Possible values include: "BlockBlob", "PageBlob", "AppendBlob". - "Cache-Control": "str", # Optional. Required. Properties of a blob. - "Content-Disposition": "str", # Optional. Required. Properties of a blob. - "Content-Encoding": "str", # Optional. Required. Properties of a blob. - "Content-Language": "str", # Optional. Required. Properties of a blob. - "Content-Length": 0.0, # Optional. Size in bytes. - "Content-MD5": "str", # Optional. Required. Properties of a blob. - "Content-Type": "str", # Optional. Required. Properties of a blob. - "CopyCompletionTime": "2020-02-20 00:00:00", # Optional. Required. Properties of a blob. - "CopyId": "str", # Optional. Required. Properties of a blob. - "CopyProgress": "str", # Optional. Required. Properties of a blob. - "CopySource": "str", # Optional. Required. Properties of a blob. - "CopyStatus": "str", # Optional. Possible values include: "pending", "success", "aborted", "failed". - "CopyStatusDescription": "str", # Optional. Required. Properties of a blob. - "DeletedTime": "2020-02-20 00:00:00", # Optional. Required. Properties of a blob. - "DestinationSnapshot": "str", # Optional. Required. Properties of a blob. + "AccessTier": "str", # Optional. Possible + values include: "P4", "P6", "P10", "P20", "P30", "P40", "P50", + "Hot", "Cool", "Archive". + "AccessTierInferred": bool, # Optional. + Required. Properties of a blob. + "ArchiveStatus": "str", # Optional. Possible + values include: "rehydrate-pending-to-hot", + "rehydrate-pending-to-cool". + "BlobType": "str", # Optional. Possible + values include: "BlockBlob", "PageBlob", "AppendBlob". + "Cache-Control": "str", # Optional. + Required. Properties of a blob. + "Content-Disposition": "str", # Optional. + Required. Properties of a blob. + "Content-Encoding": "str", # Optional. + Required. Properties of a blob. + "Content-Language": "str", # Optional. + Required. Properties of a blob. + "Content-Length": 0.0, # Optional. Size in + bytes. + "Content-MD5": "str", # Optional. Required. + Properties of a blob. + "Content-Type": "str", # Optional. Required. + Properties of a blob. + "CopyCompletionTime": "2020-02-20 00:00:00", + # Optional. Required. Properties of a blob. + "CopyId": "str", # Optional. Required. + Properties of a blob. + "CopyProgress": "str", # Optional. Required. + Properties of a blob. + "CopySource": "str", # Optional. Required. + Properties of a blob. + "CopyStatus": "str", # Optional. Possible + values include: "pending", "success", "aborted", "failed". + "CopyStatusDescription": "str", # Optional. + Required. Properties of a blob. + "DeletedTime": "2020-02-20 00:00:00", # + Optional. Required. Properties of a blob. + "DestinationSnapshot": "str", # Optional. + Required. Properties of a blob. "Etag": "str", # Required. - "IncrementalCopy": bool, # Optional. Required. Properties of a blob. - "Last-Modified": "2020-02-20 00:00:00", # Required. - "LeaseDuration": "str", # Optional. Possible values include: "infinite", "fixed". - "LeaseState": "str", # Optional. Possible values include: "available", "leased", "expired", "breaking", "broken". - "LeaseStatus": "str", # Optional. Possible values include: "locked", "unlocked". - "RemainingRetentionDays": 0, # Optional. Required. Properties of a blob. - "ServerEncrypted": bool, # Optional. Required. Properties of a blob. - "x-ms-blob-sequence-number": 0 # Optional. Required. Properties of a blob. + "IncrementalCopy": bool, # Optional. + Required. Properties of a blob. + "Last-Modified": "2020-02-20 00:00:00", # + Required. + "LeaseDuration": "str", # Optional. Possible + values include: "infinite", "fixed". + "LeaseState": "str", # Optional. Possible + values include: "available", "leased", "expired", "breaking", + "broken". + "LeaseStatus": "str", # Optional. Possible + values include: "locked", "unlocked". + "RemainingRetentionDays": 0, # Optional. + Required. Properties of a blob. + "ServerEncrypted": bool, # Optional. + Required. Properties of a blob. + "x-ms-blob-sequence-number": 0 # Optional. + Required. Properties of a blob. }, "Snapshot": "str" # Required. } @@ -1044,26 +1341,37 @@ def build_list_blobs_request(**kwargs: Any) -> HttpRequest: } """ - comp = kwargs.pop("comp", "list") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + restype = kwargs.pop('restype', "container") # type: str accept = "application/xml" # Construct URL - url = "/xml/mycontainer" + url = '/xml/mycontainer' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_json_input_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: +def build_json_input_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -1090,20 +1398,29 @@ def build_json_input_request(*, json: JSONType = None, content: Any = None, **kw } """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/jsoninput" + url = '/xml/jsoninput' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_json_output_request(**kwargs: Any) -> HttpRequest: +def build_json_output_request( + **kwargs: Any +) -> HttpRequest: """A Swagger with XML that has one operation that returns JSON. ID number 42. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1125,16 +1442,23 @@ def build_json_output_request(**kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/xml/jsonoutput" + url = '/xml/jsonoutput' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_xms_text_request(**kwargs: Any) -> HttpRequest: +def build_get_xms_text_request( + **kwargs: Any +) -> HttpRequest: """Get back an XML object with an x-ms-text property, which should translate to the returned object's 'language' property being 'english' and its 'content' property being 'I am text'. @@ -1158,16 +1482,23 @@ def build_get_xms_text_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/x-ms-text" + url = '/xml/x-ms-text' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_get_bytes_request(**kwargs: Any) -> HttpRequest: +def build_get_bytes_request( + **kwargs: Any +) -> HttpRequest: """Get an XML document with binary property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1189,16 +1520,25 @@ def build_get_bytes_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/bytes" + url = '/xml/bytes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_binary_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Put an XML document with binary property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1213,22 +1553,30 @@ def build_put_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/bytes" + url = '/xml/bytes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_get_uri_request(**kwargs: Any) -> HttpRequest: +def build_get_uri_request( + **kwargs: Any +) -> HttpRequest: """Get an XML document with uri property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1250,16 +1598,25 @@ def build_get_uri_request(**kwargs: Any) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/url" + url = '/xml/url' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_uri_request(*, content: Any, **kwargs: Any) -> HttpRequest: +def build_put_uri_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: """Put an XML document with uri property. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -1274,16 +1631,23 @@ def build_put_uri_request(*, content: Any, **kwargs: Any) -> HttpRequest: :rtype: ~azure.core.rest.HttpRequest """ - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/url" + url = '/xml/url' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/setup.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/setup.py index ffc32bf4893..7ea66ee2c54 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/setup.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ XMS Error Response Extensions. - """, + """ ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/__init__.py index d1cf7e2a92f..d3432d67be3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["XMSErrorResponseExtensions"] +__all__ = ['XMSErrorResponseExtensions'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_configuration.py index 15ca43a7317..578e782f2d5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_configuration.py @@ -14,29 +14,33 @@ from ._version import VERSION -class XMSErrorResponseExtensionsConfiguration(Configuration): +class XMSErrorResponseExtensionsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for XMSErrorResponseExtensions. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(XMSErrorResponseExtensionsConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "xmserrorresponseextensions/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'xmserrorresponseextensions/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_vendor.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_vendor.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py index 657439ae470..8f6f9fcc688 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_xms_error_response_extensions.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class XMSErrorResponseExtensions: """XMS Error Response Extensions. @@ -27,8 +26,13 @@ class XMSErrorResponseExtensions: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,6 +40,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/__init__.py index dc78ca60218..a6afdd01060 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._xms_error_response_extensions import XMSErrorResponseExtensions - -__all__ = ["XMSErrorResponseExtensions"] +__all__ = ['XMSErrorResponseExtensions'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_configuration.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_configuration.py index 6f7dc1e94db..658c16f25da 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_configuration.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_configuration.py @@ -14,26 +14,32 @@ from .._version import VERSION -class XMSErrorResponseExtensionsConfiguration(Configuration): +class XMSErrorResponseExtensionsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for XMSErrorResponseExtensions. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(XMSErrorResponseExtensionsConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "xmserrorresponseextensions/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'xmserrorresponseextensions/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py index 186346173a7..8c8d5488a44 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/aio/_xms_error_response_extensions.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +19,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class XMSErrorResponseExtensions: """XMS Error Response Extensions. @@ -27,7 +26,12 @@ class XMSErrorResponseExtensions: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -35,7 +39,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. We have helper methods to create requests specific to this service in `xmserrorresponselowlevel.rest`. diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/__init__.py index 0af9b28f660..8e6cf7ef943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------- \ No newline at end of file diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py index 108280ab605..daaa72df11d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py @@ -16,7 +16,7 @@ from ._request_builders import build_has_models_param_request # type: ignore __all__ = [ - "build_get_pet_by_id_request", - "build_do_something_request", - "build_has_models_param_request", + 'build_get_pet_by_id_request', + 'build_do_something_request', + 'build_has_models_param_request', ] diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py index 16f229bd536..e02057c097e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py @@ -157,3 +157,4 @@ def build_has_models_param_request( headers=header_parameters, **kwargs ) + diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py index 077e86291eb..9f5dbcb861b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py @@ -16,7 +16,10 @@ _SERIALIZER.client_side_validation = False -def build_get_pet_by_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: +def build_get_pet_by_id_request( + pet_id: str, + **kwargs: Any +) -> HttpRequest: """Gets pets by id. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -41,21 +44,29 @@ def build_get_pet_by_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/errorStatusCodes/Pets/{petId}/GetPet" + url = '/errorStatusCodes/Pets/{petId}/GetPet' path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, "str"), + "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_do_something_request(what_action: str, **kwargs: Any) -> HttpRequest: +def build_do_something_request( + what_action: str, + **kwargs: Any +) -> HttpRequest: """Asks pet to do something. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder @@ -79,21 +90,30 @@ def build_do_something_request(what_action: str, **kwargs: Any) -> HttpRequest: accept = "application/json" # Construct URL - url = "/errorStatusCodes/Pets/doSomething/{whatAction}" + url = '/errorStatusCodes/Pets/doSomething/{whatAction}' path_format_arguments = { - "whatAction": _SERIALIZER.url("what_action", what_action, "str"), + "whatAction": _SERIALIZER.url("what_action", what_action, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_has_models_param_request(*, models: Optional[str] = "value1", **kwargs: Any) -> HttpRequest: +def build_has_models_param_request( + *, + models: Optional[str] = "value1", + **kwargs: Any +) -> HttpRequest: """Ensure you can correctly deserialize the returned PetActionError and deserialization doesn't conflict with the input param name 'models'. @@ -111,15 +131,22 @@ def build_has_models_param_request(*, models: Optional[str] = "value1", **kwargs accept = "application/json" # Construct URL - url = "/errorStatusCodes/Pets/hasModelsParam" + url = '/errorStatusCodes/Pets/hasModelsParam' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if models is not None: - query_parameters["models"] = _SERIALIZER.query("models", models, "str") + query_parameters['models'] = _SERIALIZER.query("models", models, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/__init__.py index 82bd90b483e..f4e9ea3fdbc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AdditionalPropertiesClient"] +__all__ = ['AdditionalPropertiesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_additional_properties_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_additional_properties_client.py index 912f79a4615..0d413214704 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_additional_properties_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_additional_properties_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AdditionalPropertiesClient: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AdditionalPropertiesClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AdditionalPropertiesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.pets = PetsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_configuration.py index 79377255703..f6d666851f1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AdditionalPropertiesClientConfiguration(Configuration): # pylint: disable attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AdditionalPropertiesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "additionalpropertiesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'additionalpropertiesclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/__init__.py index 43f6b8afe9d..044030f73fc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._additional_properties_client import AdditionalPropertiesClient - -__all__ = ["AdditionalPropertiesClient"] +__all__ = ['AdditionalPropertiesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_additional_properties_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_additional_properties_client.py index 8fe332aeeee..6ec3e7cce41 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_additional_properties_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_additional_properties_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AdditionalPropertiesClient: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AdditionalPropertiesClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AdditionalPropertiesClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.pets = PetsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_configuration.py index 6957b41d9ba..d815acb6132 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AdditionalPropertiesClientConfiguration(Configuration): # pylint: disable attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AdditionalPropertiesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "additionalpropertiesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'additionalpropertiesclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/__init__.py index 22d3120a170..179ad255d75 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PetsOperations __all__ = [ - "PetsOperations", + 'PetsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py index 0c5108708e8..225fdb31098 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py @@ -8,32 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_pets_create_ap_in_properties_request, - build_pets_create_ap_in_properties_with_ap_string_request, - build_pets_create_ap_object_request, - build_pets_create_ap_string_request, - build_pets_create_ap_true_request, - build_pets_create_cat_ap_true_request, -) - -T = TypeVar("T") +from ...operations._operations import build_pets_create_ap_in_properties_request, build_pets_create_ap_in_properties_with_ap_string_request, build_pets_create_ap_object_request, build_pets_create_ap_string_request, build_pets_create_ap_true_request, build_pets_create_cat_ap_true_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PetsOperations: """PetsOperations async operations. @@ -53,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + async def create_ap_true( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -79,11 +68,13 @@ async def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JS "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -94,7 +85,9 @@ async def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JS request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -112,8 +105,14 @@ async def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JS return deserialized + + @distributed_trace_async - async def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + async def create_cat_ap_true( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a CatAPTrue which contains more properties than what is defined. :param create_parameters: @@ -141,11 +140,13 @@ async def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) - "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -156,7 +157,9 @@ async def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -174,8 +177,14 @@ async def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) - return deserialized + + @distributed_trace_async - async def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + async def create_ap_object( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -201,11 +210,13 @@ async def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -216,7 +227,9 @@ async def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -234,8 +247,14 @@ async def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> return deserialized + + @distributed_trace_async - async def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + async def create_ap_string( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -261,11 +280,13 @@ async def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -276,7 +297,9 @@ async def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -294,8 +317,14 @@ async def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> return deserialized + + @distributed_trace_async - async def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + async def create_ap_in_properties( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -321,11 +350,13 @@ async def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: A "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -336,7 +367,9 @@ async def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: A request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -354,8 +387,14 @@ async def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: A return deserialized + + @distributed_trace_async - async def create_ap_in_properties_with_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + async def create_ap_in_properties_with_ap_string( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -389,11 +428,13 @@ async def create_ap_in_properties_with_ap_string(self, create_parameters: JSONTy "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -404,7 +445,9 @@ async def create_ap_in_properties_with_ap_string(self, create_parameters: JSONTy request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -421,3 +464,5 @@ async def create_ap_in_properties_with_ap_string(self, create_parameters: JSONTy return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/__init__.py index 22d3120a170..179ad255d75 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PetsOperations __all__ = [ - "PetsOperations", + 'PetsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py index 3b7c0aa75a0..1afd16fa2d3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py @@ -8,126 +8,185 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_pets_create_ap_true_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_pets_create_ap_true_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/true" + url = '/additionalProperties/true' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_pets_create_cat_ap_true_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_pets_create_cat_ap_true_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/true-subclass" + url = '/additionalProperties/true-subclass' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_pets_create_ap_object_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_pets_create_ap_object_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/type/object" + url = '/additionalProperties/type/object' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_pets_create_ap_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_pets_create_ap_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/type/string" + url = '/additionalProperties/type/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_pets_create_ap_in_properties_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/in/properties" + url = '/additionalProperties/in/properties' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_pets_create_ap_in_properties_with_ap_string_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/additionalProperties/in/properties/with/additionalProperties/string" + url = '/additionalProperties/in/properties/with/additionalProperties/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class PetsOperations(object): """PetsOperations operations. @@ -148,7 +207,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + def create_ap_true( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -174,11 +237,13 @@ def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -189,7 +254,9 @@ def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -207,8 +274,14 @@ def create_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType return deserialized + + @distributed_trace - def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + def create_cat_ap_true( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a CatAPTrue which contains more properties than what is defined. :param create_parameters: @@ -236,11 +309,13 @@ def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSON "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -251,7 +326,9 @@ def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSON request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -269,8 +346,14 @@ def create_cat_ap_true(self, create_parameters: JSONType, **kwargs: Any) -> JSON return deserialized + + @distributed_trace - def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + def create_ap_object( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -296,11 +379,13 @@ def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> JSONTy "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -311,7 +396,9 @@ def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> JSONTy request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -329,8 +416,14 @@ def create_ap_object(self, create_parameters: JSONType, **kwargs: Any) -> JSONTy return deserialized + + @distributed_trace - def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + def create_ap_string( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -356,11 +449,13 @@ def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONTy "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -371,7 +466,9 @@ def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONTy request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -389,8 +486,14 @@ def create_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONTy return deserialized + + @distributed_trace - def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + def create_ap_in_properties( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -416,11 +519,13 @@ def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: Any) -> "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -431,7 +536,9 @@ def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -449,8 +556,14 @@ def create_ap_in_properties(self, create_parameters: JSONType, **kwargs: Any) -> return deserialized + + @distributed_trace - def create_ap_in_properties_with_ap_string(self, create_parameters: JSONType, **kwargs: Any) -> JSONType: + def create_ap_in_properties_with_ap_string( + self, + create_parameters: JSONType, + **kwargs: Any + ) -> JSONType: """Create a Pet which contains more properties than what is defined. :param create_parameters: @@ -484,11 +597,13 @@ def create_ap_in_properties_with_ap_string(self, create_parameters: JSONType, ** "status": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = create_parameters @@ -499,7 +614,9 @@ def create_ap_in_properties_with_ap_string(self, create_parameters: JSONType, ** request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -516,3 +633,5 @@ def create_ap_in_properties_with_ap_string(self, create_parameters: JSONType, ** return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py index afc03668fe3..1034510e10b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/__init__.py index 7e1dae047a1..f29d927007d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AnythingClient"] +__all__ = ['AnythingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_anything_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_anything_client.py index 0441d73173d..64e20b6f779 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_anything_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_anything_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AnythingClient(AnythingClientOperationsMixin): """Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. @@ -29,8 +28,13 @@ class AnythingClient(AnythingClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AnythingClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -38,6 +42,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_configuration.py index a2d66e167b3..c6b60378423 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-in attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AnythingClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "anythingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'anythingclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/__init__.py index 9aeabb01bdb..3f45e7940c7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AnythingClientOperationsMixin __all__ = [ - "AnythingClientOperationsMixin", + 'AnythingClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py index eed3547600f..ec0bb15060b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py @@ -8,108 +8,160 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_object_request(**kwargs: Any) -> HttpRequest: +def build_get_object_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/anything/object" + url = '/anything/object' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_object_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_object_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/anything/object" + url = '/anything/object' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_string_request(**kwargs: Any) -> HttpRequest: +def build_get_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/anything/string" + url = '/anything/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/anything/string" + url = '/anything/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_array_request(**kwargs: Any) -> HttpRequest: +def build_get_array_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/anything/array" + url = '/anything/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_array_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/anything/array" + url = '/anything/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AnythingClientOperationsMixin(object): + @distributed_trace - def get_object(self, **kwargs: Any) -> Any: + def get_object( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an object as anything. Returns object { 'message': 'An object was successfully returned' }. @@ -117,15 +169,21 @@ def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_object_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_object_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -143,8 +201,14 @@ def get_object(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def put_object(self, input: Any, **kwargs: Any) -> None: + def put_object( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -154,11 +218,13 @@ def put_object(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = input @@ -169,7 +235,9 @@ def put_object(self, input: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -180,23 +248,34 @@ def put_object(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_string(self, **kwargs: Any) -> Any: + def get_string( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an string as anything. Returns string 'foo'. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -214,8 +293,14 @@ def get_string(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def put_string(self, input: Any, **kwargs: Any) -> None: + def put_string( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to get an object error. @@ -225,11 +310,13 @@ def put_string(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = input @@ -240,7 +327,9 @@ def put_string(self, input: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -251,23 +340,34 @@ def put_string(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_array(self, **kwargs: Any) -> Any: + def get_array( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an array as anything. Returns string ['foo', 'bar']. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_array_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_array_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -285,8 +385,14 @@ def get_array(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def put_array(self, input: Any, **kwargs: Any) -> None: + def put_array( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else to get an object error. @@ -296,11 +402,13 @@ def put_array(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = input @@ -311,7 +419,9 @@ def put_array(self, input: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -321,3 +431,5 @@ def put_array(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/__init__.py index fbe1d346305..007b54da226 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._anything_client import AnythingClient - -__all__ = ["AnythingClient"] +__all__ = ['AnythingClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_anything_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_anything_client.py index e863594c756..cd754e9d316 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_anything_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_anything_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AnythingClient(AnythingClientOperationsMixin): """Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. @@ -29,7 +28,12 @@ class AnythingClient(AnythingClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AnythingClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,7 +41,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_configuration.py index c2115fb2b46..377954d2dff 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-in attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AnythingClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "anythingclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'anythingclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/__init__.py index 9aeabb01bdb..3f45e7940c7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AnythingClientOperationsMixin __all__ = [ - "AnythingClientOperationsMixin", + 'AnythingClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py index 14753c0c057..663996e709e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py @@ -8,35 +8,24 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ..._operations._operations import ( - build_get_array_request, - build_get_object_request, - build_get_string_request, - build_put_array_request, - build_put_object_request, - build_put_string_request, -) - -T = TypeVar("T") +from ..._operations._operations import build_get_array_request, build_get_object_request, build_get_string_request, build_put_array_request, build_put_object_request, build_put_string_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AnythingClientOperationsMixin: + @distributed_trace_async - async def get_object(self, **kwargs: Any) -> Any: + async def get_object( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an object as anything. Returns object { 'message': 'An object was successfully returned' }. @@ -44,15 +33,21 @@ async def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_object_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_object_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -70,8 +65,14 @@ async def get_object(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def put_object(self, input: Any, **kwargs: Any) -> None: + async def put_object( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -81,11 +82,13 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = input @@ -96,7 +99,9 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -107,23 +112,34 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_string(self, **kwargs: Any) -> Any: + async def get_string( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an string as anything. Returns string 'foo'. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -141,8 +157,14 @@ async def get_string(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def put_string(self, input: Any, **kwargs: Any) -> None: + async def put_string( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to get an object error. @@ -152,11 +174,13 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = input @@ -167,7 +191,9 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -178,23 +204,34 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_array(self, **kwargs: Any) -> Any: + async def get_array( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an array as anything. Returns string ['foo', 'bar']. :return: any :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_array_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_array_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -212,8 +249,14 @@ async def get_array(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def put_array(self, input: Any, **kwargs: Any) -> None: + async def put_array( + self, + input: Any, + **kwargs: Any + ) -> None: """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else to get an object error. @@ -223,11 +266,13 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = input @@ -238,7 +283,9 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -248,3 +295,5 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py index 5983ebe0fb1..13b9e2c8eb3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing basic anything types. Those schemas without types can be anything: primitive, object, array. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/__init__.py index c845d24af2c..e4684d784ee 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_auto_rest_swagger_bat_array_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_auto_rest_swagger_bat_array_service.py index fdf56dadd76..ee2be3383d7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_auto_rest_swagger_bat_array_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATArrayService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,8 +29,13 @@ class AutoRestSwaggerBATArrayService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_configuration.py index 65295dce353..25a81fbf1ce 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: dis attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/__init__.py index e216d69d910..9992f153487 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService - -__all__ = ["AutoRestSwaggerBATArrayService"] +__all__ = ['AutoRestSwaggerBATArrayService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_auto_rest_swagger_bat_array_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_auto_rest_swagger_bat_array_service.py index c41264621c1..1401370430e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_auto_rest_swagger_bat_array_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_auto_rest_swagger_bat_array_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATArrayService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,7 +29,12 @@ class AutoRestSwaggerBATArrayService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_configuration.py index 8f8d31c319a..71ef2cbc2a8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: dis attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatarrayservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/__init__.py index 7a4e54f3ff7..bc40061dacf 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py index b013236845a..5a51daef25b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py @@ -9,95 +9,17 @@ import datetime from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_array_get_array_empty_request, - build_array_get_array_item_empty_request, - build_array_get_array_item_null_request, - build_array_get_array_null_request, - build_array_get_array_valid_request, - build_array_get_base64_url_request, - build_array_get_boolean_invalid_null_request, - build_array_get_boolean_invalid_string_request, - build_array_get_boolean_tfft_request, - build_array_get_byte_invalid_null_request, - build_array_get_byte_valid_request, - build_array_get_complex_empty_request, - build_array_get_complex_item_empty_request, - build_array_get_complex_item_null_request, - build_array_get_complex_null_request, - build_array_get_complex_valid_request, - build_array_get_date_invalid_chars_request, - build_array_get_date_invalid_null_request, - build_array_get_date_time_invalid_chars_request, - build_array_get_date_time_invalid_null_request, - build_array_get_date_time_rfc1123_valid_request, - build_array_get_date_time_valid_request, - build_array_get_date_valid_request, - build_array_get_dictionary_empty_request, - build_array_get_dictionary_item_empty_request, - build_array_get_dictionary_item_null_request, - build_array_get_dictionary_null_request, - build_array_get_dictionary_valid_request, - build_array_get_double_invalid_null_request, - build_array_get_double_invalid_string_request, - build_array_get_double_valid_request, - build_array_get_duration_valid_request, - build_array_get_empty_request, - build_array_get_enum_valid_request, - build_array_get_float_invalid_null_request, - build_array_get_float_invalid_string_request, - build_array_get_float_valid_request, - build_array_get_int_invalid_null_request, - build_array_get_int_invalid_string_request, - build_array_get_integer_valid_request, - build_array_get_invalid_request, - build_array_get_long_invalid_null_request, - build_array_get_long_invalid_string_request, - build_array_get_long_valid_request, - build_array_get_null_request, - build_array_get_string_enum_valid_request, - build_array_get_string_valid_request, - build_array_get_string_with_invalid_request, - build_array_get_string_with_null_request, - build_array_get_uuid_invalid_chars_request, - build_array_get_uuid_valid_request, - build_array_put_array_valid_request, - build_array_put_boolean_tfft_request, - build_array_put_byte_valid_request, - build_array_put_complex_valid_request, - build_array_put_date_time_rfc1123_valid_request, - build_array_put_date_time_valid_request, - build_array_put_date_valid_request, - build_array_put_dictionary_valid_request, - build_array_put_double_valid_request, - build_array_put_duration_valid_request, - build_array_put_empty_request, - build_array_put_enum_valid_request, - build_array_put_float_valid_request, - build_array_put_integer_valid_request, - build_array_put_long_valid_request, - build_array_put_string_enum_valid_request, - build_array_put_string_valid_request, - build_array_put_uuid_valid_request, -) - -T = TypeVar("T") +from ...operations._operations import build_array_get_array_empty_request, build_array_get_array_item_empty_request, build_array_get_array_item_null_request, build_array_get_array_null_request, build_array_get_array_valid_request, build_array_get_base64_url_request, build_array_get_boolean_invalid_null_request, build_array_get_boolean_invalid_string_request, build_array_get_boolean_tfft_request, build_array_get_byte_invalid_null_request, build_array_get_byte_valid_request, build_array_get_complex_empty_request, build_array_get_complex_item_empty_request, build_array_get_complex_item_null_request, build_array_get_complex_null_request, build_array_get_complex_valid_request, build_array_get_date_invalid_chars_request, build_array_get_date_invalid_null_request, build_array_get_date_time_invalid_chars_request, build_array_get_date_time_invalid_null_request, build_array_get_date_time_rfc1123_valid_request, build_array_get_date_time_valid_request, build_array_get_date_valid_request, build_array_get_dictionary_empty_request, build_array_get_dictionary_item_empty_request, build_array_get_dictionary_item_null_request, build_array_get_dictionary_null_request, build_array_get_dictionary_valid_request, build_array_get_double_invalid_null_request, build_array_get_double_invalid_string_request, build_array_get_double_valid_request, build_array_get_duration_valid_request, build_array_get_empty_request, build_array_get_enum_valid_request, build_array_get_float_invalid_null_request, build_array_get_float_invalid_string_request, build_array_get_float_valid_request, build_array_get_int_invalid_null_request, build_array_get_int_invalid_string_request, build_array_get_integer_valid_request, build_array_get_invalid_request, build_array_get_long_invalid_null_request, build_array_get_long_invalid_string_request, build_array_get_long_valid_request, build_array_get_null_request, build_array_get_string_enum_valid_request, build_array_get_string_valid_request, build_array_get_string_with_invalid_request, build_array_get_string_with_null_request, build_array_get_uuid_invalid_chars_request, build_array_get_uuid_valid_request, build_array_put_array_valid_request, build_array_put_boolean_tfft_request, build_array_put_byte_valid_request, build_array_put_complex_valid_request, build_array_put_date_time_rfc1123_valid_request, build_array_put_date_time_valid_request, build_array_put_date_valid_request, build_array_put_dictionary_valid_request, build_array_put_double_valid_request, build_array_put_duration_valid_request, build_array_put_empty_request, build_array_put_enum_valid_request, build_array_put_float_valid_request, build_array_put_integer_valid_request, build_array_put_long_valid_request, build_array_put_string_enum_valid_request, build_array_put_string_valid_request, build_array_put_uuid_valid_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ArrayOperations: # pylint: disable=too-many-public-methods """ArrayOperations async operations. @@ -117,7 +39,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> List[int]: + async def get_null( + self, + **kwargs: Any + ) -> List[int]: """Get null array value. :return: list of int @@ -132,15 +57,21 @@ async def get_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_null_request() + + request = build_array_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -158,8 +89,13 @@ async def get_null(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> List[int]: + async def get_invalid( + self, + **kwargs: Any + ) -> List[int]: """Get invalid array [1, 2, 3. :return: list of int @@ -174,15 +110,21 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_invalid_request() + + request = build_array_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -200,8 +142,13 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> List[int]: + async def get_empty( + self, + **kwargs: Any + ) -> List[int]: """Get empty array value []. :return: list of int @@ -216,15 +163,21 @@ async def get_empty(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_empty_request() + + request = build_array_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -242,8 +195,14 @@ async def get_empty(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: + async def put_empty( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value empty []. :param array_body: @@ -260,11 +219,13 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -275,7 +236,9 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -286,8 +249,13 @@ async def put_empty(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: + async def get_boolean_tfft( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, false, false, true]. :return: list of bool @@ -302,15 +270,21 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_boolean_tfft_request() + + request = build_array_get_boolean_tfft_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -328,8 +302,14 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: return deserialized + + @distributed_trace_async - async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: + async def put_boolean_tfft( + self, + array_body: List[bool], + **kwargs: Any + ) -> None: """Set array value empty [true, false, false, true]. :param array_body: @@ -346,11 +326,13 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -361,7 +343,9 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -372,8 +356,13 @@ async def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, null, false]. :return: list of bool @@ -388,15 +377,21 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_boolean_invalid_null_request() + + request = build_array_get_boolean_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -414,8 +409,13 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: return deserialized + + @distributed_trace_async - async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: + async def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, 'boolean', false]. :return: list of bool @@ -430,15 +430,21 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_boolean_invalid_string_request() + + request = build_array_get_boolean_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -456,8 +462,13 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: return deserialized + + @distributed_trace_async - async def get_integer_valid(self, **kwargs: Any) -> List[int]: + async def get_integer_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :return: list of int @@ -472,15 +483,21 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_integer_valid_request() + + request = build_array_get_integer_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -498,8 +515,14 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_integer_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -516,11 +539,13 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -531,7 +556,9 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -542,8 +569,13 @@ async def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, null, 0]. :return: list of int @@ -558,15 +590,21 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_int_invalid_null_request() + + request = build_array_get_int_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -584,8 +622,13 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_int_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, 'integer', 0]. :return: list of int @@ -600,15 +643,21 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_int_invalid_string_request() + + request = build_array_get_int_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -626,8 +675,13 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def get_long_valid(self, **kwargs: Any) -> List[int]: + async def get_long_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :return: list of long @@ -642,15 +696,21 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_long_valid_request() + + request = build_array_get_long_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -668,8 +728,14 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: + async def put_long_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -686,11 +752,13 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -701,7 +769,9 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -712,8 +782,13 @@ async def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, null, 0]. :return: list of long @@ -728,15 +803,21 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_long_invalid_null_request() + + request = build_array_get_long_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -754,8 +835,13 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: + async def get_long_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, 'integer', 0]. :return: list of long @@ -770,15 +856,21 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_long_invalid_string_request() + + request = build_array_get_long_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -796,8 +888,13 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace_async - async def get_float_valid(self, **kwargs: Any) -> List[float]: + async def get_float_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :return: list of float @@ -812,15 +909,21 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_float_valid_request() + + request = build_array_get_float_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -838,8 +941,14 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace_async - async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_float_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -856,11 +965,13 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -871,7 +982,9 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -882,8 +995,13 @@ async def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :return: list of float @@ -898,15 +1016,21 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_float_invalid_null_request() + + request = build_array_get_float_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -924,8 +1048,13 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace_async - async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_float_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :return: list of float @@ -940,15 +1069,21 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_float_invalid_string_request() + + request = build_array_get_float_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -966,8 +1101,13 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace_async - async def get_double_valid(self, **kwargs: Any) -> List[float]: + async def get_double_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :return: list of float @@ -982,15 +1122,21 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_double_valid_request() + + request = build_array_get_double_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1008,8 +1154,14 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace_async - async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: + async def put_double_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -1026,11 +1178,13 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1041,7 +1195,9 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1052,8 +1208,13 @@ async def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :return: list of float @@ -1068,15 +1229,21 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_double_invalid_null_request() + + request = build_array_get_double_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1094,8 +1261,13 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace_async - async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: + async def get_double_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :return: list of float @@ -1110,15 +1282,21 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_double_invalid_string_request() + + request = build_array_get_double_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1136,8 +1314,13 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace_async - async def get_string_valid(self, **kwargs: Any) -> List[str]: + async def get_string_valid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo1', 'foo2', 'foo3']. :return: list of str @@ -1152,15 +1335,21 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_string_valid_request() + + request = build_array_get_string_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1178,8 +1367,14 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace_async - async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_string_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1196,11 +1391,13 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1211,7 +1408,9 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1222,8 +1421,13 @@ async def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_enum_valid(self, **kwargs: Any) -> List[str]: + async def get_enum_valid( + self, + **kwargs: Any + ) -> List[str]: """Get enum array value ['foo1', 'foo2', 'foo3']. :return: list of str. Possible values are: "foo1", "foo2", and "foo3". @@ -1238,15 +1442,21 @@ async def get_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_enum_valid_request() + + request = build_array_get_enum_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1264,8 +1474,14 @@ async def get_enum_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace_async - async def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_enum_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1282,11 +1498,13 @@ async def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1297,7 +1515,9 @@ async def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1308,8 +1528,13 @@ async def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_string_enum_valid(self, **kwargs: Any) -> List[str]: + async def get_string_enum_valid( + self, + **kwargs: Any + ) -> List[str]: """Get enum array value ['foo1', 'foo2', 'foo3']. :return: list of str. Possible values are: "foo1", "foo2", and "foo3". @@ -1324,15 +1549,21 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_string_enum_valid_request() + + request = build_array_get_string_enum_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1350,8 +1581,14 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace_async - async def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_string_enum_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -1368,11 +1605,13 @@ async def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> N "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1383,7 +1622,9 @@ async def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1394,8 +1635,13 @@ async def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_string_with_null(self, **kwargs: Any) -> List[str]: + async def get_string_with_null( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', null, 'foo2']. :return: list of str @@ -1410,15 +1656,21 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_string_with_null_request() + + request = build_array_get_string_with_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1436,8 +1688,13 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace_async - async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: + async def get_string_with_invalid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', 123, 'foo2']. :return: list of str @@ -1452,15 +1709,21 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_string_with_invalid_request() + + request = build_array_get_string_with_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1478,8 +1741,13 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace_async - async def get_uuid_valid(self, **kwargs: Any) -> List[str]: + async def get_uuid_valid( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1495,15 +1763,21 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: str # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_uuid_valid_request() + + request = build_array_get_uuid_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1521,8 +1795,14 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace_async - async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: + async def put_uuid_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1540,11 +1820,13 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: str # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1555,7 +1837,9 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1566,8 +1850,13 @@ async def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: + async def get_uuid_invalid_chars( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. :return: list of str @@ -1582,15 +1871,21 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: str # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_uuid_invalid_chars_request() + + request = build_array_get_uuid_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1608,8 +1903,13 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace_async - async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_valid( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. :return: list of date @@ -1624,15 +1924,21 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_date_valid_request() + + request = build_array_get_date_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1650,8 +1956,14 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: return deserialized + + @distributed_trace_async - async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None: + async def put_date_valid( + self, + array_body: List[datetime.date], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. :param array_body: @@ -1668,11 +1980,13 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1683,7 +1997,9 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1694,8 +2010,13 @@ async def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2012-01-01', null, '1776-07-04']. :return: list of date @@ -1710,15 +2031,21 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_date_invalid_null_request() + + request = build_array_get_date_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1736,8 +2063,13 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: return deserialized + + @distributed_trace_async - async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: + async def get_date_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2011-03-22', 'date']. :return: list of date @@ -1752,15 +2084,21 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_date_invalid_chars_request() + + request = build_array_get_date_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1778,8 +2116,13 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: return deserialized + + @distributed_trace_async - async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1795,15 +2138,21 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_date_time_valid_request() + + request = build_array_get_date_time_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1821,8 +2170,14 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: return deserialized + + @distributed_trace_async - async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1840,11 +2195,13 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1855,7 +2212,9 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1866,8 +2225,13 @@ async def put_date_time_valid(self, array_body: List[datetime.datetime], **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', null]. :return: list of datetime @@ -1882,15 +2246,21 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_date_time_invalid_null_request() + + request = build_array_get_date_time_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1908,8 +2278,13 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet return deserialized + + @distributed_trace_async - async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. :return: list of datetime @@ -1924,15 +2299,21 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_date_time_invalid_chars_request() + + request = build_array_get_date_time_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1950,8 +2331,13 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date return deserialized + + @distributed_trace_async - async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: + async def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -1967,15 +2353,21 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_date_time_rfc1123_valid_request() + + request = build_array_get_date_time_rfc1123_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1993,8 +2385,14 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date return deserialized + + @distributed_trace_async - async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_rfc1123_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2012,11 +2410,13 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2027,7 +2427,9 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2038,8 +2440,13 @@ async def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: + async def get_duration_valid( + self, + **kwargs: Any + ) -> List[datetime.timedelta]: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :return: list of timedelta @@ -2054,15 +2461,21 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_duration_valid_request() + + request = build_array_get_duration_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2080,8 +2493,14 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: return deserialized + + @distributed_trace_async - async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any) -> None: + async def put_duration_valid( + self, + array_body: List[datetime.timedelta], + **kwargs: Any + ) -> None: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :param array_body: @@ -2098,11 +2517,13 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg "1 day, 0:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2113,7 +2534,9 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2124,8 +2547,13 @@ async def put_duration_valid(self, array_body: List[datetime.timedelta], **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_valid( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -2141,15 +2569,21 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: bytearray("bytearray", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_byte_valid_request() + + request = build_array_get_byte_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2167,8 +2601,14 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: return deserialized + + @distributed_trace_async - async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: + async def put_byte_valid( + self, + array_body: List[bytearray], + **kwargs: Any + ) -> None: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -2186,11 +2626,13 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No bytearray("bytearray", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2201,7 +2643,9 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2212,8 +2656,13 @@ async def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: + async def get_byte_invalid_null( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. :return: list of bytearray @@ -2228,15 +2677,21 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: bytearray("bytearray", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_byte_invalid_null_request() + + request = build_array_get_byte_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2254,8 +2709,13 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: return deserialized + + @distributed_trace_async - async def get_base64_url(self, **kwargs: Any) -> List[bytes]: + async def get_base64_url( + self, + **kwargs: Any + ) -> List[bytes]: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -2271,15 +2731,21 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_base64_url_request() + + request = build_array_get_base64_url_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2297,8 +2763,13 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: return deserialized + + @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> List[JSONType]: + async def get_complex_null( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type null value. :return: list of JSON object @@ -2316,15 +2787,21 @@ async def get_complex_null(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_complex_null_request() + + request = build_array_get_complex_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2342,8 +2819,13 @@ async def get_complex_null(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> List[JSONType]: + async def get_complex_empty( + self, + **kwargs: Any + ) -> List[JSONType]: """Get empty array of complex type []. :return: list of JSON object @@ -2361,15 +2843,21 @@ async def get_complex_empty(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_complex_empty_request() + + request = build_array_get_complex_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2387,8 +2875,13 @@ async def get_complex_empty(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> List[JSONType]: + async def get_complex_item_null( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -2407,15 +2900,21 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_complex_item_null_request() + + request = build_array_get_complex_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2433,8 +2932,13 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> List[JSONType]: + async def get_complex_item_empty( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -2453,15 +2957,21 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_complex_item_empty_request() + + request = build_array_get_complex_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2479,8 +2989,13 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> List[JSONType]: + async def get_complex_valid( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2499,15 +3014,21 @@ async def get_complex_valid(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_complex_valid_request() + + request = build_array_get_complex_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2525,8 +3046,14 @@ async def get_complex_valid(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> None: + async def put_complex_valid( + self, + array_body: List[JSONType], + **kwargs: Any + ) -> None: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2547,11 +3074,13 @@ async def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2562,7 +3091,9 @@ async def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2573,8 +3104,13 @@ async def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_array_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get a null array. :return: list of list of str @@ -2591,15 +3127,21 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_array_null_request() + + request = build_array_get_array_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2617,8 +3159,13 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace_async - async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an empty array []. :return: list of list of str @@ -2635,15 +3182,21 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_array_empty_request() + + request = build_array_get_array_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2661,8 +3214,13 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace_async - async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. :return: list of list of str @@ -2679,15 +3237,21 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_array_item_null_request() + + request = build_array_get_array_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2705,8 +3269,13 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace_async - async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: + async def get_array_item_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. :return: list of list of str @@ -2723,15 +3292,21 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_array_item_empty_request() + + request = build_array_get_array_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2749,8 +3324,13 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace_async - async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: + async def get_array_valid( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :return: list of list of str @@ -2767,15 +3347,21 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_array_valid_request() + + request = build_array_get_array_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2793,8 +3379,14 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace_async - async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: + async def put_array_valid( + self, + array_body: List[List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :param array_body: @@ -2813,11 +3405,13 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2828,7 +3422,9 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2839,8 +3435,13 @@ async def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries with value null. :return: list of dict mapping str to str @@ -2857,15 +3458,21 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_dictionary_null_request() + + request = build_array_get_dictionary_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2883,8 +3490,13 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace_async - async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value []. :return: list of dict mapping str to str @@ -2901,15 +3513,21 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_dictionary_empty_request() + + request = build_array_get_dictionary_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2927,8 +3545,13 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2946,15 +3569,21 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_dictionary_item_null_request() + + request = build_array_get_dictionary_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2972,8 +3601,13 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -2991,15 +3625,21 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_dictionary_item_empty_request() + + request = build_array_get_dictionary_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3017,8 +3657,13 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] return deserialized + + @distributed_trace_async - async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: + async def get_dictionary_valid( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3036,15 +3681,21 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_dictionary_valid_request() + + request = build_array_get_dictionary_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3062,8 +3713,14 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace_async - async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) -> None: + async def put_dictionary_valid( + self, + array_body: List[Dict[str, str]], + **kwargs: Any + ) -> None: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3083,11 +3740,13 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3098,7 +3757,9 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3108,3 +3769,5 @@ async def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/__init__.py index 7a4e54f3ff7..bc40061dacf 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ArrayOperations __all__ = [ - "ArrayOperations", + 'ArrayOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py index bc8b652756d..47bef2194cd 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py @@ -9,934 +9,1490 @@ import datetime from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_array_get_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/null" + url = '/array/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/invalid" + url = '/array/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/empty" + url = '/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/empty" + url = '/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: +def build_array_get_boolean_tfft_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/boolean/tfft" + url = '/array/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_boolean_tfft_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_boolean_tfft_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/boolean/tfft" + url = '/array/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_boolean_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/boolean/true.null.false" + url = '/array/prim/boolean/true.null.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_array_get_boolean_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/boolean/true.boolean.false" + url = '/array/prim/boolean/true.boolean.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_integer_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_integer_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/integer/1.-1.3.300" + url = '/array/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_integer_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_integer_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/integer/1.-1.3.300" + url = '/array/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_int_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/integer/1.null.zero" + url = '/array/prim/integer/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_array_get_int_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/integer/1.integer.0" + url = '/array/prim/integer/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_long_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_long_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/long/1.-1.3.300" + url = '/array/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_long_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_long_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/long/1.-1.3.300" + url = '/array/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_long_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/long/1.null.zero" + url = '/array/prim/long/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_array_get_long_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/long/1.integer.0" + url = '/array/prim/long/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_float_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_float_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/float/0--0.01-1.2e20" + url = '/array/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_float_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_float_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/float/0--0.01-1.2e20" + url = '/array/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_float_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/float/0.0-null-1.2e20" + url = '/array/prim/float/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_array_get_float_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/float/1.number.0" + url = '/array/prim/float/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_double_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_double_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/double/0--0.01-1.2e20" + url = '/array/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_double_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_double_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/double/0--0.01-1.2e20" + url = '/array/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_double_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/double/0.0-null-1.2e20" + url = '/array/prim/double/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_array_get_double_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/double/1.number.0" + url = '/array/prim/double/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_string_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_string_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string/foo1.foo2.foo3" + url = '/array/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_string_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_string_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/string/foo1.foo2.foo3" + url = '/array/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_enum_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_enum_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/enum/foo1.foo2.foo3" + url = '/array/prim/enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_enum_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_enum_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/enum/foo1.foo2.foo3" + url = '/array/prim/enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_string_enum_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string-enum/foo1.foo2.foo3" + url = '/array/prim/string-enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_array_put_string_enum_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/string-enum/foo1.foo2.foo3" + url = '/array/prim/string-enum/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_string_with_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_string_with_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string/foo.null.foo2" + url = '/array/prim/string/foo.null.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_string_with_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/string/foo.123.foo2" + url = '/array/prim/string/foo.123.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_uuid_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/uuid/valid" + url = '/array/prim/uuid/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_uuid_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_uuid_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/uuid/valid" + url = '/array/prim/uuid/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_uuid_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_array_get_uuid_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/uuid/invalidchars" + url = '/array/prim/uuid/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_date_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_date_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date/valid" + url = '/array/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_date_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_date_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/date/valid" + url = '/array/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_date_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date/invalidnull" + url = '/array/prim/date/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_array_get_date_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date/invalidchars" + url = '/array/prim/date/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time/valid" + url = '/array/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_array_put_date_time_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/date-time/valid" + url = '/array/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_date_time_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time/invalidnull" + url = '/array/prim/date-time/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_array_get_date_time_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time/invalidchars" + url = '/array/prim/date-time/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_date_time_rfc1123_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/date-time-rfc1123/valid" + url = '/array/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_array_put_date_time_rfc1123_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/date-time-rfc1123/valid" + url = '/array/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_duration_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_duration_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/duration/valid" + url = '/array/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_duration_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_duration_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/duration/valid" + url = '/array/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_byte_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_byte_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/byte/valid" + url = '/array/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_byte_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_byte_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/prim/byte/valid" + url = '/array/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_byte_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/byte/invalidnull" + url = '/array/prim/byte/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_base64_url_request(**kwargs: Any) -> HttpRequest: +def build_array_get_base64_url_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/prim/base64url/valid" + url = '/array/prim/base64url/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_complex_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_complex_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/null" + url = '/array/complex/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_complex_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_complex_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/empty" + url = '/array/complex/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_complex_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/itemnull" + url = '/array/complex/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_complex_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/itemempty" + url = '/array/complex/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_complex_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_complex_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/complex/valid" + url = '/array/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_complex_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_complex_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/complex/valid" + url = '/array/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_array_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_array_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/null" + url = '/array/array/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_array_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_array_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/empty" + url = '/array/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_array_item_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_array_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/itemnull" + url = '/array/array/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_array_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/itemempty" + url = '/array/array/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_array_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_array_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/array/valid" + url = '/array/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_array_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_array_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/array/valid" + url = '/array/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_dictionary_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/null" + url = '/array/dictionary/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_dictionary_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/empty" + url = '/array/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: +def build_array_get_dictionary_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/itemnull" + url = '/array/dictionary/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_dictionary_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/itemempty" + url = '/array/dictionary/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_dictionary_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/array/dictionary/valid" + url = '/array/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_array_put_dictionary_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/array/dictionary/valid" + url = '/array/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ArrayOperations(object): # pylint: disable=too-many-public-methods """ArrayOperations operations. @@ -957,7 +1513,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> List[int]: + def get_null( + self, + **kwargs: Any + ) -> List[int]: """Get null array value. :return: list of int @@ -972,15 +1531,21 @@ def get_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -998,8 +1563,13 @@ def get_null(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> List[int]: + def get_invalid( + self, + **kwargs: Any + ) -> List[int]: """Get invalid array [1, 2, 3. :return: list of int @@ -1014,15 +1584,21 @@ def get_invalid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1040,8 +1616,13 @@ def get_invalid(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def get_empty(self, **kwargs: Any) -> List[int]: + def get_empty( + self, + **kwargs: Any + ) -> List[int]: """Get empty array value []. :return: list of int @@ -1056,15 +1637,21 @@ def get_empty(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1082,8 +1669,14 @@ def get_empty(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def put_empty(self, array_body: List[str], **kwargs: Any) -> None: + def put_empty( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value empty []. :param array_body: @@ -1100,11 +1693,13 @@ def put_empty(self, array_body: List[str], **kwargs: Any) -> None: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1115,7 +1710,9 @@ def put_empty(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1126,8 +1723,13 @@ def put_empty(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: + def get_boolean_tfft( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, false, false, true]. :return: list of bool @@ -1142,15 +1744,21 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_boolean_tfft_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_boolean_tfft_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1168,8 +1776,14 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: return deserialized + + @distributed_trace - def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: + def put_boolean_tfft( + self, + array_body: List[bool], + **kwargs: Any + ) -> None: """Set array value empty [true, false, false, true]. :param array_body: @@ -1186,11 +1800,13 @@ def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1201,7 +1817,9 @@ def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1212,8 +1830,13 @@ def put_boolean_tfft(self, array_body: List[bool], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: + def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, null, false]. :return: list of bool @@ -1228,15 +1851,21 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_boolean_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_boolean_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1254,8 +1883,13 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: return deserialized + + @distributed_trace - def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: + def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> List[bool]: """Get boolean array value [true, 'boolean', false]. :return: list of bool @@ -1270,15 +1904,21 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_boolean_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_boolean_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1296,8 +1936,13 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: return deserialized + + @distributed_trace - def get_integer_valid(self, **kwargs: Any) -> List[int]: + def get_integer_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :return: list of int @@ -1312,15 +1957,21 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_integer_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_integer_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1338,8 +1989,14 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: + def put_integer_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -1356,11 +2013,13 @@ def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1371,7 +2030,9 @@ def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1382,8 +2043,13 @@ def put_integer_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_int_invalid_null(self, **kwargs: Any) -> List[int]: + def get_int_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, null, 0]. :return: list of int @@ -1398,15 +2064,21 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_int_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_int_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1424,8 +2096,13 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def get_int_invalid_string(self, **kwargs: Any) -> List[int]: + def get_int_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, 'integer', 0]. :return: list of int @@ -1440,15 +2117,21 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_int_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_int_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1466,8 +2149,13 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def get_long_valid(self, **kwargs: Any) -> List[int]: + def get_long_valid( + self, + **kwargs: Any + ) -> List[int]: """Get integer array value [1, -1, 3, 300]. :return: list of long @@ -1482,15 +2170,21 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_long_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_long_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1508,8 +2202,14 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: + def put_long_valid( + self, + array_body: List[int], + **kwargs: Any + ) -> None: """Set array value empty [1, -1, 3, 300]. :param array_body: @@ -1526,11 +2226,13 @@ def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1541,7 +2243,9 @@ def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1552,8 +2256,13 @@ def put_long_valid(self, array_body: List[int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_long_invalid_null(self, **kwargs: Any) -> List[int]: + def get_long_invalid_null( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, null, 0]. :return: list of long @@ -1568,15 +2277,21 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_long_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_long_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1594,8 +2309,13 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def get_long_invalid_string(self, **kwargs: Any) -> List[int]: + def get_long_invalid_string( + self, + **kwargs: Any + ) -> List[int]: """Get long array value [1, 'integer', 0]. :return: list of long @@ -1610,15 +2330,21 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_long_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_long_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1636,8 +2362,13 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: return deserialized + + @distributed_trace - def get_float_valid(self, **kwargs: Any) -> List[float]: + def get_float_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :return: list of float @@ -1652,15 +2383,21 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_float_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_float_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1678,8 +2415,14 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace - def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: + def put_float_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -1696,11 +2439,13 @@ def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1711,7 +2456,9 @@ def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1722,8 +2469,13 @@ def put_float_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_float_invalid_null(self, **kwargs: Any) -> List[float]: + def get_float_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :return: list of float @@ -1738,15 +2490,21 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_float_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_float_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1764,8 +2522,13 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace - def get_float_invalid_string(self, **kwargs: Any) -> List[float]: + def get_float_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :return: list of float @@ -1780,15 +2543,21 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_float_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_float_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1806,8 +2575,13 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace - def get_double_valid(self, **kwargs: Any) -> List[float]: + def get_double_valid( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0, -0.01, 1.2e20]. :return: list of float @@ -1822,15 +2596,21 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_double_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_double_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1848,8 +2628,14 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace - def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: + def put_double_valid( + self, + array_body: List[float], + **kwargs: Any + ) -> None: """Set array value [0, -0.01, 1.2e20]. :param array_body: @@ -1866,11 +2652,13 @@ def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1881,7 +2669,9 @@ def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1892,8 +2682,13 @@ def put_double_valid(self, array_body: List[float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_double_invalid_null(self, **kwargs: Any) -> List[float]: + def get_double_invalid_null( + self, + **kwargs: Any + ) -> List[float]: """Get float array value [0.0, null, -1.2e20]. :return: list of float @@ -1908,15 +2703,21 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_double_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_double_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1934,8 +2735,13 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace - def get_double_invalid_string(self, **kwargs: Any) -> List[float]: + def get_double_invalid_string( + self, + **kwargs: Any + ) -> List[float]: """Get boolean array value [1.0, 'number', 0.0]. :return: list of float @@ -1950,15 +2756,21 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_double_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_double_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1976,8 +2788,13 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: return deserialized + + @distributed_trace - def get_string_valid(self, **kwargs: Any) -> List[str]: + def get_string_valid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo1', 'foo2', 'foo3']. :return: list of str @@ -1992,15 +2809,21 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_string_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_string_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2018,8 +2841,14 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace - def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: + def put_string_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -2036,11 +2865,13 @@ def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2051,7 +2882,9 @@ def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2062,8 +2895,13 @@ def put_string_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_enum_valid(self, **kwargs: Any) -> List[str]: + def get_enum_valid( + self, + **kwargs: Any + ) -> List[str]: """Get enum array value ['foo1', 'foo2', 'foo3']. :return: list of str. Possible values are: "foo1", "foo2", and "foo3". @@ -2078,15 +2916,21 @@ def get_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_enum_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_enum_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2104,8 +2948,14 @@ def get_enum_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace - def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: + def put_enum_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -2122,11 +2972,13 @@ def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2137,7 +2989,9 @@ def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2148,8 +3002,13 @@ def put_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_string_enum_valid(self, **kwargs: Any) -> List[str]: + def get_string_enum_valid( + self, + **kwargs: Any + ) -> List[str]: """Get enum array value ['foo1', 'foo2', 'foo3']. :return: list of str. Possible values are: "foo1", "foo2", and "foo3". @@ -2164,15 +3023,21 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_string_enum_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_string_enum_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2190,8 +3055,14 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace - def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: + def put_string_enum_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['foo1', 'foo2', 'foo3']. :param array_body: @@ -2208,11 +3079,13 @@ def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2223,7 +3096,9 @@ def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2234,8 +3109,13 @@ def put_string_enum_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_string_with_null(self, **kwargs: Any) -> List[str]: + def get_string_with_null( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', null, 'foo2']. :return: list of str @@ -2250,15 +3130,21 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_string_with_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_string_with_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2276,8 +3162,13 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace - def get_string_with_invalid(self, **kwargs: Any) -> List[str]: + def get_string_with_invalid( + self, + **kwargs: Any + ) -> List[str]: """Get string array value ['foo', 123, 'foo2']. :return: list of str @@ -2292,15 +3183,21 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_string_with_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_string_with_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2318,8 +3215,13 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace - def get_uuid_valid(self, **kwargs: Any) -> List[str]: + def get_uuid_valid( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -2335,15 +3237,21 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: str # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_uuid_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_uuid_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2361,8 +3269,14 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace - def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: + def put_uuid_valid( + self, + array_body: List[str], + **kwargs: Any + ) -> None: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -2380,11 +3294,13 @@ def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: str # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2395,7 +3311,9 @@ def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2406,8 +3324,13 @@ def put_uuid_valid(self, array_body: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: + def get_uuid_invalid_chars( + self, + **kwargs: Any + ) -> List[str]: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. :return: list of str @@ -2422,15 +3345,21 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: str # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_uuid_invalid_chars_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_uuid_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2448,8 +3377,13 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: return deserialized + + @distributed_trace - def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: + def get_date_valid( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. :return: list of date @@ -2464,15 +3398,21 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_date_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_date_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2490,8 +3430,14 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: return deserialized + + @distributed_trace - def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None: + def put_date_valid( + self, + array_body: List[datetime.date], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. :param array_body: @@ -2508,11 +3454,13 @@ def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2523,7 +3471,9 @@ def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2534,8 +3484,13 @@ def put_date_valid(self, array_body: List[datetime.date], **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: + def get_date_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2012-01-01', null, '1776-07-04']. :return: list of date @@ -2550,15 +3505,21 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_date_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_date_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2576,8 +3537,13 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: return deserialized + + @distributed_trace - def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: + def get_date_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.date]: """Get date array value ['2011-03-22', 'date']. :return: list of date @@ -2592,15 +3558,21 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_date_invalid_chars_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_date_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2618,8 +3590,13 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: return deserialized + + @distributed_trace - def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -2635,15 +3612,21 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_date_time_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_date_time_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2661,8 +3644,14 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: return deserialized + + @distributed_trace - def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + def put_date_time_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -2680,11 +3669,13 @@ def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2695,7 +3686,9 @@ def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2706,8 +3699,13 @@ def put_date_time_valid(self, array_body: List[datetime.datetime], **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', null]. :return: list of datetime @@ -2722,15 +3720,21 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_date_time_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_date_time_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2748,8 +3752,13 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: return deserialized + + @distributed_trace - def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. :return: list of datetime @@ -2764,15 +3773,21 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_date_time_invalid_chars_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_date_time_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2790,8 +3805,13 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: return deserialized + + @distributed_trace - def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: + def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> List[datetime.datetime]: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2807,15 +3827,21 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_date_time_rfc1123_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_date_time_rfc1123_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2833,8 +3859,14 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: return deserialized + + @distributed_trace - def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwargs: Any) -> None: + def put_date_time_rfc1123_valid( + self, + array_body: List[datetime.datetime], + **kwargs: Any + ) -> None: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2852,11 +3884,13 @@ def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwa "2020-02-20 00:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2867,7 +3901,9 @@ def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwa request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2878,8 +3914,13 @@ def put_date_time_rfc1123_valid(self, array_body: List[datetime.datetime], **kwa if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: + def get_duration_valid( + self, + **kwargs: Any + ) -> List[datetime.timedelta]: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :return: list of timedelta @@ -2894,15 +3935,21 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_duration_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_duration_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2920,8 +3967,14 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: return deserialized + + @distributed_trace - def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any) -> None: + def put_duration_valid( + self, + array_body: List[datetime.timedelta], + **kwargs: Any + ) -> None: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. :param array_body: @@ -2938,11 +3991,13 @@ def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any "1 day, 0:00:00" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2953,7 +4008,9 @@ def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2964,8 +4021,13 @@ def put_duration_valid(self, array_body: List[datetime.timedelta], **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: + def get_byte_valid( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -2981,15 +4043,21 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: bytearray("bytearray", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_byte_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_byte_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3007,8 +4075,14 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytearray]: return deserialized + + @distributed_trace - def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: + def put_byte_valid( + self, + array_body: List[bytearray], + **kwargs: Any + ) -> None: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -3026,11 +4100,13 @@ def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: bytearray("bytearray", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3041,7 +4117,9 @@ def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3052,8 +4130,13 @@ def put_byte_valid(self, array_body: List[bytearray], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: + def get_byte_invalid_null( + self, + **kwargs: Any + ) -> List[bytearray]: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. :return: list of bytearray @@ -3068,15 +4151,21 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: bytearray("bytearray", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_byte_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_byte_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3094,8 +4183,13 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytearray]: return deserialized + + @distributed_trace - def get_base64_url(self, **kwargs: Any) -> List[bytes]: + def get_base64_url( + self, + **kwargs: Any + ) -> List[bytes]: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -3111,15 +4205,21 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_base64_url_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_base64_url_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3137,8 +4237,13 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: return deserialized + + @distributed_trace - def get_complex_null(self, **kwargs: Any) -> List[JSONType]: + def get_complex_null( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type null value. :return: list of JSON object @@ -3156,15 +4261,21 @@ def get_complex_null(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_complex_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_complex_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3182,8 +4293,13 @@ def get_complex_null(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def get_complex_empty(self, **kwargs: Any) -> List[JSONType]: + def get_complex_empty( + self, + **kwargs: Any + ) -> List[JSONType]: """Get empty array of complex type []. :return: list of JSON object @@ -3201,15 +4317,21 @@ def get_complex_empty(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_complex_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_complex_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3227,8 +4349,13 @@ def get_complex_empty(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def get_complex_item_null(self, **kwargs: Any) -> List[JSONType]: + def get_complex_item_null( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -3247,15 +4374,21 @@ def get_complex_item_null(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_complex_item_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_complex_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3273,8 +4406,13 @@ def get_complex_item_null(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def get_complex_item_empty(self, **kwargs: Any) -> List[JSONType]: + def get_complex_item_empty( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -3293,15 +4431,21 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_complex_item_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_complex_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3319,8 +4463,13 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def get_complex_valid(self, **kwargs: Any) -> List[JSONType]: + def get_complex_valid( + self, + **kwargs: Any + ) -> List[JSONType]: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -3339,15 +4488,21 @@ def get_complex_valid(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_complex_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_complex_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3365,8 +4520,14 @@ def get_complex_valid(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> None: + def put_complex_valid( + self, + array_body: List[JSONType], + **kwargs: Any + ) -> None: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -3387,11 +4548,13 @@ def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> None: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3402,7 +4565,9 @@ def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3413,8 +4578,13 @@ def put_complex_valid(self, array_body: List[JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_array_null(self, **kwargs: Any) -> List[List[str]]: + def get_array_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get a null array. :return: list of list of str @@ -3431,15 +4601,21 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_array_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_array_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3457,8 +4633,13 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace - def get_array_empty(self, **kwargs: Any) -> List[List[str]]: + def get_array_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an empty array []. :return: list of list of str @@ -3475,15 +4656,21 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_array_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_array_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3501,8 +4688,13 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace - def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: + def get_array_item_null( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. :return: list of list of str @@ -3519,15 +4711,21 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_array_item_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_array_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3545,8 +4743,13 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace - def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: + def get_array_item_empty( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. :return: list of list of str @@ -3563,15 +4766,21 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_array_item_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_array_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3589,8 +4798,13 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace - def get_array_valid(self, **kwargs: Any) -> List[List[str]]: + def get_array_valid( + self, + **kwargs: Any + ) -> List[List[str]]: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :return: list of list of str @@ -3607,15 +4821,21 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_array_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_array_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3633,8 +4853,14 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: return deserialized + + @distributed_trace - def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: + def put_array_valid( + self, + array_body: List[List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. :param array_body: @@ -3653,11 +4879,13 @@ def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: ] ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3668,7 +4896,9 @@ def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3679,8 +4909,13 @@ def put_array_valid(self, array_body: List[List[str]], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries with value null. :return: list of dict mapping str to str @@ -3697,15 +4932,21 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_dictionary_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_dictionary_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3723,8 +4964,13 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value []. :return: list of dict mapping str to str @@ -3741,15 +4987,21 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_dictionary_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_dictionary_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3767,8 +5019,13 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_item_null( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3786,15 +5043,21 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_dictionary_item_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_dictionary_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3812,8 +5075,13 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3831,15 +5099,21 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_dictionary_item_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_dictionary_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3857,8 +5131,13 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: + def get_dictionary_valid( + self, + **kwargs: Any + ) -> List[Dict[str, str]]: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3876,15 +5155,21 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_dictionary_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_dictionary_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3902,8 +5187,14 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: return deserialized + + @distributed_trace - def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) -> None: + def put_dictionary_valid( + self, + array_body: List[Dict[str, str]], + **kwargs: Any + ) -> None: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3923,11 +5214,13 @@ def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3938,7 +5231,9 @@ def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3948,3 +5243,5 @@ def put_dictionary_valid(self, array_body: List[Dict[str, str]], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py index 877b4dde4a8..f570de0377a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/__init__.py index 04867b878c9..7d6d9918496 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["BinaryWithContentTypeApplicationJson"] +__all__ = ['BinaryWithContentTypeApplicationJson'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_binarywithcontent_typeapplicationjson.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_binarywithcontent_typeapplicationjson.py index 12eed98f140..56d31fe400e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_binarywithcontent_typeapplicationjson.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BinaryWithContentTypeApplicationJson: """Sample for file with json and binary content type. @@ -30,8 +29,13 @@ class BinaryWithContentTypeApplicationJson: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = BinaryWithContentTypeApplicationJsonConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.upload = UploadOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_configuration.py index 72d1f0304aa..d8fce611b6a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): # pylin attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BinaryWithContentTypeApplicationJsonConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "binarywithcontenttypeapplicationjson/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'binarywithcontenttypeapplicationjson/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/__init__.py index a1aa9464094..a5fff7df533 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._binarywithcontent_typeapplicationjson import BinaryWithContentTypeApplicationJson - -__all__ = ["BinaryWithContentTypeApplicationJson"] +__all__ = ['BinaryWithContentTypeApplicationJson'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_binarywithcontent_typeapplicationjson.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_binarywithcontent_typeapplicationjson.py index bb0d0e58aa9..1c2057516f5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_binarywithcontent_typeapplicationjson.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_binarywithcontent_typeapplicationjson.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BinaryWithContentTypeApplicationJson: """Sample for file with json and binary content type. @@ -30,7 +29,12 @@ class BinaryWithContentTypeApplicationJson: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = BinaryWithContentTypeApplicationJsonConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.upload = UploadOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_configuration.py index b3128d7c18b..de97b10fb47 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class BinaryWithContentTypeApplicationJsonConfiguration(Configuration): # pylin attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BinaryWithContentTypeApplicationJsonConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "binarywithcontenttypeapplicationjson/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'binarywithcontenttypeapplicationjson/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/__init__.py index f56c0bc9c26..6c2b17f5e45 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import UploadOperations __all__ = [ - "UploadOperations", + 'UploadOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py index 23eadb213e7..dc7531c8430 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py @@ -8,25 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ...operations._operations import build_upload_binary_request, build_upload_file_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class UploadOperations: """UploadOperations async operations. @@ -46,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: + async def file( + self, + file_param: Union[IO, JSONType], + **kwargs: Any + ) -> None: """Uploading json file. :param file_param: JSON file with payload { "more": "cowbell" }. @@ -55,11 +51,13 @@ async def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = file_param @@ -70,7 +68,9 @@ async def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -81,8 +81,14 @@ async def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def binary(self, file_param: IO, **kwargs: Any) -> None: + async def binary( + self, + file_param: IO, + **kwargs: Any + ) -> None: """Uploading binary file. :param file_param: Non-empty binary file. @@ -91,11 +97,13 @@ async def binary(self, file_param: IO, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_param @@ -106,7 +114,9 @@ async def binary(self, file_param: IO, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -116,3 +126,5 @@ async def binary(self, file_param: IO, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/__init__.py index f56c0bc9c26..6c2b17f5e45 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import UploadOperations __all__ = [ - "UploadOperations", + 'UploadOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py index 14035fd433d..a34437e0942 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py @@ -8,54 +8,67 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_upload_file_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_upload_file_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/binary/file" + url = '/binary/file' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_upload_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_upload_binary_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/binary/octet" + url = '/binary/octet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) class UploadOperations(object): """UploadOperations operations. @@ -76,7 +89,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: + def file( + self, + file_param: Union[IO, JSONType], + **kwargs: Any + ) -> None: """Uploading json file. :param file_param: JSON file with payload { "more": "cowbell" }. @@ -85,11 +102,13 @@ def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = file_param @@ -100,7 +119,9 @@ def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -111,8 +132,14 @@ def file(self, file_param: Union[IO, JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def binary(self, file_param: IO, **kwargs: Any) -> None: + def binary( + self, + file_param: IO, + **kwargs: Any + ) -> None: """Uploading binary file. :param file_param: Non-empty binary file. @@ -121,11 +148,13 @@ def binary(self, file_param: IO, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_param @@ -136,7 +165,9 @@ def binary(self, file_param: IO, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -146,3 +177,5 @@ def binary(self, file_param: IO, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py index 772307d83f9..4a12c367eb1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Sample for file with json and binary content type. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/__init__.py index b7f0064df51..f7824a9f9db 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestBoolTestService"] +__all__ = ['AutoRestBoolTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_auto_rest_bool_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_auto_rest_bool_test_service.py index 9ddbd8f446c..be1e44fbe1d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_auto_rest_bool_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_auto_rest_bool_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestBoolTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestBoolTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestBoolTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.bool = BoolOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_configuration.py index 7b8d0b2d571..a6d2545b010 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestBoolTestServiceConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestBoolTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestbooltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestbooltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/__init__.py index 00f063d07bf..6807a1e64da 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_bool_test_service import AutoRestBoolTestService - -__all__ = ["AutoRestBoolTestService"] +__all__ = ['AutoRestBoolTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_auto_rest_bool_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_auto_rest_bool_test_service.py index ece6c62465a..b8debad90a6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_auto_rest_bool_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_auto_rest_bool_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestBoolTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestBoolTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestBoolTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.bool = BoolOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_configuration.py index fd4d1a40235..8016efed0d0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestBoolTestServiceConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestBoolTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestbooltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestbooltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/__init__.py index 648eb74ecd4..0952051df9f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import BoolOperations __all__ = [ - "BoolOperations", + 'BoolOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py index ca118933840..89153b89c95 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py @@ -8,32 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_bool_get_false_request, - build_bool_get_invalid_request, - build_bool_get_null_request, - build_bool_get_true_request, - build_bool_put_false_request, - build_bool_put_true_request, -) - -T = TypeVar("T") +from ...operations._operations import build_bool_get_false_request, build_bool_get_invalid_request, build_bool_get_null_request, build_bool_get_true_request, build_bool_put_false_request, build_bool_put_true_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class BoolOperations: """BoolOperations async operations. @@ -53,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_true(self, **kwargs: Any) -> bool: + async def get_true( + self, + **kwargs: Any + ) -> bool: """Get true Boolean value. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_true_request() + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_true_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -86,8 +80,13 @@ async def get_true(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace_async - async def put_true(self, **kwargs: Any) -> None: + async def put_true( + self, + **kwargs: Any + ) -> None: """Set Boolean value true. :keyword bool_body: The default value is True. Note that overriding this default value may @@ -97,13 +96,16 @@ async def put_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", True) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', True) # type: bool + request = build_bool_put_true_request( content_type=content_type, json=bool_body, @@ -111,7 +113,9 @@ async def put_true(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -122,23 +126,34 @@ async def put_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_false(self, **kwargs: Any) -> bool: + async def get_false( + self, + **kwargs: Any + ) -> bool: """Get false Boolean value. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_false_request() + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_false_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -156,8 +171,13 @@ async def get_false(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace_async - async def put_false(self, **kwargs: Any) -> None: + async def put_false( + self, + **kwargs: Any + ) -> None: """Set Boolean value false. :keyword bool_body: The default value is False. Note that overriding this default value may @@ -167,13 +187,16 @@ async def put_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", False) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', False) # type: bool + request = build_bool_put_false_request( content_type=content_type, json=bool_body, @@ -181,7 +204,9 @@ async def put_false(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -192,23 +217,34 @@ async def put_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[bool]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[bool]: """Get null Boolean value. :return: bool or None :rtype: bool or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -226,23 +262,34 @@ async def get_null(self, **kwargs: Any) -> Optional[bool]: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> bool: + async def get_invalid( + self, + **kwargs: Any + ) -> bool: """Get invalid Boolean value. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -259,3 +306,5 @@ async def get_invalid(self, **kwargs: Any) -> bool: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/__init__.py index 648eb74ecd4..0952051df9f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import BoolOperations __all__ = [ - "BoolOperations", + 'BoolOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py index 76f3ee86090..84d0388a23b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py @@ -8,108 +8,143 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_bool_get_true_request(**kwargs: Any) -> HttpRequest: +def build_bool_get_true_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/true" + url = '/bool/true' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_bool_put_true_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", True) # type: bool +def build_bool_put_true_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', True) # type: bool accept = "application/json" # Construct URL - url = "/bool/true" + url = '/bool/true' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_bool_get_false_request(**kwargs: Any) -> HttpRequest: +def build_bool_get_false_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/false" + url = '/bool/false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_bool_put_false_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", False) # type: bool +def build_bool_put_false_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', False) # type: bool accept = "application/json" # Construct URL - url = "/bool/false" + url = '/bool/false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_bool_get_null_request(**kwargs: Any) -> HttpRequest: +def build_bool_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/null" + url = '/bool/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_bool_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_bool_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/bool/invalid" + url = '/bool/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class BoolOperations(object): """BoolOperations operations. @@ -130,22 +165,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_true(self, **kwargs: Any) -> bool: + def get_true( + self, + **kwargs: Any + ) -> bool: """Get true Boolean value. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_true_request() + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_true_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -163,8 +207,13 @@ def get_true(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace - def put_true(self, **kwargs: Any) -> None: + def put_true( + self, + **kwargs: Any + ) -> None: """Set Boolean value true. :keyword bool_body: The default value is True. Note that overriding this default value may @@ -174,13 +223,16 @@ def put_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", True) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', True) # type: bool + request = build_bool_put_true_request( content_type=content_type, json=bool_body, @@ -188,7 +240,9 @@ def put_true(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -199,23 +253,34 @@ def put_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_false(self, **kwargs: Any) -> bool: + def get_false( + self, + **kwargs: Any + ) -> bool: """Get false Boolean value. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_false_request() + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_false_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -233,8 +298,13 @@ def get_false(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace - def put_false(self, **kwargs: Any) -> None: + def put_false( + self, + **kwargs: Any + ) -> None: """Set Boolean value false. :keyword bool_body: The default value is False. Note that overriding this default value may @@ -244,13 +314,16 @@ def put_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - bool_body = kwargs.pop("bool_body", False) # type: bool + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + bool_body = kwargs.pop('bool_body', False) # type: bool + request = build_bool_put_false_request( content_type=content_type, json=bool_body, @@ -258,7 +331,9 @@ def put_false(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -269,23 +344,34 @@ def put_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[bool]: + def get_null( + self, + **kwargs: Any + ) -> Optional[bool]: """Get null Boolean value. :return: bool or None :rtype: bool or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -303,23 +389,34 @@ def get_null(self, **kwargs: Any) -> Optional[bool]: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> bool: + def get_invalid( + self, + **kwargs: Any + ) -> bool: """Get invalid Boolean value. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_bool_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_bool_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -336,3 +433,5 @@ def get_invalid(self, **kwargs: Any) -> bool: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py index 374eaef7983..ebc098fd1cc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/__init__.py index c8aff8de0a0..910d784dc9b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATByteService"] +__all__ = ['AutoRestSwaggerBATByteService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_auto_rest_swagger_bat_byte_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_auto_rest_swagger_bat_byte_service.py index 0538dfa59d4..7f424e1e8ab 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_auto_rest_swagger_bat_byte_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_auto_rest_swagger_bat_byte_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATByteService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,8 +29,13 @@ class AutoRestSwaggerBATByteService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATByteServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.byte = ByteOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_configuration.py index 94dface9e51..2651a976ad8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATByteServiceConfiguration(Configuration): # pylint: disa attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATByteServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatbyteservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatbyteservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/__init__.py index 6ee1bab4379..073b055af7f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_byte_service import AutoRestSwaggerBATByteService - -__all__ = ["AutoRestSwaggerBATByteService"] +__all__ = ['AutoRestSwaggerBATByteService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_auto_rest_swagger_bat_byte_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_auto_rest_swagger_bat_byte_service.py index 04f2b27f8a9..6ce166d1483 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_auto_rest_swagger_bat_byte_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_auto_rest_swagger_bat_byte_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATByteService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,7 +29,12 @@ class AutoRestSwaggerBATByteService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATByteServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.byte = ByteOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_configuration.py index 5d92724f30f..b1345d6f694 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATByteServiceConfiguration(Configuration): # pylint: disa attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATByteServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatbyteservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatbyteservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/__init__.py index 93edb8fec88..681d1db282a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ByteOperations __all__ = [ - "ByteOperations", + 'ByteOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py index 11331f01bac..72134a9ed87 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py @@ -8,31 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_byte_get_empty_request, - build_byte_get_invalid_request, - build_byte_get_non_ascii_request, - build_byte_get_null_request, - build_byte_put_non_ascii_request, -) - -T = TypeVar("T") +from ...operations._operations import build_byte_get_empty_request, build_byte_get_invalid_request, build_byte_get_non_ascii_request, build_byte_get_null_request, build_byte_put_non_ascii_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ByteOperations: """ByteOperations async operations. @@ -52,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> bytearray: + async def get_null( + self, + **kwargs: Any + ) -> bytearray: """Get null byte value. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -85,23 +80,34 @@ async def get_null(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> bytearray: + async def get_empty( + self, + **kwargs: Any + ) -> bytearray: """Get empty byte value ''. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -119,23 +125,34 @@ async def get_empty(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace_async - async def get_non_ascii(self, **kwargs: Any) -> bytearray: + async def get_non_ascii( + self, + **kwargs: Any + ) -> bytearray: """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_non_ascii_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_non_ascii_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -153,8 +170,14 @@ async def get_non_ascii(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace_async - async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: + async def put_non_ascii( + self, + byte_body: bytearray, + **kwargs: Any + ) -> None: """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :param byte_body: Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). @@ -163,11 +186,13 @@ async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = byte_body @@ -178,7 +203,9 @@ async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -189,23 +216,34 @@ async def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> bytearray: + async def get_invalid( + self, + **kwargs: Any + ) -> bytearray: """Get invalid byte value ':::SWAGGER::::'. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -222,3 +260,5 @@ async def get_invalid(self, **kwargs: Any) -> bytearray: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/__init__.py index 93edb8fec88..681d1db282a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ByteOperations __all__ = [ - "ByteOperations", + 'ByteOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py index 6504d7bc286..c5cac4e8401 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py @@ -8,90 +8,121 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_byte_get_null_request(**kwargs: Any) -> HttpRequest: +def build_byte_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/null" + url = '/byte/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_byte_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_byte_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/empty" + url = '/byte/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_byte_get_non_ascii_request(**kwargs: Any) -> HttpRequest: +def build_byte_get_non_ascii_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/nonAscii" + url = '/byte/nonAscii' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_byte_put_non_ascii_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_byte_put_non_ascii_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/byte/nonAscii" + url = '/byte/nonAscii' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_byte_get_invalid_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_byte_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/byte/invalid" + url = '/byte/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class ByteOperations(object): """ByteOperations operations. @@ -112,22 +143,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> bytearray: + def get_null( + self, + **kwargs: Any + ) -> bytearray: """Get null byte value. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -145,23 +185,34 @@ def get_null(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace - def get_empty(self, **kwargs: Any) -> bytearray: + def get_empty( + self, + **kwargs: Any + ) -> bytearray: """Get empty byte value ''. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -179,23 +230,34 @@ def get_empty(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace - def get_non_ascii(self, **kwargs: Any) -> bytearray: + def get_non_ascii( + self, + **kwargs: Any + ) -> bytearray: """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_non_ascii_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_non_ascii_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -213,8 +275,14 @@ def get_non_ascii(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace - def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: + def put_non_ascii( + self, + byte_body: bytearray, + **kwargs: Any + ) -> None: """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). :param byte_body: Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). @@ -223,11 +291,13 @@ def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = byte_body @@ -238,7 +308,9 @@ def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -249,23 +321,34 @@ def put_non_ascii(self, byte_body: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> bytearray: + def get_invalid( + self, + **kwargs: Any + ) -> bytearray: """Get invalid byte value ':::SWAGGER::::'. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_byte_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_byte_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -282,3 +365,5 @@ def get_invalid(self, **kwargs: Any) -> bytearray: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py index 158f73d896a..84a5162110e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/__init__.py index fd3f96ec0e5..f0dfc13a72f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_auto_rest_complex_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_auto_rest_complex_test_service.py index d858384fc94..9546d3e1827 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_auto_rest_complex_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_auto_rest_complex_test_service.py @@ -14,24 +14,13 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Dict - -class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes +class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -59,8 +48,13 @@ class AutoRestComplexTestService: # pylint: disable=too-many-instance-attribute :paramtype api_version: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -73,14 +67,11 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_configuration.py index 43d426d02cb..53dbd1d6018 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/_configuration.py @@ -25,24 +25,29 @@ class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "bodycomplexpython3only/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodycomplexpython3only/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/__init__.py index 4c5493d4555..a5cab1e6f99 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_complex_test_service import AutoRestComplexTestService - -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py index 30630b45cb8..05c942b9b87 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py @@ -14,24 +14,13 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Dict - -class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes +class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -60,7 +49,12 @@ class AutoRestComplexTestService: # pylint: disable=too-many-instance-attribute :paramtype api_version: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -73,15 +67,16 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_configuration.py index 7af266a2c1b..93fb380cc81 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/_configuration.py @@ -25,21 +25,28 @@ class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "bodycomplexpython3only/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodycomplexpython3only/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/__init__.py index c805dd491a3..80697c6640b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/__init__.py @@ -17,13 +17,13 @@ from ._operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py index 282d274030b..1b12554747f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/aio/operations/_operations.py @@ -8,81 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_array_get_empty_request, - build_array_get_not_provided_request, - build_array_get_valid_request, - build_array_put_empty_request, - build_array_put_valid_request, - build_basic_get_empty_request, - build_basic_get_invalid_request, - build_basic_get_not_provided_request, - build_basic_get_null_request, - build_basic_get_valid_request, - build_basic_put_valid_request, - build_dictionary_get_empty_request, - build_dictionary_get_not_provided_request, - build_dictionary_get_null_request, - build_dictionary_get_valid_request, - build_dictionary_put_empty_request, - build_dictionary_put_valid_request, - build_flattencomplex_get_valid_request, - build_inheritance_get_valid_request, - build_inheritance_put_valid_request, - build_polymorphicrecursive_get_valid_request, - build_polymorphicrecursive_put_valid_request, - build_polymorphism_get_complicated_request, - build_polymorphism_get_composed_with_discriminator_request, - build_polymorphism_get_composed_without_discriminator_request, - build_polymorphism_get_dot_syntax_request, - build_polymorphism_get_valid_request, - build_polymorphism_put_complicated_request, - build_polymorphism_put_missing_discriminator_request, - build_polymorphism_put_valid_missing_required_request, - build_polymorphism_put_valid_request, - build_primitive_get_bool_request, - build_primitive_get_byte_request, - build_primitive_get_date_request, - build_primitive_get_date_time_request, - build_primitive_get_date_time_rfc1123_request, - build_primitive_get_double_request, - build_primitive_get_duration_request, - build_primitive_get_float_request, - build_primitive_get_int_request, - build_primitive_get_long_request, - build_primitive_get_string_request, - build_primitive_put_bool_request, - build_primitive_put_byte_request, - build_primitive_put_date_request, - build_primitive_put_date_time_request, - build_primitive_put_date_time_rfc1123_request, - build_primitive_put_double_request, - build_primitive_put_duration_request, - build_primitive_put_float_request, - build_primitive_put_int_request, - build_primitive_put_long_request, - build_primitive_put_string_request, - build_readonlyproperty_get_valid_request, - build_readonlyproperty_put_valid_request, -) - -T = TypeVar("T") +from ...operations._operations import build_array_get_empty_request, build_array_get_not_provided_request, build_array_get_valid_request, build_array_put_empty_request, build_array_put_valid_request, build_basic_get_empty_request, build_basic_get_invalid_request, build_basic_get_not_provided_request, build_basic_get_null_request, build_basic_get_valid_request, build_basic_put_valid_request, build_dictionary_get_empty_request, build_dictionary_get_not_provided_request, build_dictionary_get_null_request, build_dictionary_get_valid_request, build_dictionary_put_empty_request, build_dictionary_put_valid_request, build_flattencomplex_get_valid_request, build_inheritance_get_valid_request, build_inheritance_put_valid_request, build_polymorphicrecursive_get_valid_request, build_polymorphicrecursive_put_valid_request, build_polymorphism_get_complicated_request, build_polymorphism_get_composed_with_discriminator_request, build_polymorphism_get_composed_without_discriminator_request, build_polymorphism_get_dot_syntax_request, build_polymorphism_get_valid_request, build_polymorphism_put_complicated_request, build_polymorphism_put_missing_discriminator_request, build_polymorphism_put_valid_missing_required_request, build_polymorphism_put_valid_request, build_primitive_get_bool_request, build_primitive_get_byte_request, build_primitive_get_date_request, build_primitive_get_date_time_request, build_primitive_get_date_time_rfc1123_request, build_primitive_get_double_request, build_primitive_get_duration_request, build_primitive_get_float_request, build_primitive_get_int_request, build_primitive_get_long_request, build_primitive_get_string_request, build_primitive_put_bool_request, build_primitive_put_byte_request, build_primitive_put_date_request, build_primitive_put_date_time_request, build_primitive_put_date_time_rfc1123_request, build_primitive_put_double_request, build_primitive_put_duration_request, build_primitive_put_float_request, build_primitive_put_int_request, build_primitive_put_long_request, build_primitive_put_string_request, build_readonlyproperty_get_valid_request, build_readonlyproperty_put_valid_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class BasicOperations: """BasicOperations async operations. @@ -102,7 +38,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object @@ -121,15 +60,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_valid_request() + + request = build_basic_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -147,8 +92,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. @@ -169,12 +120,14 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -186,7 +139,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -197,8 +152,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> JSONType: + async def get_invalid( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is invalid for the local strong type. :return: JSON object @@ -217,15 +177,21 @@ async def get_invalid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_invalid_request() + + request = build_basic_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -243,8 +209,13 @@ async def get_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> JSONType: + async def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is empty. :return: JSON object @@ -263,15 +234,21 @@ async def get_empty(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_empty_request() + + request = build_basic_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -289,8 +266,13 @@ async def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> JSONType: + async def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type whose properties are null. :return: JSON object @@ -309,15 +291,21 @@ async def get_null(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_null_request() + + request = build_basic_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -335,8 +323,13 @@ async def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> JSONType: + async def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object @@ -355,15 +348,21 @@ async def get_not_provided(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_not_provided_request() + + request = build_basic_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -401,7 +400,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_int(self, **kwargs: Any) -> JSONType: + async def get_int( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with integer properties. :return: JSON object @@ -417,15 +419,21 @@ async def get_int(self, **kwargs: Any) -> JSONType: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_int_request() + + request = build_primitive_get_int_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -443,8 +451,14 @@ async def get_int(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_int( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. @@ -462,11 +476,13 @@ async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -477,7 +493,9 @@ async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -488,8 +506,13 @@ async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_long(self, **kwargs: Any) -> JSONType: + async def get_long( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with long properties. :return: JSON object @@ -505,15 +528,21 @@ async def get_long(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_long_request() + + request = build_primitive_get_long_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -531,8 +560,14 @@ async def get_long(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_long( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. @@ -550,11 +585,13 @@ async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -565,7 +602,9 @@ async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -576,8 +615,13 @@ async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_float(self, **kwargs: Any) -> JSONType: + async def get_float( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with float properties. :return: JSON object @@ -593,15 +637,21 @@ async def get_float(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_float_request() + + request = build_primitive_get_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -619,8 +669,14 @@ async def get_float(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_float( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. @@ -638,11 +694,13 @@ async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -653,7 +711,9 @@ async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -664,8 +724,13 @@ async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_double(self, **kwargs: Any) -> JSONType: + async def get_double( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with double properties. :return: JSON object @@ -682,15 +747,21 @@ async def get_double(self, **kwargs: Any) -> JSONType: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_double_request() + + request = build_primitive_get_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -708,8 +779,14 @@ async def get_double(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_double( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and @@ -729,11 +806,13 @@ async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -744,7 +823,9 @@ async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -755,8 +836,13 @@ async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_bool(self, **kwargs: Any) -> JSONType: + async def get_bool( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with bool properties. :return: JSON object @@ -772,15 +858,21 @@ async def get_bool(self, **kwargs: Any) -> JSONType: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_bool_request() + + request = build_primitive_get_bool_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -798,8 +890,14 @@ async def get_bool(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_bool( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. @@ -817,11 +915,13 @@ async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -832,7 +932,9 @@ async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -843,8 +945,13 @@ async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_string(self, **kwargs: Any) -> JSONType: + async def get_string( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with string properties. :return: JSON object @@ -861,15 +968,21 @@ async def get_string(self, **kwargs: Any) -> JSONType: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_string_request() + + request = build_primitive_get_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -887,8 +1000,14 @@ async def get_string(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_string( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. @@ -907,11 +1026,13 @@ async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -922,7 +1043,9 @@ async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -933,8 +1056,13 @@ async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date(self, **kwargs: Any) -> JSONType: + async def get_date( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with date properties. :return: JSON object @@ -950,15 +1078,21 @@ async def get_date(self, **kwargs: Any) -> JSONType: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_date_request() + + request = build_primitive_get_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -976,8 +1110,14 @@ async def get_date(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_date( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. @@ -995,11 +1135,13 @@ async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1010,7 +1152,9 @@ async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1021,8 +1165,13 @@ async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_time(self, **kwargs: Any) -> JSONType: + async def get_date_time( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetime properties. :return: JSON object @@ -1038,15 +1187,21 @@ async def get_date_time(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_date_time_request() + + request = build_primitive_get_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1064,8 +1219,14 @@ async def get_date_time(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_date_time( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -1083,11 +1244,13 @@ async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1098,7 +1261,9 @@ async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1109,8 +1274,13 @@ async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: + async def get_date_time_rfc1123( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetimeRfc1123 properties. :return: JSON object @@ -1126,15 +1296,21 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_date_time_rfc1123_request() + + request = build_primitive_get_date_time_rfc1123_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1152,8 +1328,14 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_date_time_rfc1123( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 @@ -1172,11 +1354,13 @@ async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1187,7 +1371,9 @@ async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1198,8 +1384,13 @@ async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_duration(self, **kwargs: Any) -> JSONType: + async def get_duration( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with duration properties. :return: JSON object @@ -1214,15 +1405,21 @@ async def get_duration(self, **kwargs: Any) -> JSONType: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_duration_request() + + request = build_primitive_get_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1240,8 +1437,14 @@ async def get_duration(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_duration( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. @@ -1258,11 +1461,13 @@ async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1273,7 +1478,9 @@ async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1284,8 +1491,13 @@ async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_byte(self, **kwargs: Any) -> JSONType: + async def get_byte( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with byte properties. :return: JSON object @@ -1300,15 +1512,21 @@ async def get_byte(self, **kwargs: Any) -> JSONType: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_byte_request() + + request = build_primitive_get_byte_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1326,8 +1544,14 @@ async def get_byte(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_byte( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). @@ -1344,11 +1568,13 @@ async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1359,7 +1585,9 @@ async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1390,7 +1618,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property. :return: JSON object @@ -1407,15 +1638,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_valid_request() + + request = build_array_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1433,8 +1670,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property. :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The @@ -1454,11 +1697,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1469,7 +1714,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1480,8 +1727,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> JSONType: + async def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property which is empty. :return: JSON object @@ -1498,15 +1750,21 @@ async def get_empty(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_empty_request() + + request = build_array_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1524,8 +1782,14 @@ async def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property which is empty. :param complex_body: Please put an empty array. @@ -1544,11 +1808,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1559,7 +1825,9 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1570,8 +1838,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> JSONType: + async def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property while server doesn't provide a response payload. :return: JSON object @@ -1588,15 +1861,21 @@ async def get_not_provided(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_not_provided_request() + + request = build_array_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1634,7 +1913,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property. :return: JSON object @@ -1651,15 +1933,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_valid_request() + + request = build_dictionary_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1677,8 +1965,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property. :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", @@ -1698,11 +1992,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1713,7 +2009,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1724,8 +2022,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> JSONType: + async def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is empty. :return: JSON object @@ -1742,15 +2045,21 @@ async def get_empty(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_empty_request() + + request = build_dictionary_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1768,8 +2077,14 @@ async def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. @@ -1788,11 +2103,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1803,7 +2120,9 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1814,8 +2133,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> JSONType: + async def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is null. :return: JSON object @@ -1832,15 +2156,21 @@ async def get_null(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_null_request() + + request = build_dictionary_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1858,8 +2188,13 @@ async def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> JSONType: + async def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object @@ -1876,15 +2211,21 @@ async def get_not_provided(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_not_provided_request() + + request = build_dictionary_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1922,7 +2263,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that extend others. :return: JSON object @@ -1947,15 +2291,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_inheritance_get_valid_request() + + request = build_inheritance_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1973,8 +2323,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, @@ -2003,11 +2359,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2018,7 +2376,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2049,7 +2409,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic. :return: JSON object @@ -2069,15 +2432,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_valid_request() + + request = build_polymorphism_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2095,8 +2464,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -2152,11 +2527,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2167,7 +2544,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2178,8 +2557,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_dot_syntax(self, **kwargs: Any) -> JSONType: + async def get_dot_syntax( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object @@ -2195,15 +2579,21 @@ async def get_dot_syntax(self, **kwargs: Any) -> JSONType: fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_dot_syntax_request() + + request = build_polymorphism_get_dot_syntax_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2221,8 +2611,13 @@ async def get_dot_syntax(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: + async def get_composed_with_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -2262,15 +2657,21 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_composed_with_discriminator_request() + + request = build_polymorphism_get_composed_with_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2288,8 +2689,13 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: + async def get_composed_without_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -2329,15 +2735,21 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_composed_without_discriminator_request() + + request = build_polymorphism_get_composed_without_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2355,8 +2767,13 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_complicated(self, **kwargs: Any) -> JSONType: + async def get_complicated( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -2386,15 +2803,21 @@ async def get_complicated(self, **kwargs: Any) -> JSONType: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_complicated_request() + + request = build_polymorphism_get_complicated_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2412,8 +2835,14 @@ async def get_complicated(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_complicated( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -2447,11 +2876,13 @@ async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2462,7 +2893,9 @@ async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2473,8 +2906,14 @@ async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JSONType: + async def put_missing_discriminator( + self, + complex_body: JSONType, + **kwargs: Any + ) -> JSONType: """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: @@ -2526,11 +2965,13 @@ async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2541,7 +2982,9 @@ async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2559,8 +3002,14 @@ async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) return deserialized + + @distributed_trace_async - async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid_missing_required( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -2611,11 +3060,13 @@ async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2626,7 +3077,9 @@ async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2657,7 +3110,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic and have recursive references. :return: JSON object @@ -2677,15 +3133,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphicrecursive_get_valid_request() + + request = build_polymorphicrecursive_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2703,8 +3165,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -2780,11 +3248,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2795,7 +3265,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2826,7 +3298,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that have readonly properties. :return: JSON object @@ -2842,15 +3317,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_readonlyproperty_get_valid_request() + + request = build_readonlyproperty_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2868,8 +3349,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that have readonly properties. :param complex_body: @@ -2887,11 +3374,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2902,7 +3391,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2933,7 +3424,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """get_valid. :return: JSON object @@ -2952,15 +3446,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_flattencomplex_get_valid_request() + + request = build_flattencomplex_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2977,3 +3477,5 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/__init__.py index c805dd491a3..80697c6640b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/__init__.py @@ -17,13 +17,13 @@ from ._operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations.py index f6ee7029b3f..6b9a224c887 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/bodycomplexpython3only/operations/_operations.py @@ -8,797 +8,1275 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_basic_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/valid" + url = '/complex/basic/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_basic_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/basic/valid" + url = '/complex/basic/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) -def build_basic_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/invalid" + url = '/complex/basic/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/empty" + url = '/complex/basic/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_get_null_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/null" + url = '/complex/basic/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/notprovided" + url = '/complex/basic/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_get_int_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_int_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/integer" + url = '/complex/primitive/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_int_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_int_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/integer" + url = '/complex/primitive/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_long_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_long_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/long" + url = '/complex/primitive/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_long_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_long_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/long" + url = '/complex/primitive/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_float_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_float_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/float" + url = '/complex/primitive/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/float" + url = '/complex/primitive/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_double_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_double_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/double" + url = '/complex/primitive/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/double" + url = '/complex/primitive/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_bool_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_bool_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/bool" + url = '/complex/primitive/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_bool_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_bool_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/bool" + url = '/complex/primitive/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_string_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/string" + url = '/complex/primitive/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/string" + url = '/complex/primitive/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_date_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/date" + url = '/complex/primitive/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/date" + url = '/complex/primitive/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_date_time_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/datetime" + url = '/complex/primitive/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/datetime" + url = '/complex/primitive/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_date_time_rfc1123_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/datetimerfc1123" + url = '/complex/primitive/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_primitive_put_date_time_rfc1123_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/datetimerfc1123" + url = '/complex/primitive/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_duration_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_duration_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/duration" + url = '/complex/primitive/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_duration_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/duration" + url = '/complex/primitive/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_byte_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_byte_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/byte" + url = '/complex/primitive/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_byte_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_byte_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/byte" + url = '/complex/primitive/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/valid" + url = '/complex/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/array/valid" + url = '/complex/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/empty" + url = '/complex/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/array/empty" + url = '/complex/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_array_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/notprovided" + url = '/complex/array/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/valid" + url = '/complex/dictionary/typed/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_dictionary_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/valid" + url = '/complex/dictionary/typed/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/empty" + url = '/complex/dictionary/typed/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_dictionary_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/empty" + url = '/complex/dictionary/typed/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/null" + url = '/complex/dictionary/typed/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/notprovided" + url = '/complex/dictionary/typed/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_inheritance_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_inheritance_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/inheritance/valid" + url = '/complex/inheritance/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_inheritance_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_inheritance_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/inheritance/valid" + url = '/complex/inheritance/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_polymorphism_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/valid" + url = '/complex/polymorphism/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_polymorphism_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/valid" + url = '/complex/polymorphism/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_polymorphism_get_dot_syntax_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_dot_syntax_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/dotsyntax" + url = '/complex/polymorphism/dotsyntax' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_get_composed_with_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_composed_with_discriminator_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/composedWithDiscriminator" + url = '/complex/polymorphism/composedWithDiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_get_composed_without_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_composed_without_discriminator_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/composedWithoutDiscriminator" + url = '/complex/polymorphism/composedWithoutDiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_get_complicated_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_complicated_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/complicated" + url = '/complex/polymorphism/complicated' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_polymorphism_put_complicated_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/complicated" + url = '/complex/polymorphism/complicated' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_polymorphism_put_missing_discriminator_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/missingdiscriminator" + url = '/complex/polymorphism/missingdiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_polymorphism_put_valid_missing_required_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/missingrequired/invalid" + url = '/complex/polymorphism/missingrequired/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_polymorphicrecursive_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_polymorphicrecursive_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphicrecursive/valid" + url = '/complex/polymorphicrecursive/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_polymorphicrecursive_put_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphicrecursive/valid" + url = '/complex/polymorphicrecursive/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_readonlyproperty_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_readonlyproperty_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/readonlyproperty/valid" + url = '/complex/readonlyproperty/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_readonlyproperty_put_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/readonlyproperty/valid" + url = '/complex/readonlyproperty/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_flattencomplex_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_flattencomplex_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/flatten/valid" + url = '/complex/flatten/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class BasicOperations(object): """BasicOperations operations. @@ -819,7 +1297,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object @@ -838,15 +1319,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -864,8 +1351,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. @@ -886,12 +1379,14 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -903,7 +1398,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -914,8 +1411,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> JSONType: + def get_invalid( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is invalid for the local strong type. :return: JSON object @@ -934,15 +1436,21 @@ def get_invalid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -960,8 +1468,13 @@ def get_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_empty(self, **kwargs: Any) -> JSONType: + def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is empty. :return: JSON object @@ -980,15 +1493,21 @@ def get_empty(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1006,8 +1525,13 @@ def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_null(self, **kwargs: Any) -> JSONType: + def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type whose properties are null. :return: JSON object @@ -1026,15 +1550,21 @@ def get_null(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1052,8 +1582,13 @@ def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> JSONType: + def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object @@ -1072,15 +1607,21 @@ def get_not_provided(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1118,7 +1659,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_int(self, **kwargs: Any) -> JSONType: + def get_int( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with integer properties. :return: JSON object @@ -1134,15 +1678,21 @@ def get_int(self, **kwargs: Any) -> JSONType: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_int_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_int_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1160,8 +1710,14 @@ def get_int(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_int( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. @@ -1179,11 +1735,13 @@ def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1194,7 +1752,9 @@ def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1205,8 +1765,13 @@ def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_long(self, **kwargs: Any) -> JSONType: + def get_long( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with long properties. :return: JSON object @@ -1222,15 +1787,21 @@ def get_long(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_long_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_long_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1248,8 +1819,14 @@ def get_long(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_long( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. @@ -1267,11 +1844,13 @@ def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1282,7 +1861,9 @@ def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1293,8 +1874,13 @@ def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_float(self, **kwargs: Any) -> JSONType: + def get_float( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with float properties. :return: JSON object @@ -1310,15 +1896,21 @@ def get_float(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1336,8 +1928,14 @@ def get_float(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_float( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. @@ -1355,11 +1953,13 @@ def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1370,7 +1970,9 @@ def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1381,8 +1983,13 @@ def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_double(self, **kwargs: Any) -> JSONType: + def get_double( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with double properties. :return: JSON object @@ -1399,15 +2006,21 @@ def get_double(self, **kwargs: Any) -> JSONType: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1425,8 +2038,14 @@ def get_double(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_double( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and @@ -1446,11 +2065,13 @@ def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1461,7 +2082,9 @@ def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1472,8 +2095,13 @@ def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_bool(self, **kwargs: Any) -> JSONType: + def get_bool( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with bool properties. :return: JSON object @@ -1489,15 +2117,21 @@ def get_bool(self, **kwargs: Any) -> JSONType: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_bool_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_bool_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1515,8 +2149,14 @@ def get_bool(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_bool( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. @@ -1534,11 +2174,13 @@ def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1549,7 +2191,9 @@ def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1560,8 +2204,13 @@ def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_string(self, **kwargs: Any) -> JSONType: + def get_string( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with string properties. :return: JSON object @@ -1578,15 +2227,21 @@ def get_string(self, **kwargs: Any) -> JSONType: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1604,8 +2259,14 @@ def get_string(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_string( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. @@ -1624,11 +2285,13 @@ def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1639,7 +2302,9 @@ def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1650,8 +2315,13 @@ def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date(self, **kwargs: Any) -> JSONType: + def get_date( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with date properties. :return: JSON object @@ -1667,15 +2337,21 @@ def get_date(self, **kwargs: Any) -> JSONType: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1693,8 +2369,14 @@ def get_date(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_date( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. @@ -1712,11 +2394,13 @@ def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1727,7 +2411,9 @@ def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1738,8 +2424,13 @@ def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_time(self, **kwargs: Any) -> JSONType: + def get_date_time( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetime properties. :return: JSON object @@ -1755,15 +2446,21 @@ def get_date_time(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1781,8 +2478,14 @@ def get_date_time(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_date_time( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -1800,11 +2503,13 @@ def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1815,7 +2520,9 @@ def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1826,8 +2533,13 @@ def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: + def get_date_time_rfc1123( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetimeRfc1123 properties. :return: JSON object @@ -1843,15 +2555,21 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_date_time_rfc1123_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_date_time_rfc1123_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1869,8 +2587,14 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_date_time_rfc1123( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 @@ -1889,11 +2613,13 @@ def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1904,7 +2630,9 @@ def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1915,8 +2643,13 @@ def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_duration(self, **kwargs: Any) -> JSONType: + def get_duration( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with duration properties. :return: JSON object @@ -1931,15 +2664,21 @@ def get_duration(self, **kwargs: Any) -> JSONType: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_duration_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1957,8 +2696,14 @@ def get_duration(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_duration( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. @@ -1975,11 +2720,13 @@ def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1990,7 +2737,9 @@ def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2001,8 +2750,13 @@ def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_byte(self, **kwargs: Any) -> JSONType: + def get_byte( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with byte properties. :return: JSON object @@ -2017,15 +2771,21 @@ def get_byte(self, **kwargs: Any) -> JSONType: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_byte_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_byte_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2043,8 +2803,14 @@ def get_byte(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_byte( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). @@ -2061,11 +2827,13 @@ def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2076,7 +2844,9 @@ def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2107,7 +2877,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property. :return: JSON object @@ -2124,15 +2897,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2150,8 +2929,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property. :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The @@ -2171,11 +2956,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2186,7 +2973,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2197,8 +2986,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty(self, **kwargs: Any) -> JSONType: + def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property which is empty. :return: JSON object @@ -2215,15 +3009,21 @@ def get_empty(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2241,8 +3041,14 @@ def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property which is empty. :param complex_body: Please put an empty array. @@ -2261,11 +3067,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2276,7 +3084,9 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2287,8 +3097,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> JSONType: + def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property while server doesn't provide a response payload. :return: JSON object @@ -2305,15 +3120,21 @@ def get_not_provided(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2351,7 +3172,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property. :return: JSON object @@ -2368,15 +3192,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2394,8 +3224,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property. :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", @@ -2415,11 +3251,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2430,7 +3268,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2441,8 +3281,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty(self, **kwargs: Any) -> JSONType: + def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is empty. :return: JSON object @@ -2459,15 +3304,21 @@ def get_empty(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2485,8 +3336,14 @@ def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. @@ -2505,11 +3362,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2520,7 +3379,9 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2531,8 +3392,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_null(self, **kwargs: Any) -> JSONType: + def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is null. :return: JSON object @@ -2549,15 +3415,21 @@ def get_null(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2575,8 +3447,13 @@ def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> JSONType: + def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object @@ -2593,15 +3470,21 @@ def get_not_provided(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2639,7 +3522,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that extend others. :return: JSON object @@ -2664,15 +3550,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_inheritance_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_inheritance_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2690,8 +3582,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, @@ -2720,11 +3618,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2735,7 +3635,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2766,7 +3668,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic. :return: JSON object @@ -2786,15 +3691,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2812,8 +3723,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -2869,11 +3786,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2884,7 +3803,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2895,8 +3816,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_dot_syntax(self, **kwargs: Any) -> JSONType: + def get_dot_syntax( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object @@ -2912,15 +3838,21 @@ def get_dot_syntax(self, **kwargs: Any) -> JSONType: fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_dot_syntax_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_dot_syntax_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2938,8 +3870,13 @@ def get_dot_syntax(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: + def get_composed_with_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -2979,15 +3916,21 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_composed_with_discriminator_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_composed_with_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3005,8 +3948,13 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: + def get_composed_without_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -3046,15 +3994,21 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_composed_without_discriminator_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_composed_without_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3072,8 +4026,13 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_complicated(self, **kwargs: Any) -> JSONType: + def get_complicated( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -3103,15 +4062,21 @@ def get_complicated(self, **kwargs: Any) -> JSONType: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_complicated_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_complicated_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3129,8 +4094,14 @@ def get_complicated(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_complicated( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -3164,11 +4135,13 @@ def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3179,7 +4152,9 @@ def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3190,8 +4165,14 @@ def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JSONType: + def put_missing_discriminator( + self, + complex_body: JSONType, + **kwargs: Any + ) -> JSONType: """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: @@ -3243,11 +4224,13 @@ def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JS fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3258,7 +4241,9 @@ def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JS request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3276,8 +4261,14 @@ def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JS return deserialized + + @distributed_trace - def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid_missing_required( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -3328,11 +4319,13 @@ def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> N fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3343,7 +4336,9 @@ def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3374,7 +4369,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic and have recursive references. :return: JSON object @@ -3394,15 +4392,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphicrecursive_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphicrecursive_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3420,8 +4424,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -3497,11 +4507,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3512,7 +4524,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3543,7 +4557,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that have readonly properties. :return: JSON object @@ -3559,15 +4576,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_readonlyproperty_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_readonlyproperty_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3585,8 +4608,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that have readonly properties. :param complex_body: @@ -3604,11 +4633,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3619,7 +4650,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3650,7 +4683,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """get_valid. :return: JSON object @@ -3669,15 +4705,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_flattencomplex_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_flattencomplex_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3694,3 +4736,5 @@ def get_valid(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/setup.py index a7ccffb7a49..1d93a53c7c4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexPythonThreeOnlyVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/__init__.py index fd3f96ec0e5..f0dfc13a72f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_auto_rest_complex_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_auto_rest_complex_test_service.py index 041b90f8c7b..eaf959dc396 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_auto_rest_complex_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_auto_rest_complex_test_service.py @@ -14,24 +14,13 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Dict - -class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes +class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -60,8 +49,13 @@ class AutoRestComplexTestService: # pylint: disable=too-many-instance-attribute :paramtype api_version: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -73,14 +67,11 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_configuration.py index 58cfca13cb2..7ce1124a731 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_configuration.py @@ -25,24 +25,29 @@ class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestcomplextestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestcomplextestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/__init__.py index 4c5493d4555..a5cab1e6f99 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_complex_test_service import AutoRestComplexTestService - -__all__ = ["AutoRestComplexTestService"] +__all__ = ['AutoRestComplexTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_auto_rest_complex_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_auto_rest_complex_test_service.py index a4be7490978..bcf6be0bb83 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_auto_rest_complex_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_auto_rest_complex_test_service.py @@ -14,24 +14,13 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) +from .operations import ArrayOperations, BasicOperations, DictionaryOperations, FlattencomplexOperations, InheritanceOperations, PolymorphicrecursiveOperations, PolymorphismOperations, PrimitiveOperations, ReadonlypropertyOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Dict - -class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes +class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar basic: BasicOperations operations @@ -60,7 +49,12 @@ class AutoRestComplexTestService: # pylint: disable=too-many-instance-attribute :paramtype api_version: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -72,15 +66,16 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.polymorphicrecursive = PolymorphicrecursiveOperations(self._client, self._config, self._serialize, self._deserialize) + self.readonlyproperty = ReadonlypropertyOperations(self._client, self._config, self._serialize, self._deserialize) self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_configuration.py index f056703e66f..e968e56c41a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_configuration.py @@ -25,21 +25,28 @@ class AutoRestComplexTestServiceConfiguration(Configuration): # pylint: disable :paramtype api_version: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestComplexTestServiceConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestcomplextestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestcomplextestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/__init__.py index c805dd491a3..80697c6640b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/__init__.py @@ -17,13 +17,13 @@ from ._operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py index 282d274030b..1b12554747f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py @@ -8,81 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_array_get_empty_request, - build_array_get_not_provided_request, - build_array_get_valid_request, - build_array_put_empty_request, - build_array_put_valid_request, - build_basic_get_empty_request, - build_basic_get_invalid_request, - build_basic_get_not_provided_request, - build_basic_get_null_request, - build_basic_get_valid_request, - build_basic_put_valid_request, - build_dictionary_get_empty_request, - build_dictionary_get_not_provided_request, - build_dictionary_get_null_request, - build_dictionary_get_valid_request, - build_dictionary_put_empty_request, - build_dictionary_put_valid_request, - build_flattencomplex_get_valid_request, - build_inheritance_get_valid_request, - build_inheritance_put_valid_request, - build_polymorphicrecursive_get_valid_request, - build_polymorphicrecursive_put_valid_request, - build_polymorphism_get_complicated_request, - build_polymorphism_get_composed_with_discriminator_request, - build_polymorphism_get_composed_without_discriminator_request, - build_polymorphism_get_dot_syntax_request, - build_polymorphism_get_valid_request, - build_polymorphism_put_complicated_request, - build_polymorphism_put_missing_discriminator_request, - build_polymorphism_put_valid_missing_required_request, - build_polymorphism_put_valid_request, - build_primitive_get_bool_request, - build_primitive_get_byte_request, - build_primitive_get_date_request, - build_primitive_get_date_time_request, - build_primitive_get_date_time_rfc1123_request, - build_primitive_get_double_request, - build_primitive_get_duration_request, - build_primitive_get_float_request, - build_primitive_get_int_request, - build_primitive_get_long_request, - build_primitive_get_string_request, - build_primitive_put_bool_request, - build_primitive_put_byte_request, - build_primitive_put_date_request, - build_primitive_put_date_time_request, - build_primitive_put_date_time_rfc1123_request, - build_primitive_put_double_request, - build_primitive_put_duration_request, - build_primitive_put_float_request, - build_primitive_put_int_request, - build_primitive_put_long_request, - build_primitive_put_string_request, - build_readonlyproperty_get_valid_request, - build_readonlyproperty_put_valid_request, -) - -T = TypeVar("T") +from ...operations._operations import build_array_get_empty_request, build_array_get_not_provided_request, build_array_get_valid_request, build_array_put_empty_request, build_array_put_valid_request, build_basic_get_empty_request, build_basic_get_invalid_request, build_basic_get_not_provided_request, build_basic_get_null_request, build_basic_get_valid_request, build_basic_put_valid_request, build_dictionary_get_empty_request, build_dictionary_get_not_provided_request, build_dictionary_get_null_request, build_dictionary_get_valid_request, build_dictionary_put_empty_request, build_dictionary_put_valid_request, build_flattencomplex_get_valid_request, build_inheritance_get_valid_request, build_inheritance_put_valid_request, build_polymorphicrecursive_get_valid_request, build_polymorphicrecursive_put_valid_request, build_polymorphism_get_complicated_request, build_polymorphism_get_composed_with_discriminator_request, build_polymorphism_get_composed_without_discriminator_request, build_polymorphism_get_dot_syntax_request, build_polymorphism_get_valid_request, build_polymorphism_put_complicated_request, build_polymorphism_put_missing_discriminator_request, build_polymorphism_put_valid_missing_required_request, build_polymorphism_put_valid_request, build_primitive_get_bool_request, build_primitive_get_byte_request, build_primitive_get_date_request, build_primitive_get_date_time_request, build_primitive_get_date_time_rfc1123_request, build_primitive_get_double_request, build_primitive_get_duration_request, build_primitive_get_float_request, build_primitive_get_int_request, build_primitive_get_long_request, build_primitive_get_string_request, build_primitive_put_bool_request, build_primitive_put_byte_request, build_primitive_put_date_request, build_primitive_put_date_time_request, build_primitive_put_date_time_rfc1123_request, build_primitive_put_double_request, build_primitive_put_duration_request, build_primitive_put_float_request, build_primitive_put_int_request, build_primitive_put_long_request, build_primitive_put_string_request, build_readonlyproperty_get_valid_request, build_readonlyproperty_put_valid_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class BasicOperations: """BasicOperations async operations. @@ -102,7 +38,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object @@ -121,15 +60,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_valid_request() + + request = build_basic_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -147,8 +92,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. @@ -169,12 +120,14 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -186,7 +139,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -197,8 +152,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> JSONType: + async def get_invalid( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is invalid for the local strong type. :return: JSON object @@ -217,15 +177,21 @@ async def get_invalid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_invalid_request() + + request = build_basic_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -243,8 +209,13 @@ async def get_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> JSONType: + async def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is empty. :return: JSON object @@ -263,15 +234,21 @@ async def get_empty(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_empty_request() + + request = build_basic_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -289,8 +266,13 @@ async def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> JSONType: + async def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type whose properties are null. :return: JSON object @@ -309,15 +291,21 @@ async def get_null(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_null_request() + + request = build_basic_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -335,8 +323,13 @@ async def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> JSONType: + async def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object @@ -355,15 +348,21 @@ async def get_not_provided(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_basic_get_not_provided_request() + + request = build_basic_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -401,7 +400,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_int(self, **kwargs: Any) -> JSONType: + async def get_int( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with integer properties. :return: JSON object @@ -417,15 +419,21 @@ async def get_int(self, **kwargs: Any) -> JSONType: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_int_request() + + request = build_primitive_get_int_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -443,8 +451,14 @@ async def get_int(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_int( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. @@ -462,11 +476,13 @@ async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -477,7 +493,9 @@ async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -488,8 +506,13 @@ async def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_long(self, **kwargs: Any) -> JSONType: + async def get_long( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with long properties. :return: JSON object @@ -505,15 +528,21 @@ async def get_long(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_long_request() + + request = build_primitive_get_long_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -531,8 +560,14 @@ async def get_long(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_long( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. @@ -550,11 +585,13 @@ async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -565,7 +602,9 @@ async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -576,8 +615,13 @@ async def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_float(self, **kwargs: Any) -> JSONType: + async def get_float( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with float properties. :return: JSON object @@ -593,15 +637,21 @@ async def get_float(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_float_request() + + request = build_primitive_get_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -619,8 +669,14 @@ async def get_float(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_float( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. @@ -638,11 +694,13 @@ async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -653,7 +711,9 @@ async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -664,8 +724,13 @@ async def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_double(self, **kwargs: Any) -> JSONType: + async def get_double( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with double properties. :return: JSON object @@ -682,15 +747,21 @@ async def get_double(self, **kwargs: Any) -> JSONType: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_double_request() + + request = build_primitive_get_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -708,8 +779,14 @@ async def get_double(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_double( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and @@ -729,11 +806,13 @@ async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -744,7 +823,9 @@ async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -755,8 +836,13 @@ async def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_bool(self, **kwargs: Any) -> JSONType: + async def get_bool( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with bool properties. :return: JSON object @@ -772,15 +858,21 @@ async def get_bool(self, **kwargs: Any) -> JSONType: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_bool_request() + + request = build_primitive_get_bool_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -798,8 +890,14 @@ async def get_bool(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_bool( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. @@ -817,11 +915,13 @@ async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -832,7 +932,9 @@ async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -843,8 +945,13 @@ async def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_string(self, **kwargs: Any) -> JSONType: + async def get_string( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with string properties. :return: JSON object @@ -861,15 +968,21 @@ async def get_string(self, **kwargs: Any) -> JSONType: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_string_request() + + request = build_primitive_get_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -887,8 +1000,14 @@ async def get_string(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_string( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. @@ -907,11 +1026,13 @@ async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -922,7 +1043,9 @@ async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -933,8 +1056,13 @@ async def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date(self, **kwargs: Any) -> JSONType: + async def get_date( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with date properties. :return: JSON object @@ -950,15 +1078,21 @@ async def get_date(self, **kwargs: Any) -> JSONType: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_date_request() + + request = build_primitive_get_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -976,8 +1110,14 @@ async def get_date(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_date( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. @@ -995,11 +1135,13 @@ async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1010,7 +1152,9 @@ async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1021,8 +1165,13 @@ async def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_time(self, **kwargs: Any) -> JSONType: + async def get_date_time( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetime properties. :return: JSON object @@ -1038,15 +1187,21 @@ async def get_date_time(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_date_time_request() + + request = build_primitive_get_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1064,8 +1219,14 @@ async def get_date_time(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_date_time( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -1083,11 +1244,13 @@ async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1098,7 +1261,9 @@ async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1109,8 +1274,13 @@ async def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: + async def get_date_time_rfc1123( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetimeRfc1123 properties. :return: JSON object @@ -1126,15 +1296,21 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_date_time_rfc1123_request() + + request = build_primitive_get_date_time_rfc1123_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1152,8 +1328,14 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_date_time_rfc1123( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 @@ -1172,11 +1354,13 @@ async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1187,7 +1371,9 @@ async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1198,8 +1384,13 @@ async def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_duration(self, **kwargs: Any) -> JSONType: + async def get_duration( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with duration properties. :return: JSON object @@ -1214,15 +1405,21 @@ async def get_duration(self, **kwargs: Any) -> JSONType: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_duration_request() + + request = build_primitive_get_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1240,8 +1437,14 @@ async def get_duration(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_duration( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. @@ -1258,11 +1461,13 @@ async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1273,7 +1478,9 @@ async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1284,8 +1491,13 @@ async def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_byte(self, **kwargs: Any) -> JSONType: + async def get_byte( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with byte properties. :return: JSON object @@ -1300,15 +1512,21 @@ async def get_byte(self, **kwargs: Any) -> JSONType: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_primitive_get_byte_request() + + request = build_primitive_get_byte_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1326,8 +1544,14 @@ async def get_byte(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_byte( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). @@ -1344,11 +1568,13 @@ async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1359,7 +1585,9 @@ async def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1390,7 +1618,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property. :return: JSON object @@ -1407,15 +1638,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_valid_request() + + request = build_array_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1433,8 +1670,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property. :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The @@ -1454,11 +1697,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1469,7 +1714,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1480,8 +1727,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> JSONType: + async def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property which is empty. :return: JSON object @@ -1498,15 +1750,21 @@ async def get_empty(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_empty_request() + + request = build_array_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1524,8 +1782,14 @@ async def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property which is empty. :param complex_body: Please put an empty array. @@ -1544,11 +1808,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1559,7 +1825,9 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1570,8 +1838,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> JSONType: + async def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property while server doesn't provide a response payload. :return: JSON object @@ -1588,15 +1861,21 @@ async def get_not_provided(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_array_get_not_provided_request() + + request = build_array_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1634,7 +1913,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property. :return: JSON object @@ -1651,15 +1933,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_valid_request() + + request = build_dictionary_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1677,8 +1965,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property. :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", @@ -1698,11 +1992,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1713,7 +2009,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1724,8 +2022,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> JSONType: + async def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is empty. :return: JSON object @@ -1742,15 +2045,21 @@ async def get_empty(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_empty_request() + + request = build_dictionary_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1768,8 +2077,14 @@ async def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. @@ -1788,11 +2103,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1803,7 +2120,9 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1814,8 +2133,13 @@ async def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_null(self, **kwargs: Any) -> JSONType: + async def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is null. :return: JSON object @@ -1832,15 +2156,21 @@ async def get_null(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_null_request() + + request = build_dictionary_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1858,8 +2188,13 @@ async def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> JSONType: + async def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object @@ -1876,15 +2211,21 @@ async def get_not_provided(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_not_provided_request() + + request = build_dictionary_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1922,7 +2263,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that extend others. :return: JSON object @@ -1947,15 +2291,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_inheritance_get_valid_request() + + request = build_inheritance_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1973,8 +2323,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, @@ -2003,11 +2359,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2018,7 +2376,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2049,7 +2409,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic. :return: JSON object @@ -2069,15 +2432,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_valid_request() + + request = build_polymorphism_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2095,8 +2464,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -2152,11 +2527,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2167,7 +2544,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2178,8 +2557,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_dot_syntax(self, **kwargs: Any) -> JSONType: + async def get_dot_syntax( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object @@ -2195,15 +2579,21 @@ async def get_dot_syntax(self, **kwargs: Any) -> JSONType: fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_dot_syntax_request() + + request = build_polymorphism_get_dot_syntax_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2221,8 +2611,13 @@ async def get_dot_syntax(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: + async def get_composed_with_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -2262,15 +2657,21 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_composed_with_discriminator_request() + + request = build_polymorphism_get_composed_with_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2288,8 +2689,13 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: + async def get_composed_without_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -2329,15 +2735,21 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_composed_without_discriminator_request() + + request = build_polymorphism_get_composed_without_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2355,8 +2767,13 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_complicated(self, **kwargs: Any) -> JSONType: + async def get_complicated( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -2386,15 +2803,21 @@ async def get_complicated(self, **kwargs: Any) -> JSONType: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphism_get_complicated_request() + + request = build_polymorphism_get_complicated_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2412,8 +2835,14 @@ async def get_complicated(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_complicated( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -2447,11 +2876,13 @@ async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2462,7 +2893,9 @@ async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2473,8 +2906,14 @@ async def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JSONType: + async def put_missing_discriminator( + self, + complex_body: JSONType, + **kwargs: Any + ) -> JSONType: """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: @@ -2526,11 +2965,13 @@ async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2541,7 +2982,9 @@ async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2559,8 +3002,14 @@ async def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) return deserialized + + @distributed_trace_async - async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid_missing_required( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -2611,11 +3060,13 @@ async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2626,7 +3077,9 @@ async def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2657,7 +3110,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic and have recursive references. :return: JSON object @@ -2677,15 +3133,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_polymorphicrecursive_get_valid_request() + + request = build_polymorphicrecursive_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2703,8 +3165,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -2780,11 +3248,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2795,7 +3265,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2826,7 +3298,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that have readonly properties. :return: JSON object @@ -2842,15 +3317,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_readonlyproperty_get_valid_request() + + request = build_readonlyproperty_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2868,8 +3349,14 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + async def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that have readonly properties. :param complex_body: @@ -2887,11 +3374,13 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2902,7 +3391,9 @@ async def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2933,7 +3424,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_valid(self, **kwargs: Any) -> JSONType: + async def get_valid( + self, + **kwargs: Any + ) -> JSONType: """get_valid. :return: JSON object @@ -2952,15 +3446,21 @@ async def get_valid(self, **kwargs: Any) -> JSONType: kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_flattencomplex_get_valid_request() + + request = build_flattencomplex_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2977,3 +3477,5 @@ async def get_valid(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/__init__.py index c805dd491a3..80697c6640b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/__init__.py @@ -17,13 +17,13 @@ from ._operations import FlattencomplexOperations __all__ = [ - "BasicOperations", - "PrimitiveOperations", - "ArrayOperations", - "DictionaryOperations", - "InheritanceOperations", - "PolymorphismOperations", - "PolymorphicrecursiveOperations", - "ReadonlypropertyOperations", - "FlattencomplexOperations", + 'BasicOperations', + 'PrimitiveOperations', + 'ArrayOperations', + 'DictionaryOperations', + 'InheritanceOperations', + 'PolymorphismOperations', + 'PolymorphicrecursiveOperations', + 'ReadonlypropertyOperations', + 'FlattencomplexOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py index af288491d24..ce5835d2916 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py @@ -8,796 +8,1274 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - -def build_basic_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/valid" + url = '/complex/basic/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_basic_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/basic/valid" + url = '/complex/basic/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) -def build_basic_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/invalid" + url = '/complex/basic/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/empty" + url = '/complex/basic/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_get_null_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/null" + url = '/complex/basic/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_basic_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_basic_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/basic/notprovided" + url = '/complex/basic/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_get_int_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_int_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/integer" + url = '/complex/primitive/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_int_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_int_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/integer" + url = '/complex/primitive/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_long_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_long_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/long" + url = '/complex/primitive/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_long_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_long_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/long" + url = '/complex/primitive/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_float_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_float_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/float" + url = '/complex/primitive/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/float" + url = '/complex/primitive/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_double_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_double_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/double" + url = '/complex/primitive/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/double" + url = '/complex/primitive/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_bool_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_bool_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/bool" + url = '/complex/primitive/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_bool_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_bool_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/bool" + url = '/complex/primitive/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_string_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/string" + url = '/complex/primitive/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_string_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_string_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/string" + url = '/complex/primitive/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_date_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/date" + url = '/complex/primitive/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/date" + url = '/complex/primitive/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_date_time_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/datetime" + url = '/complex/primitive/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_date_time_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_date_time_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/datetime" + url = '/complex/primitive/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_date_time_rfc1123_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/datetimerfc1123" + url = '/complex/primitive/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_primitive_put_date_time_rfc1123_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/datetimerfc1123" + url = '/complex/primitive/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_duration_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_duration_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/duration" + url = '/complex/primitive/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_duration_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_duration_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/duration" + url = '/complex/primitive/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_primitive_get_byte_request(**kwargs: Any) -> HttpRequest: +def build_primitive_get_byte_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/primitive/byte" + url = '/complex/primitive/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_primitive_put_byte_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_primitive_put_byte_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/primitive/byte" + url = '/complex/primitive/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_array_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/valid" + url = '/complex/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/array/valid" + url = '/complex/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_array_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/empty" + url = '/complex/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_array_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_array_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/array/empty" + url = '/complex/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_array_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_array_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/array/notprovided" + url = '/complex/array/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/valid" + url = '/complex/dictionary/typed/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_dictionary_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/valid" + url = '/complex/dictionary/typed/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/empty" + url = '/complex/dictionary/typed/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_dictionary_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/empty" + url = '/complex/dictionary/typed/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/null" + url = '/complex/dictionary/typed/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/dictionary/typed/notprovided" + url = '/complex/dictionary/typed/notprovided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_inheritance_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_inheritance_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/inheritance/valid" + url = '/complex/inheritance/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_inheritance_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_inheritance_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/inheritance/valid" + url = '/complex/inheritance/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_polymorphism_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/valid" + url = '/complex/polymorphism/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_put_valid_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_polymorphism_put_valid_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/valid" + url = '/complex/polymorphism/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_polymorphism_get_dot_syntax_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_dot_syntax_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/dotsyntax" + url = '/complex/polymorphism/dotsyntax' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_get_composed_with_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_composed_with_discriminator_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/composedWithDiscriminator" + url = '/complex/polymorphism/composedWithDiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_get_composed_without_discriminator_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_composed_without_discriminator_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/composedWithoutDiscriminator" + url = '/complex/polymorphism/composedWithoutDiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_polymorphism_get_complicated_request(**kwargs: Any) -> HttpRequest: +def build_polymorphism_get_complicated_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphism/complicated" + url = '/complex/polymorphism/complicated' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_polymorphism_put_complicated_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/complicated" + url = '/complex/polymorphism/complicated' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_polymorphism_put_missing_discriminator_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/missingdiscriminator" + url = '/complex/polymorphism/missingdiscriminator' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_polymorphism_put_valid_missing_required_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphism/missingrequired/invalid" + url = '/complex/polymorphism/missingrequired/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_polymorphicrecursive_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_polymorphicrecursive_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/polymorphicrecursive/valid" + url = '/complex/polymorphicrecursive/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_polymorphicrecursive_put_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/polymorphicrecursive/valid" + url = '/complex/polymorphicrecursive/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_readonlyproperty_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_readonlyproperty_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/readonlyproperty/valid" + url = '/complex/readonlyproperty/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_readonlyproperty_put_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/complex/readonlyproperty/valid" + url = '/complex/readonlyproperty/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_flattencomplex_get_valid_request(**kwargs: Any) -> HttpRequest: +def build_flattencomplex_get_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/complex/flatten/valid" + url = '/complex/flatten/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class BasicOperations(object): """BasicOperations operations. @@ -818,7 +1296,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. :return: JSON object @@ -837,15 +1318,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -863,8 +1350,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Please put {id: 2, name: 'abc', color: 'Magenta'}. :param complex_body: Please put {id: 2, name: 'abc', color: 'Magenta'}. @@ -885,12 +1378,14 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "2016-02-29") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2016-02-29") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -902,7 +1397,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -913,8 +1410,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> JSONType: + def get_invalid( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is invalid for the local strong type. :return: JSON object @@ -933,15 +1435,21 @@ def get_invalid(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -959,8 +1467,13 @@ def get_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_empty(self, **kwargs: Any) -> JSONType: + def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type that is empty. :return: JSON object @@ -979,15 +1492,21 @@ def get_empty(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1005,8 +1524,13 @@ def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_null(self, **kwargs: Any) -> JSONType: + def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type whose properties are null. :return: JSON object @@ -1025,15 +1549,21 @@ def get_null(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1051,8 +1581,13 @@ def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> JSONType: + def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get a basic complex type while the server doesn't provide a response payload. :return: JSON object @@ -1071,15 +1606,21 @@ def get_not_provided(self, **kwargs: Any) -> JSONType: does not fit on a single line and a line break. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_basic_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_basic_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1117,7 +1658,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_int(self, **kwargs: Any) -> JSONType: + def get_int( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with integer properties. :return: JSON object @@ -1133,15 +1677,21 @@ def get_int(self, **kwargs: Any) -> JSONType: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_int_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_int_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1159,8 +1709,14 @@ def get_int(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_int( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with integer properties. :param complex_body: Please put -1 and 2. @@ -1178,11 +1734,13 @@ def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1193,7 +1751,9 @@ def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1204,8 +1764,13 @@ def put_int(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_long(self, **kwargs: Any) -> JSONType: + def get_long( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with long properties. :return: JSON object @@ -1221,15 +1786,21 @@ def get_long(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_long_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_long_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1247,8 +1818,14 @@ def get_long(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_long( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with long properties. :param complex_body: Please put 1099511627775 and -999511627788. @@ -1266,11 +1843,13 @@ def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1281,7 +1860,9 @@ def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1292,8 +1873,13 @@ def put_long(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_float(self, **kwargs: Any) -> JSONType: + def get_float( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with float properties. :return: JSON object @@ -1309,15 +1895,21 @@ def get_float(self, **kwargs: Any) -> JSONType: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1335,8 +1927,14 @@ def get_float(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_float( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with float properties. :param complex_body: Please put 1.05 and -0.003. @@ -1354,11 +1952,13 @@ def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: "field2": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1369,7 +1969,9 @@ def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1380,8 +1982,13 @@ def put_float(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_double(self, **kwargs: Any) -> JSONType: + def get_double( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with double properties. :return: JSON object @@ -1398,15 +2005,21 @@ def get_double(self, **kwargs: Any) -> JSONType: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1424,8 +2037,14 @@ def get_double(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_double( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with double properties. :param complex_body: Please put 3e-100 and @@ -1445,11 +2064,13 @@ def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1460,7 +2081,9 @@ def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1471,8 +2094,13 @@ def put_double(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_bool(self, **kwargs: Any) -> JSONType: + def get_bool( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with bool properties. :return: JSON object @@ -1488,15 +2116,21 @@ def get_bool(self, **kwargs: Any) -> JSONType: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_bool_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_bool_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1514,8 +2148,14 @@ def get_bool(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_bool( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with bool properties. :param complex_body: Please put true and false. @@ -1533,11 +2173,13 @@ def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: "field_true": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1548,7 +2190,9 @@ def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1559,8 +2203,13 @@ def put_bool(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_string(self, **kwargs: Any) -> JSONType: + def get_string( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with string properties. :return: JSON object @@ -1577,15 +2226,21 @@ def get_string(self, **kwargs: Any) -> JSONType: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1603,8 +2258,14 @@ def get_string(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_string( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with string properties. :param complex_body: Please put 'goodrequest', '', and null. @@ -1623,11 +2284,13 @@ def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: "null": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1638,7 +2301,9 @@ def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1649,8 +2314,13 @@ def put_string(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date(self, **kwargs: Any) -> JSONType: + def get_date( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with date properties. :return: JSON object @@ -1666,15 +2336,21 @@ def get_date(self, **kwargs: Any) -> JSONType: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1692,8 +2368,14 @@ def get_date(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_date( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with date properties. :param complex_body: Please put '0001-01-01' and '2016-02-29'. @@ -1711,11 +2393,13 @@ def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: "leap": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1726,7 +2410,9 @@ def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1737,8 +2423,13 @@ def put_date(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_time(self, **kwargs: Any) -> JSONType: + def get_date_time( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetime properties. :return: JSON object @@ -1754,15 +2445,21 @@ def get_date_time(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1780,8 +2477,14 @@ def get_date_time(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_date_time( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetime properties. :param complex_body: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. @@ -1799,11 +2502,13 @@ def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1814,7 +2519,9 @@ def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1825,8 +2532,13 @@ def put_date_time(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: + def get_date_time_rfc1123( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with datetimeRfc1123 properties. :return: JSON object @@ -1842,15 +2554,21 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_date_time_rfc1123_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_date_time_rfc1123_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1868,8 +2586,14 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_date_time_rfc1123( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with datetimeRfc1123 properties. :param complex_body: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 @@ -1888,11 +2612,13 @@ def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: "now": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1903,7 +2629,9 @@ def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1914,8 +2642,13 @@ def put_date_time_rfc1123(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_duration(self, **kwargs: Any) -> JSONType: + def get_duration( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with duration properties. :return: JSON object @@ -1930,15 +2663,21 @@ def get_duration(self, **kwargs: Any) -> JSONType: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_duration_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1956,8 +2695,14 @@ def get_duration(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_duration( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with duration properties. :param complex_body: Please put 'P123DT22H14M12.011S'. @@ -1974,11 +2719,13 @@ def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: "field": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -1989,7 +2736,9 @@ def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2000,8 +2749,13 @@ def put_duration(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_byte(self, **kwargs: Any) -> JSONType: + def get_byte( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with byte properties. :return: JSON object @@ -2016,15 +2770,21 @@ def get_byte(self, **kwargs: Any) -> JSONType: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_primitive_get_byte_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_primitive_get_byte_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2042,8 +2802,14 @@ def get_byte(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_byte( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with byte properties. :param complex_body: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). @@ -2060,11 +2826,13 @@ def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: "field": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2075,7 +2843,9 @@ def put_byte(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2106,7 +2876,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property. :return: JSON object @@ -2123,15 +2896,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2149,8 +2928,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property. :param complex_body: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The @@ -2170,11 +2955,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2185,7 +2972,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2196,8 +2985,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty(self, **kwargs: Any) -> JSONType: + def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property which is empty. :return: JSON object @@ -2214,15 +3008,21 @@ def get_empty(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2240,8 +3040,14 @@ def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with array property which is empty. :param complex_body: Please put an empty array. @@ -2260,11 +3066,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2275,7 +3083,9 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2286,8 +3096,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> JSONType: + def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with array property while server doesn't provide a response payload. :return: JSON object @@ -2304,15 +3119,21 @@ def get_not_provided(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_array_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_array_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2350,7 +3171,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property. :return: JSON object @@ -2367,15 +3191,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2393,8 +3223,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property. :param complex_body: Please put a dictionary with 5 key-value pairs: "txt":"notepad", @@ -2414,11 +3250,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2429,7 +3267,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2440,8 +3280,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty(self, **kwargs: Any) -> JSONType: + def get_empty( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is empty. :return: JSON object @@ -2458,15 +3303,21 @@ def get_empty(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2484,8 +3335,14 @@ def get_empty(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_empty( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types with dictionary property which is empty. :param complex_body: Please put an empty dictionary. @@ -2504,11 +3361,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2519,7 +3378,9 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2530,8 +3391,13 @@ def put_empty(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_null(self, **kwargs: Any) -> JSONType: + def get_null( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property which is null. :return: JSON object @@ -2548,15 +3414,21 @@ def get_null(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2574,8 +3446,13 @@ def get_null(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> JSONType: + def get_not_provided( + self, + **kwargs: Any + ) -> JSONType: """Get complex types with dictionary property while server doesn't provide a response payload. :return: JSON object @@ -2592,15 +3469,21 @@ def get_not_provided(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2638,7 +3521,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that extend others. :return: JSON object @@ -2663,15 +3549,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_inheritance_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_inheritance_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2689,8 +3581,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that extend others. :param complex_body: Please put a siamese with id=2, name="Siameee", color=green, @@ -2719,11 +3617,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2734,7 +3634,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2765,7 +3667,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic. :return: JSON object @@ -2785,15 +3690,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2811,8 +3722,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic. :param complex_body: Please put a salmon that looks like this: @@ -2868,11 +3785,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -2883,7 +3802,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2894,8 +3815,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_dot_syntax(self, **kwargs: Any) -> JSONType: + def get_dot_syntax( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, JSON key contains a dot. :return: JSON object @@ -2911,15 +3837,21 @@ def get_dot_syntax(self, **kwargs: Any) -> JSONType: fish.type: fish.type } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_dot_syntax_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_dot_syntax_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2937,8 +3869,13 @@ def get_dot_syntax(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: + def get_composed_with_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -2978,15 +3915,21 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_composed_with_discriminator_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_composed_with_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3004,8 +3947,13 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: + def get_composed_without_discriminator( + self, + **kwargs: Any + ) -> JSONType: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -3045,15 +3993,21 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_composed_without_discriminator_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_composed_without_discriminator_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3071,8 +4025,13 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_complicated(self, **kwargs: Any) -> JSONType: + def get_complicated( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -3102,15 +4061,21 @@ def get_complicated(self, **kwargs: Any) -> JSONType: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphism_get_complicated_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphism_get_complicated_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3128,8 +4093,14 @@ def get_complicated(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_complicated( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -3163,11 +4134,13 @@ def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3178,7 +4151,9 @@ def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3189,8 +4164,14 @@ def put_complicated(self, complex_body: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JSONType: + def put_missing_discriminator( + self, + complex_body: JSONType, + **kwargs: Any + ) -> JSONType: """Put complex types that are polymorphic, omitting the discriminator. :param complex_body: @@ -3242,11 +4223,13 @@ def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JS fishtype: salmon } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3257,7 +4240,9 @@ def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JS request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3275,8 +4260,14 @@ def put_missing_discriminator(self, complex_body: JSONType, **kwargs: Any) -> JS return deserialized + + @distributed_trace - def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid_missing_required( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -3327,11 +4318,13 @@ def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> N fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3342,7 +4335,9 @@ def put_valid_missing_required(self, complex_body: JSONType, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3373,7 +4368,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that are polymorphic and have recursive references. :return: JSON object @@ -3393,15 +4391,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_polymorphicrecursive_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_polymorphicrecursive_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3419,8 +4423,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that are polymorphic and have recursive references. :param complex_body: Please put a salmon that looks like this: @@ -3496,11 +4506,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: fishtype: fishtype } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3511,7 +4523,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3542,7 +4556,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """Get complex types that have readonly properties. :return: JSON object @@ -3558,15 +4575,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_readonlyproperty_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_readonlyproperty_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3584,8 +4607,14 @@ def get_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: + def put_valid( + self, + complex_body: JSONType, + **kwargs: Any + ) -> None: """Put complex types that have readonly properties. :param complex_body: @@ -3603,11 +4632,13 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: "size": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = complex_body @@ -3618,7 +4649,9 @@ def put_valid(self, complex_body: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3649,7 +4682,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_valid(self, **kwargs: Any) -> JSONType: + def get_valid( + self, + **kwargs: Any + ) -> JSONType: """get_valid. :return: JSON object @@ -3668,15 +4704,21 @@ def get_valid(self, **kwargs: Any) -> JSONType: kind: kind } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_flattencomplex_get_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_flattencomplex_get_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3693,3 +4735,5 @@ def get_valid(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py index ea77baa0fb5..ab429f6939d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/__init__.py index baf26fe7155..b1b218fa611 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestRFC1123DateTimeTestService"] +__all__ = ['AutoRestRFC1123DateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_auto_rest_rfc1123_date_time_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_auto_rest_rfc1123_date_time_test_service.py index 41e928b6858..a36bb18d0f1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_auto_rest_rfc1123_date_time_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_auto_rest_rfc1123_date_time_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRFC1123DateTimeTestService: """Test Infrastructure for AutoRest. @@ -31,8 +30,13 @@ class AutoRestRFC1123DateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestRFC1123DateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -41,6 +45,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.datetimerfc1123 = Datetimerfc1123Operations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_configuration.py index 8987dad58ea..fb56b6bf520 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): # pylint: attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestRFC1123DateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestrfc1123datetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrfc1123datetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/__init__.py index 7cdf4bb0601..4a49b2bc883 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_rfc1123_date_time_test_service import AutoRestRFC1123DateTimeTestService - -__all__ = ["AutoRestRFC1123DateTimeTestService"] +__all__ = ['AutoRestRFC1123DateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_auto_rest_rfc1123_date_time_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_auto_rest_rfc1123_date_time_test_service.py index 2de7a12fdfe..fcad5e38a88 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_auto_rest_rfc1123_date_time_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_auto_rest_rfc1123_date_time_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRFC1123DateTimeTestService: """Test Infrastructure for AutoRest. @@ -31,7 +30,12 @@ class AutoRestRFC1123DateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestRFC1123DateTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,7 +44,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.datetimerfc1123 = Datetimerfc1123Operations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_configuration.py index 0ab8b3ec958..40ad35ac665 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestRFC1123DateTimeTestServiceConfiguration(Configuration): # pylint: attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestRFC1123DateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestrfc1123datetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrfc1123datetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/__init__.py index eec7d4d6f9e..2db234e6d81 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import Datetimerfc1123Operations __all__ = [ - "Datetimerfc1123Operations", + 'Datetimerfc1123Operations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py index 768b3e9294a..56735f6b7e5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py @@ -9,35 +9,17 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_datetimerfc1123_get_invalid_request, - build_datetimerfc1123_get_null_request, - build_datetimerfc1123_get_overflow_request, - build_datetimerfc1123_get_underflow_request, - build_datetimerfc1123_get_utc_lowercase_max_date_time_request, - build_datetimerfc1123_get_utc_min_date_time_request, - build_datetimerfc1123_get_utc_uppercase_max_date_time_request, - build_datetimerfc1123_put_utc_max_date_time_request, - build_datetimerfc1123_put_utc_min_date_time_request, -) - -T = TypeVar("T") +from ...operations._operations import build_datetimerfc1123_get_invalid_request, build_datetimerfc1123_get_null_request, build_datetimerfc1123_get_overflow_request, build_datetimerfc1123_get_underflow_request, build_datetimerfc1123_get_utc_lowercase_max_date_time_request, build_datetimerfc1123_get_utc_min_date_time_request, build_datetimerfc1123_get_utc_uppercase_max_date_time_request, build_datetimerfc1123_put_utc_max_date_time_request, build_datetimerfc1123_put_utc_min_date_time_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class Datetimerfc1123Operations: """Datetimerfc1123Operations async operations. @@ -57,22 +39,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null datetime value. :return: datetime or None :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -90,23 +81,34 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.datetime: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -124,23 +126,34 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def get_overflow(self, **kwargs: Any) -> datetime.datetime: + async def get_overflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get overflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_overflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_overflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -158,23 +171,34 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def get_underflow(self, **kwargs: Any) -> datetime.datetime: + async def get_underflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get underflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_underflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_underflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -192,8 +216,14 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. :param datetime_body: datetime body. @@ -202,11 +232,13 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -217,7 +249,9 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -228,23 +262,34 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value fri, 31 dec 9999 23:59:59 gmt. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_utc_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_utc_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -262,23 +307,34 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet return deserialized + + @distributed_trace_async - async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_utc_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_utc_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -296,8 +352,14 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet return deserialized + + @distributed_trace_async - async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. :param datetime_body: datetime body. @@ -306,11 +368,13 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -321,7 +385,9 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -332,23 +398,34 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_utc_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_utc_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -365,3 +442,5 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/__init__.py index eec7d4d6f9e..2db234e6d81 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import Datetimerfc1123Operations __all__ = [ - "Datetimerfc1123Operations", + 'Datetimerfc1123Operations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py index 95158c6b880..e21083ba23d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py @@ -9,146 +9,206 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_datetimerfc1123_get_null_request(**kwargs: Any) -> HttpRequest: +def build_datetimerfc1123_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/null" + url = '/datetimerfc1123/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetimerfc1123_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_datetimerfc1123_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/invalid" + url = '/datetimerfc1123/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetimerfc1123_get_overflow_request(**kwargs: Any) -> HttpRequest: +def build_datetimerfc1123_get_overflow_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/overflow" + url = '/datetimerfc1123/overflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetimerfc1123_get_underflow_request(**kwargs: Any) -> HttpRequest: +def build_datetimerfc1123_get_underflow_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/underflow" + url = '/datetimerfc1123/underflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetimerfc1123_put_utc_max_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetimerfc1123/max" + url = '/datetimerfc1123/max' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetimerfc1123_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetimerfc1123_get_utc_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/max/lowercase" + url = '/datetimerfc1123/max/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetimerfc1123_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetimerfc1123_get_utc_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/max/uppercase" + url = '/datetimerfc1123/max/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetimerfc1123_put_utc_min_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetimerfc1123/min" + url = '/datetimerfc1123/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetimerfc1123_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetimerfc1123_get_utc_min_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetimerfc1123/min" + url = '/datetimerfc1123/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class Datetimerfc1123Operations(object): """Datetimerfc1123Operations operations. @@ -169,22 +229,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: + def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null datetime value. :return: datetime or None :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -202,23 +271,34 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> datetime.datetime: + def get_invalid( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -236,23 +316,34 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_overflow(self, **kwargs: Any) -> datetime.datetime: + def get_overflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get overflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_overflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_overflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -270,23 +361,34 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_underflow(self, **kwargs: Any) -> datetime.datetime: + def get_underflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get underflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_underflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_underflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -304,8 +406,14 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_utc_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. :param datetime_body: datetime body. @@ -314,11 +422,13 @@ def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -329,7 +439,9 @@ def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -340,23 +452,34 @@ def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_utc_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value fri, 31 dec 9999 23:59:59 gmt. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_utc_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_utc_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -374,23 +497,34 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_utc_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_utc_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_utc_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -408,8 +542,14 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_utc_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. :param datetime_body: datetime body. @@ -418,11 +558,13 @@ def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -433,7 +575,9 @@ def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -444,23 +588,34 @@ def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_utc_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetimerfc1123_get_utc_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetimerfc1123_get_utc_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -477,3 +632,5 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py index 8c0de0f8c73..d9e2ec06e9c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/__init__.py index df3337616a6..0fd77564071 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDateTimeTestService"] +__all__ = ['AutoRestDateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_auto_rest_date_time_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_auto_rest_date_time_test_service.py index 05389ac7424..ad34e461655 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_auto_rest_date_time_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_auto_rest_date_time_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTimeTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestDateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.datetime = DatetimeOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_configuration.py index 6eececda5b9..b2649384d8f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestDateTimeTestServiceConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/__init__.py index 11cb96198a2..216b041a4cb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_date_time_test_service import AutoRestDateTimeTestService - -__all__ = ["AutoRestDateTimeTestService"] +__all__ = ['AutoRestDateTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_auto_rest_date_time_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_auto_rest_date_time_test_service.py index fa3592979f5..2e9e3abeb81 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_auto_rest_date_time_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_auto_rest_date_time_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTimeTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestDateTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDateTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.datetime = DatetimeOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_configuration.py index 6d637375ab1..fb1109a0d47 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestDateTimeTestServiceConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/__init__.py index 85d15225d1c..258b200b9f0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DatetimeOperations __all__ = [ - "DatetimeOperations", + 'DatetimeOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py index e47beebae84..d542d069023 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py @@ -9,48 +9,17 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_datetime_get_invalid_request, - build_datetime_get_local_negative_offset_lowercase_max_date_time_request, - build_datetime_get_local_negative_offset_min_date_time_request, - build_datetime_get_local_negative_offset_uppercase_max_date_time_request, - build_datetime_get_local_no_offset_min_date_time_request, - build_datetime_get_local_positive_offset_lowercase_max_date_time_request, - build_datetime_get_local_positive_offset_min_date_time_request, - build_datetime_get_local_positive_offset_uppercase_max_date_time_request, - build_datetime_get_null_request, - build_datetime_get_overflow_request, - build_datetime_get_underflow_request, - build_datetime_get_utc_lowercase_max_date_time_request, - build_datetime_get_utc_min_date_time_request, - build_datetime_get_utc_uppercase_max_date_time7_digits_request, - build_datetime_get_utc_uppercase_max_date_time_request, - build_datetime_put_local_negative_offset_max_date_time_request, - build_datetime_put_local_negative_offset_min_date_time_request, - build_datetime_put_local_positive_offset_max_date_time_request, - build_datetime_put_local_positive_offset_min_date_time_request, - build_datetime_put_utc_max_date_time7_digits_request, - build_datetime_put_utc_max_date_time_request, - build_datetime_put_utc_min_date_time_request, -) - -T = TypeVar("T") +from ...operations._operations import build_datetime_get_invalid_request, build_datetime_get_local_negative_offset_lowercase_max_date_time_request, build_datetime_get_local_negative_offset_min_date_time_request, build_datetime_get_local_negative_offset_uppercase_max_date_time_request, build_datetime_get_local_no_offset_min_date_time_request, build_datetime_get_local_positive_offset_lowercase_max_date_time_request, build_datetime_get_local_positive_offset_min_date_time_request, build_datetime_get_local_positive_offset_uppercase_max_date_time_request, build_datetime_get_null_request, build_datetime_get_overflow_request, build_datetime_get_underflow_request, build_datetime_get_utc_lowercase_max_date_time_request, build_datetime_get_utc_min_date_time_request, build_datetime_get_utc_uppercase_max_date_time7_digits_request, build_datetime_get_utc_uppercase_max_date_time_request, build_datetime_put_local_negative_offset_max_date_time_request, build_datetime_put_local_negative_offset_min_date_time_request, build_datetime_put_local_positive_offset_max_date_time_request, build_datetime_put_local_positive_offset_min_date_time_request, build_datetime_put_utc_max_date_time7_digits_request, build_datetime_put_utc_max_date_time_request, build_datetime_put_utc_min_date_time_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DatetimeOperations: # pylint: disable=too-many-public-methods """DatetimeOperations async operations. @@ -70,22 +39,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null datetime value. :return: datetime or None :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -103,23 +81,34 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.datetime: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -137,23 +126,34 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def get_overflow(self, **kwargs: Any) -> datetime.datetime: + async def get_overflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get overflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_overflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_overflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -171,23 +171,34 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def get_underflow(self, **kwargs: Any) -> datetime.datetime: + async def get_underflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get underflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_underflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_underflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -205,8 +216,14 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value 9999-12-31T23:59:59.999Z. :param datetime_body: datetime body. @@ -215,11 +232,13 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -230,7 +249,9 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -241,8 +262,14 @@ async def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_max_date_time7_digits( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -254,11 +281,13 @@ async def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -269,7 +298,9 @@ async def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -280,23 +311,34 @@ async def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31t23:59:59.999z. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -314,23 +356,34 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet return deserialized + + @distributed_trace_async - async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31T23:59:59.999Z. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -348,8 +401,13 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet return deserialized + + @distributed_trace_async - async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_uppercase_max_date_time7_digits( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -359,15 +417,21 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_uppercase_max_date_time7_digits_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_uppercase_max_date_time7_digits_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -385,8 +449,14 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti return deserialized + + @distributed_trace_async - async def put_local_positive_offset_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_positive_offset_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. :param datetime_body: datetime body. @@ -395,11 +465,13 @@ async def put_local_positive_offset_max_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -410,7 +482,9 @@ async def put_local_positive_offset_max_date_time(self, datetime_body: datetime. request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -421,23 +495,34 @@ async def put_local_positive_offset_max_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_local_positive_offset_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_positive_offset_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999+14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_positive_offset_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_positive_offset_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -455,23 +540,34 @@ async def get_local_positive_offset_lowercase_max_date_time(self, **kwargs: Any) return deserialized + + @distributed_trace_async - async def get_local_positive_offset_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_positive_offset_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999+14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_positive_offset_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_positive_offset_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -489,8 +585,14 @@ async def get_local_positive_offset_uppercase_max_date_time(self, **kwargs: Any) return deserialized + + @distributed_trace_async - async def put_local_negative_offset_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_negative_offset_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. :param datetime_body: datetime body. @@ -499,11 +601,13 @@ async def put_local_negative_offset_max_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -514,7 +618,9 @@ async def put_local_negative_offset_max_date_time(self, datetime_body: datetime. request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -525,23 +631,34 @@ async def put_local_negative_offset_max_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_local_negative_offset_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_negative_offset_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999-14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_negative_offset_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_negative_offset_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -559,23 +676,34 @@ async def get_local_negative_offset_uppercase_max_date_time(self, **kwargs: Any) return deserialized + + @distributed_trace_async - async def get_local_negative_offset_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_negative_offset_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999-14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_negative_offset_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_negative_offset_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -593,8 +721,14 @@ async def get_local_negative_offset_lowercase_max_date_time(self, **kwargs: Any) return deserialized + + @distributed_trace_async - async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_utc_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00Z. :param datetime_body: datetime body. @@ -603,11 +737,13 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -618,7 +754,9 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -629,23 +767,34 @@ async def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_utc_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00Z. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -663,8 +812,14 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def put_local_positive_offset_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_positive_offset_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00+14:00. :param datetime_body: datetime body. @@ -673,11 +828,13 @@ async def put_local_positive_offset_min_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -688,7 +845,9 @@ async def put_local_positive_offset_min_date_time(self, datetime_body: datetime. request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -699,23 +858,34 @@ async def put_local_positive_offset_min_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_positive_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00+14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_positive_offset_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_positive_offset_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -733,8 +903,14 @@ async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> dateti return deserialized + + @distributed_trace_async - async def put_local_negative_offset_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + async def put_local_negative_offset_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00-14:00. :param datetime_body: datetime body. @@ -743,11 +919,13 @@ async def put_local_negative_offset_min_date_time(self, datetime_body: datetime. :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -758,7 +936,9 @@ async def put_local_negative_offset_min_date_time(self, datetime_body: datetime. request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -769,23 +949,34 @@ async def put_local_negative_offset_min_date_time(self, datetime_body: datetime. if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_negative_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00-14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_negative_offset_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_negative_offset_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -803,23 +994,34 @@ async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> dateti return deserialized + + @distributed_trace_async - async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + async def get_local_no_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_no_offset_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_no_offset_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -836,3 +1038,5 @@ async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.dat return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/__init__.py index 85d15225d1c..258b200b9f0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DatetimeOperations __all__ = [ - "DatetimeOperations", + 'DatetimeOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py index 9082b084f5e..e5ffb60daf4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py @@ -9,332 +9,498 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_datetime_get_null_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/null" + url = '/datetime/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/invalid" + url = '/datetime/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_overflow_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_overflow_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/overflow" + url = '/datetime/overflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_underflow_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_underflow_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/underflow" + url = '/datetime/underflow' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetime_put_utc_max_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/utc" + url = '/datetime/max/utc' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_datetime_put_utc_max_date_time7_digits_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/utc7ms" + url = '/datetime/max/utc7ms' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetime_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_utc_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/utc/lowercase" + url = '/datetime/max/utc/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_utc_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/utc/uppercase" + url = '/datetime/max/utc/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_utc_uppercase_max_date_time7_digits_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_utc_uppercase_max_date_time7_digits_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/utc7ms/uppercase" + url = '/datetime/max/utc7ms/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetime_put_local_positive_offset_max_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/localpositiveoffset" + url = '/datetime/max/localpositiveoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetime_get_local_positive_offset_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_local_positive_offset_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/localpositiveoffset/lowercase" + url = '/datetime/max/localpositiveoffset/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_local_positive_offset_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_local_positive_offset_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/localpositiveoffset/uppercase" + url = '/datetime/max/localpositiveoffset/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetime_put_local_negative_offset_max_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/max/localnegativeoffset" + url = '/datetime/max/localnegativeoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetime_get_local_negative_offset_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_local_negative_offset_uppercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/localnegativeoffset/uppercase" + url = '/datetime/max/localnegativeoffset/uppercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_local_negative_offset_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_local_negative_offset_lowercase_max_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/max/localnegativeoffset/lowercase" + url = '/datetime/max/localnegativeoffset/lowercase' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetime_put_utc_min_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/min/utc" + url = '/datetime/min/utc' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetime_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_utc_min_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/min/utc" + url = '/datetime/min/utc' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetime_put_local_positive_offset_min_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/min/localpositiveoffset" + url = '/datetime/min/localpositiveoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetime_get_local_positive_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_local_positive_offset_min_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/min/localpositiveoffset" + url = '/datetime/min/localpositiveoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_datetime_put_local_negative_offset_min_date_time_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/datetime/min/localnegativeoffset" + url = '/datetime/min/localnegativeoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_datetime_get_local_negative_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_local_negative_offset_min_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/min/localnegativeoffset" + url = '/datetime/min/localnegativeoffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_datetime_get_local_no_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: +def build_datetime_get_local_no_offset_min_date_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/datetime/min/localnooffset" + url = '/datetime/min/localnooffset' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class DatetimeOperations(object): # pylint: disable=too-many-public-methods """DatetimeOperations operations. @@ -355,22 +521,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: + def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null datetime value. :return: datetime or None :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -388,23 +563,34 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> datetime.datetime: + def get_invalid( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -422,23 +608,34 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_overflow(self, **kwargs: Any) -> datetime.datetime: + def get_overflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get overflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_overflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_overflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -456,23 +653,34 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_underflow(self, **kwargs: Any) -> datetime.datetime: + def get_underflow( + self, + **kwargs: Any + ) -> datetime.datetime: """Get underflow datetime value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_underflow_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_underflow_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -490,8 +698,14 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_utc_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value 9999-12-31T23:59:59.999Z. :param datetime_body: datetime body. @@ -500,11 +714,13 @@ def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -515,7 +731,9 @@ def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -526,8 +744,14 @@ def put_utc_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_utc_max_date_time7_digits( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -539,11 +763,13 @@ def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, **kwar :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -554,7 +780,9 @@ def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -565,23 +793,34 @@ def put_utc_max_date_time7_digits(self, datetime_body: datetime.datetime, **kwar if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_utc_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31t23:59:59.999z. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -599,23 +838,34 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_utc_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31T23:59:59.999Z. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -633,8 +883,13 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.datetime: + def get_utc_uppercase_max_date_time7_digits( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -644,15 +899,21 @@ def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_uppercase_max_date_time7_digits_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_uppercase_max_date_time7_digits_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -670,8 +931,14 @@ def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.dat return deserialized + + @distributed_trace - def put_local_positive_offset_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_local_positive_offset_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. :param datetime_body: datetime body. @@ -680,11 +947,13 @@ def put_local_positive_offset_max_date_time(self, datetime_body: datetime.dateti :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -695,7 +964,9 @@ def put_local_positive_offset_max_date_time(self, datetime_body: datetime.dateti request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -706,23 +977,34 @@ def put_local_positive_offset_max_date_time(self, datetime_body: datetime.dateti if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_local_positive_offset_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_local_positive_offset_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999+14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_positive_offset_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_positive_offset_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -740,23 +1022,34 @@ def get_local_positive_offset_lowercase_max_date_time(self, **kwargs: Any) -> da return deserialized + + @distributed_trace - def get_local_positive_offset_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_local_positive_offset_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999+14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_positive_offset_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_positive_offset_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -774,8 +1067,14 @@ def get_local_positive_offset_uppercase_max_date_time(self, **kwargs: Any) -> da return deserialized + + @distributed_trace - def put_local_negative_offset_max_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_local_negative_offset_max_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. :param datetime_body: datetime body. @@ -784,11 +1083,13 @@ def put_local_negative_offset_max_date_time(self, datetime_body: datetime.dateti :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -799,7 +1100,9 @@ def put_local_negative_offset_max_date_time(self, datetime_body: datetime.dateti request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -810,23 +1113,34 @@ def put_local_negative_offset_max_date_time(self, datetime_body: datetime.dateti if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_local_negative_offset_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_local_negative_offset_uppercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999-14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_negative_offset_uppercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_negative_offset_uppercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -844,23 +1158,34 @@ def get_local_negative_offset_uppercase_max_date_time(self, **kwargs: Any) -> da return deserialized + + @distributed_trace - def get_local_negative_offset_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_local_negative_offset_lowercase_max_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999-14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_negative_offset_lowercase_max_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_negative_offset_lowercase_max_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -878,8 +1203,14 @@ def get_local_negative_offset_lowercase_max_date_time(self, **kwargs: Any) -> da return deserialized + + @distributed_trace - def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_utc_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00Z. :param datetime_body: datetime body. @@ -888,11 +1219,13 @@ def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -903,7 +1236,9 @@ def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -914,23 +1249,34 @@ def put_utc_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_utc_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00Z. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_utc_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_utc_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -948,8 +1294,14 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def put_local_positive_offset_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_local_positive_offset_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00+14:00. :param datetime_body: datetime body. @@ -958,11 +1310,13 @@ def put_local_positive_offset_min_date_time(self, datetime_body: datetime.dateti :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -973,7 +1327,9 @@ def put_local_positive_offset_min_date_time(self, datetime_body: datetime.dateti request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -984,23 +1340,34 @@ def put_local_positive_offset_min_date_time(self, datetime_body: datetime.dateti if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_local_positive_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00+14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_positive_offset_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_positive_offset_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1018,8 +1385,14 @@ def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.dat return deserialized + + @distributed_trace - def put_local_negative_offset_min_date_time(self, datetime_body: datetime.datetime, **kwargs: Any) -> None: + def put_local_negative_offset_min_date_time( + self, + datetime_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put min datetime value 0001-01-01T00:00:00-14:00. :param datetime_body: datetime body. @@ -1028,11 +1401,13 @@ def put_local_negative_offset_min_date_time(self, datetime_body: datetime.dateti :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = datetime_body @@ -1043,7 +1418,9 @@ def put_local_negative_offset_min_date_time(self, datetime_body: datetime.dateti request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1054,23 +1431,34 @@ def put_local_negative_offset_min_date_time(self, datetime_body: datetime.dateti if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_local_negative_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00-14:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_negative_offset_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_negative_offset_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1088,23 +1476,34 @@ def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.dat return deserialized + + @distributed_trace - def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: + def get_local_no_offset_min_date_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get min datetime value 0001-01-01T00:00:00. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_datetime_get_local_no_offset_min_date_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_datetime_get_local_no_offset_min_date_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1121,3 +1520,5 @@ def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py index e3def2be286..5b3c0852cfa 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/__init__.py index c72e12f3ed2..2e45fd5955d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDateTestService"] +__all__ = ['AutoRestDateTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_auto_rest_date_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_auto_rest_date_test_service.py index f8abe8c6ef1..a1c599114bf 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_auto_rest_date_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_auto_rest_date_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestDateTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDateTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.date = DateOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_configuration.py index f82c8c7ee22..deb4b257788 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestDateTestServiceConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/__init__.py index a4536c944f2..9a13a3906db 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_date_test_service import AutoRestDateTestService - -__all__ = ["AutoRestDateTestService"] +__all__ = ['AutoRestDateTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_auto_rest_date_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_auto_rest_date_test_service.py index f95c3dc16b8..d72b020e41b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_auto_rest_date_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_auto_rest_date_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDateTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestDateTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDateTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.date = DateOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_configuration.py index b6aa3ee8416..8de96a567e4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestDateTestServiceConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDateTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdatetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdatetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/__init__.py index 3ddacb54784..438432b19c7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DateOperations __all__ = [ - "DateOperations", + 'DateOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py index 688e4a68bf7..8644ffc22bb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py @@ -9,34 +9,17 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_date_get_invalid_date_request, - build_date_get_max_date_request, - build_date_get_min_date_request, - build_date_get_null_request, - build_date_get_overflow_date_request, - build_date_get_underflow_date_request, - build_date_put_max_date_request, - build_date_put_min_date_request, -) - -T = TypeVar("T") +from ...operations._operations import build_date_get_invalid_date_request, build_date_get_max_date_request, build_date_get_min_date_request, build_date_get_null_request, build_date_get_overflow_date_request, build_date_get_underflow_date_request, build_date_put_max_date_request, build_date_put_min_date_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DateOperations: """DateOperations async operations. @@ -56,22 +39,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.date]: """Get null date value. :return: date or None :rtype: ~datetime.date or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -89,23 +81,34 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: return deserialized + + @distributed_trace_async - async def get_invalid_date(self, **kwargs: Any) -> datetime.date: + async def get_invalid_date( + self, + **kwargs: Any + ) -> datetime.date: """Get invalid date value. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_invalid_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_invalid_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -123,23 +126,34 @@ async def get_invalid_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace_async - async def get_overflow_date(self, **kwargs: Any) -> datetime.date: + async def get_overflow_date( + self, + **kwargs: Any + ) -> datetime.date: """Get overflow date value. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_overflow_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_overflow_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -157,23 +171,34 @@ async def get_overflow_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace_async - async def get_underflow_date(self, **kwargs: Any) -> datetime.date: + async def get_underflow_date( + self, + **kwargs: Any + ) -> datetime.date: """Get underflow date value. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_underflow_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_underflow_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -191,8 +216,14 @@ async def get_underflow_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace_async - async def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: + async def put_max_date( + self, + date_body: datetime.date, + **kwargs: Any + ) -> None: """Put max date value 9999-12-31. :param date_body: date body. @@ -201,11 +232,13 @@ async def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = date_body @@ -216,7 +249,9 @@ async def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -227,23 +262,34 @@ async def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_max_date(self, **kwargs: Any) -> datetime.date: + async def get_max_date( + self, + **kwargs: Any + ) -> datetime.date: """Get max date value 9999-12-31. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_max_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_max_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -261,8 +307,14 @@ async def get_max_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace_async - async def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: + async def put_min_date( + self, + date_body: datetime.date, + **kwargs: Any + ) -> None: """Put min date value 0000-01-01. :param date_body: date body. @@ -271,11 +323,13 @@ async def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = date_body @@ -286,7 +340,9 @@ async def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -297,23 +353,34 @@ async def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_min_date(self, **kwargs: Any) -> datetime.date: + async def get_min_date( + self, + **kwargs: Any + ) -> datetime.date: """Get min date value 0000-01-01. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_min_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_min_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -330,3 +397,5 @@ async def get_min_date(self, **kwargs: Any) -> datetime.date: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/__init__.py index 3ddacb54784..438432b19c7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DateOperations __all__ = [ - "DateOperations", + 'DateOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py index 93376c00b2e..a7779d7108c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py @@ -9,130 +9,187 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_date_get_null_request(**kwargs: Any) -> HttpRequest: +def build_date_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/null" + url = '/date/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_get_invalid_date_request(**kwargs: Any) -> HttpRequest: +def build_date_get_invalid_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/invaliddate" + url = '/date/invaliddate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_get_overflow_date_request(**kwargs: Any) -> HttpRequest: +def build_date_get_overflow_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/overflowdate" + url = '/date/overflowdate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_get_underflow_date_request(**kwargs: Any) -> HttpRequest: +def build_date_get_underflow_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/underflowdate" + url = '/date/underflowdate' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_put_max_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_date_put_max_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/date/max" + url = '/date/max' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_date_get_max_date_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_date_get_max_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/max" + url = '/date/max' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_date_put_min_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_date_put_min_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/date/min" + url = '/date/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_date_get_min_date_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_date_get_min_date_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/date/min" + url = '/date/min' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class DateOperations(object): """DateOperations operations. @@ -153,22 +210,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[datetime.date]: + def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.date]: """Get null date value. :return: date or None :rtype: ~datetime.date or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -186,23 +252,34 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.date]: return deserialized + + @distributed_trace - def get_invalid_date(self, **kwargs: Any) -> datetime.date: + def get_invalid_date( + self, + **kwargs: Any + ) -> datetime.date: """Get invalid date value. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_invalid_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_invalid_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -220,23 +297,34 @@ def get_invalid_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace - def get_overflow_date(self, **kwargs: Any) -> datetime.date: + def get_overflow_date( + self, + **kwargs: Any + ) -> datetime.date: """Get overflow date value. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_overflow_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_overflow_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -254,23 +342,34 @@ def get_overflow_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace - def get_underflow_date(self, **kwargs: Any) -> datetime.date: + def get_underflow_date( + self, + **kwargs: Any + ) -> datetime.date: """Get underflow date value. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_underflow_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_underflow_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -288,8 +387,14 @@ def get_underflow_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace - def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: + def put_max_date( + self, + date_body: datetime.date, + **kwargs: Any + ) -> None: """Put max date value 9999-12-31. :param date_body: date body. @@ -298,11 +403,13 @@ def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = date_body @@ -313,7 +420,9 @@ def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -324,23 +433,34 @@ def put_max_date(self, date_body: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_max_date(self, **kwargs: Any) -> datetime.date: + def get_max_date( + self, + **kwargs: Any + ) -> datetime.date: """Get max date value 9999-12-31. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_max_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_max_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -358,8 +478,14 @@ def get_max_date(self, **kwargs: Any) -> datetime.date: return deserialized + + @distributed_trace - def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: + def put_min_date( + self, + date_body: datetime.date, + **kwargs: Any + ) -> None: """Put min date value 0000-01-01. :param date_body: date body. @@ -368,11 +494,13 @@ def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = date_body @@ -383,7 +511,9 @@ def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -394,23 +524,34 @@ def put_min_date(self, date_body: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_min_date(self, **kwargs: Any) -> datetime.date: + def get_min_date( + self, + **kwargs: Any + ) -> datetime.date: """Get min date value 0000-01-01. :return: date :rtype: ~datetime.date :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.date] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_date_get_min_date_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.date] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_date_get_min_date_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -427,3 +568,5 @@ def get_min_date(self, **kwargs: Any) -> datetime.date: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py index 1b7756a102f..5ac60578073 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/__init__.py index b6681846f67..7cfdf1acafa 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATDictionaryService"] +__all__ = ['AutoRestSwaggerBATDictionaryService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_auto_rest_swagger_ba_tdictionary_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_auto_rest_swagger_ba_tdictionary_service.py index 70be02c9a9f..9a767785d3c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_auto_rest_swagger_ba_tdictionary_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_auto_rest_swagger_ba_tdictionary_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATDictionaryService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,8 +29,13 @@ class AutoRestSwaggerBATDictionaryService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATDictionaryServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_configuration.py index cff1e0e3d53..e6a19dec6f6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): # pylint attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATDictionaryServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatdictionaryservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatdictionaryservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/__init__.py index ed2c0ce5f1a..b6ad0df5d3f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_ba_tdictionary_service import AutoRestSwaggerBATDictionaryService - -__all__ = ["AutoRestSwaggerBATDictionaryService"] +__all__ = ['AutoRestSwaggerBATDictionaryService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_auto_rest_swagger_ba_tdictionary_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_auto_rest_swagger_ba_tdictionary_service.py index edc69db2349..c020bc22018 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_auto_rest_swagger_ba_tdictionary_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_auto_rest_swagger_ba_tdictionary_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATDictionaryService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,7 +29,12 @@ class AutoRestSwaggerBATDictionaryService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATDictionaryServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_configuration.py index 7efa1013d5e..4fc9e0fc602 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATDictionaryServiceConfiguration(Configuration): # pylint attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATDictionaryServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatdictionaryservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatdictionaryservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/__init__.py index 375700b8df9..ae8e3c32a22 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DictionaryOperations __all__ = [ - "DictionaryOperations", + 'DictionaryOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py index 2e288bc3b3f..5805388942f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py @@ -9,91 +9,17 @@ import datetime from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_dictionary_get_array_empty_request, - build_dictionary_get_array_item_empty_request, - build_dictionary_get_array_item_null_request, - build_dictionary_get_array_null_request, - build_dictionary_get_array_valid_request, - build_dictionary_get_base64_url_request, - build_dictionary_get_boolean_invalid_null_request, - build_dictionary_get_boolean_invalid_string_request, - build_dictionary_get_boolean_tfft_request, - build_dictionary_get_byte_invalid_null_request, - build_dictionary_get_byte_valid_request, - build_dictionary_get_complex_empty_request, - build_dictionary_get_complex_item_empty_request, - build_dictionary_get_complex_item_null_request, - build_dictionary_get_complex_null_request, - build_dictionary_get_complex_valid_request, - build_dictionary_get_date_invalid_chars_request, - build_dictionary_get_date_invalid_null_request, - build_dictionary_get_date_time_invalid_chars_request, - build_dictionary_get_date_time_invalid_null_request, - build_dictionary_get_date_time_rfc1123_valid_request, - build_dictionary_get_date_time_valid_request, - build_dictionary_get_date_valid_request, - build_dictionary_get_dictionary_empty_request, - build_dictionary_get_dictionary_item_empty_request, - build_dictionary_get_dictionary_item_null_request, - build_dictionary_get_dictionary_null_request, - build_dictionary_get_dictionary_valid_request, - build_dictionary_get_double_invalid_null_request, - build_dictionary_get_double_invalid_string_request, - build_dictionary_get_double_valid_request, - build_dictionary_get_duration_valid_request, - build_dictionary_get_empty_request, - build_dictionary_get_empty_string_key_request, - build_dictionary_get_float_invalid_null_request, - build_dictionary_get_float_invalid_string_request, - build_dictionary_get_float_valid_request, - build_dictionary_get_int_invalid_null_request, - build_dictionary_get_int_invalid_string_request, - build_dictionary_get_integer_valid_request, - build_dictionary_get_invalid_request, - build_dictionary_get_long_invalid_null_request, - build_dictionary_get_long_invalid_string_request, - build_dictionary_get_long_valid_request, - build_dictionary_get_null_key_request, - build_dictionary_get_null_request, - build_dictionary_get_null_value_request, - build_dictionary_get_string_valid_request, - build_dictionary_get_string_with_invalid_request, - build_dictionary_get_string_with_null_request, - build_dictionary_put_array_valid_request, - build_dictionary_put_boolean_tfft_request, - build_dictionary_put_byte_valid_request, - build_dictionary_put_complex_valid_request, - build_dictionary_put_date_time_rfc1123_valid_request, - build_dictionary_put_date_time_valid_request, - build_dictionary_put_date_valid_request, - build_dictionary_put_dictionary_valid_request, - build_dictionary_put_double_valid_request, - build_dictionary_put_duration_valid_request, - build_dictionary_put_empty_request, - build_dictionary_put_float_valid_request, - build_dictionary_put_integer_valid_request, - build_dictionary_put_long_valid_request, - build_dictionary_put_string_valid_request, -) - -T = TypeVar("T") +from ...operations._operations import build_dictionary_get_array_empty_request, build_dictionary_get_array_item_empty_request, build_dictionary_get_array_item_null_request, build_dictionary_get_array_null_request, build_dictionary_get_array_valid_request, build_dictionary_get_base64_url_request, build_dictionary_get_boolean_invalid_null_request, build_dictionary_get_boolean_invalid_string_request, build_dictionary_get_boolean_tfft_request, build_dictionary_get_byte_invalid_null_request, build_dictionary_get_byte_valid_request, build_dictionary_get_complex_empty_request, build_dictionary_get_complex_item_empty_request, build_dictionary_get_complex_item_null_request, build_dictionary_get_complex_null_request, build_dictionary_get_complex_valid_request, build_dictionary_get_date_invalid_chars_request, build_dictionary_get_date_invalid_null_request, build_dictionary_get_date_time_invalid_chars_request, build_dictionary_get_date_time_invalid_null_request, build_dictionary_get_date_time_rfc1123_valid_request, build_dictionary_get_date_time_valid_request, build_dictionary_get_date_valid_request, build_dictionary_get_dictionary_empty_request, build_dictionary_get_dictionary_item_empty_request, build_dictionary_get_dictionary_item_null_request, build_dictionary_get_dictionary_null_request, build_dictionary_get_dictionary_valid_request, build_dictionary_get_double_invalid_null_request, build_dictionary_get_double_invalid_string_request, build_dictionary_get_double_valid_request, build_dictionary_get_duration_valid_request, build_dictionary_get_empty_request, build_dictionary_get_empty_string_key_request, build_dictionary_get_float_invalid_null_request, build_dictionary_get_float_invalid_string_request, build_dictionary_get_float_valid_request, build_dictionary_get_int_invalid_null_request, build_dictionary_get_int_invalid_string_request, build_dictionary_get_integer_valid_request, build_dictionary_get_invalid_request, build_dictionary_get_long_invalid_null_request, build_dictionary_get_long_invalid_string_request, build_dictionary_get_long_valid_request, build_dictionary_get_null_key_request, build_dictionary_get_null_request, build_dictionary_get_null_value_request, build_dictionary_get_string_valid_request, build_dictionary_get_string_with_invalid_request, build_dictionary_get_string_with_null_request, build_dictionary_put_array_valid_request, build_dictionary_put_boolean_tfft_request, build_dictionary_put_byte_valid_request, build_dictionary_put_complex_valid_request, build_dictionary_put_date_time_rfc1123_valid_request, build_dictionary_put_date_time_valid_request, build_dictionary_put_date_valid_request, build_dictionary_put_dictionary_valid_request, build_dictionary_put_double_valid_request, build_dictionary_put_duration_valid_request, build_dictionary_put_empty_request, build_dictionary_put_float_valid_request, build_dictionary_put_integer_valid_request, build_dictionary_put_long_valid_request, build_dictionary_put_string_valid_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DictionaryOperations: # pylint: disable=too-many-public-methods """DictionaryOperations async operations. @@ -113,7 +39,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Dict[str, int]: + async def get_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get null dictionary value. :return: dict mapping str to int @@ -128,15 +57,21 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_null_request() + + request = build_dictionary_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -154,8 +89,13 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> Dict[str, int]: + async def get_empty( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get empty dictionary value {}. :return: dict mapping str to int @@ -170,15 +110,21 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_empty_request() + + request = build_dictionary_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -196,8 +142,14 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: + async def put_empty( + self, + array_body: Dict[str, str], + **kwargs: Any + ) -> None: """Set dictionary value empty {}. :param array_body: @@ -214,11 +166,13 @@ async def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -229,7 +183,9 @@ async def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -240,8 +196,13 @@ async def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: + async def get_null_value( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with null value. :return: dict mapping str to str @@ -256,15 +217,21 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_null_value_request() + + request = build_dictionary_get_null_value_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -282,8 +249,13 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace_async - async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: + async def get_null_key( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with null key. :return: dict mapping str to str @@ -298,15 +270,21 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_null_key_request() + + request = build_dictionary_get_null_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -324,8 +302,13 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace_async - async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: + async def get_empty_string_key( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with key as empty string. :return: dict mapping str to str @@ -340,15 +323,21 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_empty_string_key_request() + + request = build_dictionary_get_empty_string_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -366,8 +355,13 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: + async def get_invalid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get invalid Dictionary value. :return: dict mapping str to str @@ -382,15 +376,21 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_invalid_request() + + request = build_dictionary_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -408,8 +408,13 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace_async - async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: + async def get_boolean_tfft( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true }. :return: dict mapping str to bool @@ -424,15 +429,21 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_boolean_tfft_request() + + request = build_dictionary_get_boolean_tfft_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -450,8 +461,14 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: return deserialized + + @distributed_trace_async - async def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> None: + async def put_boolean_tfft( + self, + array_body: Dict[str, bool], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. :param array_body: @@ -468,11 +485,13 @@ async def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -483,7 +502,9 @@ async def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -494,8 +515,13 @@ async def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: + async def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value {"0": true, "1": null, "2": false }. :return: dict mapping str to bool @@ -510,15 +536,21 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_boolean_invalid_null_request() + + request = build_dictionary_get_boolean_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -536,8 +568,13 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: return deserialized + + @distributed_trace_async - async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: + async def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}'. :return: dict mapping str to bool @@ -552,15 +589,21 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_boolean_invalid_string_request() + + request = build_dictionary_get_boolean_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -578,8 +621,13 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: return deserialized + + @distributed_trace_async - async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: + async def get_integer_valid( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. :return: dict mapping str to int @@ -594,15 +642,21 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_integer_valid_request() + + request = build_dictionary_get_integer_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -620,8 +674,14 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: + async def put_integer_valid( + self, + array_body: Dict[str, int], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. :param array_body: @@ -638,11 +698,13 @@ async def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -653,7 +715,9 @@ async def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -664,8 +728,13 @@ async def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: + async def get_int_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": null, "2": 0}. :return: dict mapping str to int @@ -680,15 +749,21 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_int_invalid_null_request() + + request = build_dictionary_get_int_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -706,8 +781,13 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: + async def get_int_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": "integer", "2": 0}. :return: dict mapping str to int @@ -722,15 +802,21 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_int_invalid_string_request() + + request = build_dictionary_get_int_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -748,8 +834,13 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: + async def get_long_valid( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. :return: dict mapping str to long @@ -764,15 +855,21 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_long_valid_request() + + request = build_dictionary_get_long_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -790,8 +887,14 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: + async def put_long_valid( + self, + array_body: Dict[str, int], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. :param array_body: @@ -808,11 +911,13 @@ async def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> Non "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -823,7 +928,9 @@ async def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> Non request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -834,8 +941,13 @@ async def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: + async def get_long_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get long dictionary value {"0": 1, "1": null, "2": 0}. :return: dict mapping str to long @@ -850,15 +962,21 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_long_invalid_null_request() + + request = build_dictionary_get_long_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -876,8 +994,13 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: + async def get_long_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get long dictionary value {"0": 1, "1": "integer", "2": 0}. :return: dict mapping str to long @@ -892,15 +1015,21 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_long_invalid_string_request() + + request = build_dictionary_get_long_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -918,8 +1047,13 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace_async - async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: + async def get_float_valid( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :return: dict mapping str to float @@ -934,15 +1068,21 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_float_valid_request() + + request = build_dictionary_get_float_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -960,8 +1100,14 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace_async - async def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: + async def put_float_valid( + self, + array_body: Dict[str, float], + **kwargs: Any + ) -> None: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :param array_body: @@ -978,11 +1124,13 @@ async def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -993,7 +1141,9 @@ async def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1004,8 +1154,13 @@ async def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: + async def get_float_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. :return: dict mapping str to float @@ -1020,15 +1175,21 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_float_invalid_null_request() + + request = build_dictionary_get_float_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1046,8 +1207,13 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace_async - async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: + async def get_float_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. :return: dict mapping str to float @@ -1062,15 +1228,21 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_float_invalid_string_request() + + request = build_dictionary_get_float_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1088,8 +1260,13 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace_async - async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: + async def get_double_valid( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :return: dict mapping str to float @@ -1104,15 +1281,21 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_double_valid_request() + + request = build_dictionary_get_double_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1130,8 +1313,14 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace_async - async def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: + async def put_double_valid( + self, + array_body: Dict[str, float], + **kwargs: Any + ) -> None: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :param array_body: @@ -1148,11 +1337,13 @@ async def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1163,7 +1354,9 @@ async def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1174,8 +1367,13 @@ async def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: + async def get_double_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. :return: dict mapping str to float @@ -1190,15 +1388,21 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_double_invalid_null_request() + + request = build_dictionary_get_double_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1216,8 +1420,13 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace_async - async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: + async def get_double_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. :return: dict mapping str to float @@ -1232,15 +1441,21 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_double_invalid_string_request() + + request = build_dictionary_get_double_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1258,8 +1473,13 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace_async - async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: + async def get_string_valid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. :return: dict mapping str to str @@ -1274,15 +1494,21 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_string_valid_request() + + request = build_dictionary_get_string_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1300,8 +1526,14 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace_async - async def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> None: + async def put_string_valid( + self, + array_body: Dict[str, str], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. :param array_body: @@ -1318,11 +1550,13 @@ async def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> N "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1333,7 +1567,9 @@ async def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1344,8 +1580,13 @@ async def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: + async def get_string_with_null( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo", "1": null, "2": "foo2"}. :return: dict mapping str to str @@ -1360,15 +1601,21 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_string_with_null_request() + + request = build_dictionary_get_string_with_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1386,8 +1633,13 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace_async - async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: + async def get_string_with_invalid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"}. :return: dict mapping str to str @@ -1402,15 +1654,21 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_string_with_invalid_request() + + request = build_dictionary_get_string_with_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1428,8 +1686,13 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace_async - async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: + async def get_date_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. :return: dict mapping str to date @@ -1444,15 +1707,21 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_date_valid_request() + + request = build_dictionary_get_date_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1470,8 +1739,14 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: return deserialized + + @distributed_trace_async - async def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: Any) -> None: + async def put_date_valid( + self, + array_body: Dict[str, datetime.date], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. :param array_body: @@ -1488,11 +1763,13 @@ async def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: A "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1503,7 +1780,9 @@ async def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: A request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1514,8 +1793,13 @@ async def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: + async def get_date_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"}. :return: dict mapping str to date @@ -1530,15 +1814,21 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_date_invalid_null_request() + + request = build_dictionary_get_date_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1556,8 +1846,13 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] return deserialized + + @distributed_trace_async - async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: + async def get_date_invalid_chars( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get date dictionary value {"0": "2011-03-22", "1": "date"}. :return: dict mapping str to date @@ -1572,15 +1867,21 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_date_invalid_chars_request() + + request = build_dictionary_get_date_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1598,8 +1899,13 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date return deserialized + + @distributed_trace_async - async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1615,15 +1921,21 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_date_time_valid_request() + + request = build_dictionary_get_date_time_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1641,8 +1953,14 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim return deserialized + + @distributed_trace_async - async def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_valid( + self, + array_body: Dict[str, datetime.datetime], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1660,11 +1978,13 @@ async def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], ** "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1675,7 +1995,9 @@ async def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1686,8 +2008,13 @@ async def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null}. :return: dict mapping str to datetime @@ -1702,15 +2029,21 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_date_time_invalid_null_request() + + request = build_dictionary_get_date_time_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1728,8 +2061,13 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. return deserialized + + @distributed_trace_async - async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}. :return: dict mapping str to datetime @@ -1744,15 +2082,21 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_date_time_invalid_chars_request() + + request = build_dictionary_get_date_time_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1770,8 +2114,13 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime return deserialized + + @distributed_trace_async - async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + async def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1787,15 +2136,21 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_date_time_rfc1123_valid_request() + + request = build_dictionary_get_date_time_rfc1123_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1813,8 +2168,14 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime return deserialized + + @distributed_trace_async - async def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datetime], **kwargs: Any) -> None: + async def put_date_time_rfc1123_valid( + self, + array_body: Dict[str, datetime.datetime], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1832,11 +2193,13 @@ async def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datet "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1847,7 +2210,9 @@ async def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datet request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1858,8 +2223,13 @@ async def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datet if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: + async def get_duration_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.timedelta]: """Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. :return: dict mapping str to timedelta @@ -1874,15 +2244,21 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt "str": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_duration_valid_request() + + request = build_dictionary_get_duration_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1900,8 +2276,14 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt return deserialized + + @distributed_trace_async - async def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], **kwargs: Any) -> None: + async def put_duration_valid( + self, + array_body: Dict[str, datetime.timedelta], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. :param array_body: @@ -1918,11 +2300,13 @@ async def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], ** "str": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1933,7 +2317,9 @@ async def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1944,8 +2330,13 @@ async def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: + async def get_byte_valid( + self, + **kwargs: Any + ) -> Dict[str, bytearray]: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each item encoded in base64. @@ -1961,15 +2352,21 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: "str": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_byte_valid_request() + + request = build_dictionary_get_byte_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1987,8 +2384,14 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: return deserialized + + @distributed_trace_async - async def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) -> None: + async def put_byte_valid( + self, + array_body: Dict[str, bytearray], + **kwargs: Any + ) -> None: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -2006,11 +2409,13 @@ async def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) "str": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2021,7 +2426,9 @@ async def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2032,8 +2439,13 @@ async def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: + async def get_byte_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, bytearray]: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 encoded. @@ -2049,15 +2461,21 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: "str": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_byte_invalid_null_request() + + request = build_dictionary_get_byte_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2075,8 +2493,13 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: return deserialized + + @distributed_trace_async - async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: + async def get_base64_url( + self, + **kwargs: Any + ) -> Dict[str, bytes]: """Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test string", "2": "Lorem ipsum"}. @@ -2092,15 +2515,21 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_base64_url_request() + + request = build_dictionary_get_base64_url_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2118,8 +2547,13 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: return deserialized + + @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSONType]]: + async def get_complex_null( + self, + **kwargs: Any + ) -> Optional[Dict[str, JSONType]]: """Get dictionary of complex type null value. :return: dict mapping str to JSON object or None @@ -2137,15 +2571,21 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSONType]] } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, JSONType]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, JSONType]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_complex_null_request() + + request = build_dictionary_get_complex_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2163,8 +2603,13 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSONType]] return deserialized + + @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSONType]: + async def get_complex_empty( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get empty dictionary of complex type {}. :return: dict mapping str to JSON object @@ -2182,15 +2627,21 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_complex_empty_request() + + request = build_dictionary_get_complex_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2208,8 +2659,13 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSONType]: + async def get_complex_item_null( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}}. @@ -2228,15 +2684,21 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_complex_item_null_request() + + request = build_dictionary_get_complex_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2254,8 +2716,13 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSONType]: + async def get_complex_item_empty( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}}. @@ -2274,15 +2741,21 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_complex_item_empty_request() + + request = build_dictionary_get_complex_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2300,8 +2773,13 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSONType]: + async def get_complex_valid( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2320,15 +2798,21 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_complex_valid_request() + + request = build_dictionary_get_complex_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2346,8 +2830,14 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace_async - async def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any) -> None: + async def put_complex_valid( + self, + array_body: Dict[str, JSONType], + **kwargs: Any + ) -> None: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2368,11 +2858,13 @@ async def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2383,7 +2875,9 @@ async def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2394,8 +2888,13 @@ async def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: + async def get_array_null( + self, + **kwargs: Any + ) -> Optional[Dict[str, List[str]]]: """Get a null array. :return: dict mapping str to list of str or None @@ -2412,15 +2911,21 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, List[str]]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, List[str]]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_array_null_request() + + request = build_dictionary_get_array_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2438,8 +2943,13 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: return deserialized + + @distributed_trace_async - async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_empty( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an empty dictionary {}. :return: dict mapping str to list of str @@ -2456,15 +2966,21 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_array_empty_request() + + request = build_dictionary_get_array_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2482,8 +2998,13 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace_async - async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_item_null( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]}. :return: dict mapping str to list of str @@ -2500,15 +3021,21 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_array_item_null_request() + + request = build_dictionary_get_array_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2526,8 +3053,13 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace_async - async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_item_empty( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}. :return: dict mapping str to list of str @@ -2544,15 +3076,21 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_array_item_empty_request() + + request = build_dictionary_get_array_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2570,8 +3108,13 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace_async - async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: + async def get_array_valid( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2589,15 +3132,21 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_array_valid_request() + + request = build_dictionary_get_array_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2615,8 +3164,14 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace_async - async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) -> None: + async def put_array_valid( + self, + array_body: Dict[str, List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2636,11 +3191,13 @@ async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2651,7 +3208,9 @@ async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2662,8 +3221,13 @@ async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_null( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries with value null. :return: dict mapping str to dict mapping str to str @@ -2680,15 +3244,21 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_dictionary_null_request() + + request = build_dictionary_get_dictionary_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2706,8 +3276,13 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: return deserialized + + @distributed_trace_async - async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_empty( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {}. :return: dict mapping str to dict mapping str to str @@ -2724,15 +3299,21 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_dictionary_empty_request() + + request = build_dictionary_get_dictionary_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2750,8 +3331,13 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] return deserialized + + @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_item_null( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2769,15 +3355,21 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_dictionary_item_null_request() + + request = build_dictionary_get_dictionary_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2795,8 +3387,13 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s return deserialized + + @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2814,15 +3411,21 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_dictionary_item_empty_request() + + request = build_dictionary_get_dictionary_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2840,8 +3443,13 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, return deserialized + + @distributed_trace_async - async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + async def get_dictionary_valid( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2860,15 +3468,21 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_dictionary_get_dictionary_valid_request() + + request = build_dictionary_get_dictionary_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2886,8 +3500,14 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] return deserialized + + @distributed_trace_async - async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kwargs: Any) -> None: + async def put_dictionary_valid( + self, + array_body: Dict[str, Dict[str, str]], + **kwargs: Any + ) -> None: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2908,11 +3528,13 @@ async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kw } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2923,7 +3545,9 @@ async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kw request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2933,3 +3557,5 @@ async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kw if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/__init__.py index 375700b8df9..ae8e3c32a22 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DictionaryOperations __all__ = [ - "DictionaryOperations", + 'DictionaryOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py index 33d5c3dbeaf..af1250420f8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py @@ -9,894 +9,1387 @@ import datetime from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_dictionary_get_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/null" + url = '/dictionary/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/empty" + url = '/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_put_empty_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_dictionary_put_empty_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/empty" + url = '/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_null_value_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_null_value_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/nullvalue" + url = '/dictionary/nullvalue' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_null_key_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_null_key_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/nullkey" + url = '/dictionary/nullkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_empty_string_key_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_empty_string_key_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/keyemptystring" + url = '/dictionary/keyemptystring' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/invalid" + url = '/dictionary/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_boolean_tfft_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/tfft" + url = '/dictionary/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_boolean_tfft_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/tfft" + url = '/dictionary/prim/boolean/tfft' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_boolean_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/true.null.false" + url = '/dictionary/prim/boolean/true.null.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_boolean_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/boolean/true.boolean.false" + url = '/dictionary/prim/boolean/true.boolean.false' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_integer_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_integer_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.-1.3.300" + url = '/dictionary/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_integer_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.-1.3.300" + url = '/dictionary/prim/integer/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_int_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.null.zero" + url = '/dictionary/prim/integer/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_int_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/integer/1.integer.0" + url = '/dictionary/prim/integer/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_long_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_long_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.-1.3.300" + url = '/dictionary/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_long_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.-1.3.300" + url = '/dictionary/prim/long/1.-1.3.300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_long_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.null.zero" + url = '/dictionary/prim/long/1.null.zero' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_long_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/long/1.integer.0" + url = '/dictionary/prim/long/1.integer.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_float_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_float_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/float/0--0.01-1.2e20" + url = '/dictionary/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_float_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/float/0--0.01-1.2e20" + url = '/dictionary/prim/float/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_float_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/float/0.0-null-1.2e20" + url = '/dictionary/prim/float/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_float_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/float/1.number.0" + url = '/dictionary/prim/float/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_double_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_double_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/double/0--0.01-1.2e20" + url = '/dictionary/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_double_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/double/0--0.01-1.2e20" + url = '/dictionary/prim/double/0--0.01-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_double_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/double/0.0-null-1.2e20" + url = '/dictionary/prim/double/0.0-null-1.2e20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_double_invalid_string_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/double/1.number.0" + url = '/dictionary/prim/double/1.number.0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_string_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_string_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo1.foo2.foo3" + url = '/dictionary/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_string_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo1.foo2.foo3" + url = '/dictionary/prim/string/foo1.foo2.foo3' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_string_with_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_string_with_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo.null.foo2" + url = '/dictionary/prim/string/foo.null.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_string_with_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/string/foo.123.foo2" + url = '/dictionary/prim/string/foo.123.foo2' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_date_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_date_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date/valid" + url = '/dictionary/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_date_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/date/valid" + url = '/dictionary/prim/date/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_date_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date/invalidnull" + url = '/dictionary/prim/date/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_date_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date/invalidchars" + url = '/dictionary/prim/date/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/valid" + url = '/dictionary/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_date_time_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/valid" + url = '/dictionary/prim/date-time/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_date_time_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/invalidnull" + url = '/dictionary/prim/date-time/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_date_time_invalid_chars_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time/invalidchars" + url = '/dictionary/prim/date-time/invalidchars' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_date_time_rfc1123_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time-rfc1123/valid" + url = '/dictionary/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_date_time_rfc1123_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/date-time-rfc1123/valid" + url = '/dictionary/prim/date-time-rfc1123/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_duration_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_duration_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/duration/valid" + url = '/dictionary/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_duration_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/duration/valid" + url = '/dictionary/prim/duration/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_byte_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_byte_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/byte/valid" + url = '/dictionary/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_byte_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/prim/byte/valid" + url = '/dictionary/prim/byte/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_byte_invalid_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/byte/invalidnull" + url = '/dictionary/prim/byte/invalidnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_base64_url_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_base64_url_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/prim/base64url/valid" + url = '/dictionary/prim/base64url/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_complex_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_complex_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/null" + url = '/dictionary/complex/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_complex_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_complex_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/empty" + url = '/dictionary/complex/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_complex_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/itemnull" + url = '/dictionary/complex/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_complex_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/itemempty" + url = '/dictionary/complex/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_complex_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_complex_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/complex/valid" + url = '/dictionary/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_complex_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/complex/valid" + url = '/dictionary/complex/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_array_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_array_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/null" + url = '/dictionary/array/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_array_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_array_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/empty" + url = '/dictionary/array/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_array_item_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_array_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/itemnull" + url = '/dictionary/array/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_array_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/itemempty" + url = '/dictionary/array/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_array_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_array_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/array/valid" + url = '/dictionary/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_array_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/array/valid" + url = '/dictionary/array/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_dictionary_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_dictionary_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/null" + url = '/dictionary/dictionary/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_dictionary_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/empty" + url = '/dictionary/dictionary/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_dictionary_item_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/itemnull" + url = '/dictionary/dictionary/itemnull' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_dictionary_item_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/itemempty" + url = '/dictionary/dictionary/itemempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_dictionary_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: +def build_dictionary_get_dictionary_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/dictionary/dictionary/valid" + url = '/dictionary/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_dictionary_put_dictionary_valid_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/dictionary/dictionary/valid" + url = '/dictionary/dictionary/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DictionaryOperations(object): # pylint: disable=too-many-public-methods """DictionaryOperations operations. @@ -917,7 +1410,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Dict[str, int]: + def get_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get null dictionary value. :return: dict mapping str to int @@ -932,15 +1428,21 @@ def get_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -958,8 +1460,13 @@ def get_null(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def get_empty(self, **kwargs: Any) -> Dict[str, int]: + def get_empty( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get empty dictionary value {}. :return: dict mapping str to int @@ -974,15 +1481,21 @@ def get_empty(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1000,8 +1513,14 @@ def get_empty(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: + def put_empty( + self, + array_body: Dict[str, str], + **kwargs: Any + ) -> None: """Set dictionary value empty {}. :param array_body: @@ -1018,11 +1537,13 @@ def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1033,7 +1554,9 @@ def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1044,8 +1567,13 @@ def put_empty(self, array_body: Dict[str, str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_null_value(self, **kwargs: Any) -> Dict[str, str]: + def get_null_value( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with null value. :return: dict mapping str to str @@ -1060,15 +1588,21 @@ def get_null_value(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_null_value_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_null_value_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1086,8 +1620,13 @@ def get_null_value(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace - def get_null_key(self, **kwargs: Any) -> Dict[str, str]: + def get_null_key( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with null key. :return: dict mapping str to str @@ -1102,15 +1641,21 @@ def get_null_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_null_key_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_null_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1128,8 +1673,13 @@ def get_null_key(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace - def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: + def get_empty_string_key( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get Dictionary with key as empty string. :return: dict mapping str to str @@ -1144,15 +1694,21 @@ def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_empty_string_key_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_empty_string_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1170,8 +1726,13 @@ def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> Dict[str, str]: + def get_invalid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get invalid Dictionary value. :return: dict mapping str to str @@ -1186,15 +1747,21 @@ def get_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1212,8 +1779,13 @@ def get_invalid(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace - def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: + def get_boolean_tfft( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true }. :return: dict mapping str to bool @@ -1228,15 +1800,21 @@ def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_boolean_tfft_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_boolean_tfft_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1254,8 +1832,14 @@ def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: return deserialized + + @distributed_trace - def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> None: + def put_boolean_tfft( + self, + array_body: Dict[str, bool], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. :param array_body: @@ -1272,11 +1856,13 @@ def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> None: "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1287,7 +1873,9 @@ def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1298,8 +1886,13 @@ def put_boolean_tfft(self, array_body: Dict[str, bool], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: + def get_boolean_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value {"0": true, "1": null, "2": false }. :return: dict mapping str to bool @@ -1314,15 +1907,21 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_boolean_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_boolean_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1340,8 +1939,13 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: return deserialized + + @distributed_trace - def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: + def get_boolean_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, bool]: """Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}'. :return: dict mapping str to bool @@ -1356,15 +1960,21 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bool]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_boolean_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bool]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_boolean_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1382,8 +1992,13 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: return deserialized + + @distributed_trace - def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: + def get_integer_valid( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. :return: dict mapping str to int @@ -1398,15 +2013,21 @@ def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_integer_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_integer_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1424,8 +2045,14 @@ def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: + def put_integer_valid( + self, + array_body: Dict[str, int], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. :param array_body: @@ -1442,11 +2069,13 @@ def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1457,7 +2086,9 @@ def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1468,8 +2099,13 @@ def put_integer_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: + def get_int_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": null, "2": 0}. :return: dict mapping str to int @@ -1484,15 +2120,21 @@ def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_int_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_int_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1510,8 +2152,13 @@ def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: + def get_int_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": "integer", "2": 0}. :return: dict mapping str to int @@ -1526,15 +2173,21 @@ def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_int_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_int_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1552,8 +2205,13 @@ def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: + def get_long_valid( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. :return: dict mapping str to long @@ -1568,15 +2226,21 @@ def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_long_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_long_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1594,8 +2258,14 @@ def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: + def put_long_valid( + self, + array_body: Dict[str, int], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. :param array_body: @@ -1612,11 +2282,13 @@ def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1627,7 +2299,9 @@ def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1638,8 +2312,13 @@ def put_long_valid(self, array_body: Dict[str, int], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: + def get_long_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get long dictionary value {"0": 1, "1": null, "2": 0}. :return: dict mapping str to long @@ -1654,15 +2333,21 @@ def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_long_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_long_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1680,8 +2365,13 @@ def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: + def get_long_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, int]: """Get long dictionary value {"0": 1, "1": "integer", "2": 0}. :return: dict mapping str to long @@ -1696,15 +2386,21 @@ def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_long_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_long_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1722,8 +2418,13 @@ def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: return deserialized + + @distributed_trace - def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: + def get_float_valid( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :return: dict mapping str to float @@ -1738,15 +2439,21 @@ def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_float_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_float_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1764,8 +2471,14 @@ def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace - def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: + def put_float_valid( + self, + array_body: Dict[str, float], + **kwargs: Any + ) -> None: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :param array_body: @@ -1782,11 +2495,13 @@ def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1797,7 +2512,9 @@ def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1808,8 +2525,13 @@ def put_float_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: + def get_float_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. :return: dict mapping str to float @@ -1824,15 +2546,21 @@ def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_float_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_float_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1850,8 +2578,13 @@ def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace - def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: + def get_float_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. :return: dict mapping str to float @@ -1866,15 +2599,21 @@ def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_float_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_float_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1892,8 +2631,13 @@ def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace - def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: + def get_double_valid( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :return: dict mapping str to float @@ -1908,15 +2652,21 @@ def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_double_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_double_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1934,8 +2684,14 @@ def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace - def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: + def put_double_valid( + self, + array_body: Dict[str, float], + **kwargs: Any + ) -> None: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. :param array_body: @@ -1952,11 +2708,13 @@ def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -1967,7 +2725,9 @@ def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1978,8 +2738,13 @@ def put_double_valid(self, array_body: Dict[str, float], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: + def get_double_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. :return: dict mapping str to float @@ -1994,15 +2759,21 @@ def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_double_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_double_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2020,8 +2791,13 @@ def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace - def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: + def get_double_invalid_string( + self, + **kwargs: Any + ) -> Dict[str, float]: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. :return: dict mapping str to float @@ -2036,15 +2812,21 @@ def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_double_invalid_string_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_double_invalid_string_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2062,8 +2844,13 @@ def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: return deserialized + + @distributed_trace - def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: + def get_string_valid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. :return: dict mapping str to str @@ -2078,15 +2865,21 @@ def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_string_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_string_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2104,8 +2897,14 @@ def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace - def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> None: + def put_string_valid( + self, + array_body: Dict[str, str], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. :param array_body: @@ -2122,11 +2921,13 @@ def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> None: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2137,7 +2938,9 @@ def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2148,8 +2951,13 @@ def put_string_valid(self, array_body: Dict[str, str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: + def get_string_with_null( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo", "1": null, "2": "foo2"}. :return: dict mapping str to str @@ -2164,15 +2972,21 @@ def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_string_with_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_string_with_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2190,8 +3004,13 @@ def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace - def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: + def get_string_with_invalid( + self, + **kwargs: Any + ) -> Dict[str, str]: """Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"}. :return: dict mapping str to str @@ -2206,15 +3025,21 @@ def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_string_with_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_string_with_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2232,8 +3057,13 @@ def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: return deserialized + + @distributed_trace - def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: + def get_date_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. :return: dict mapping str to date @@ -2248,15 +3078,21 @@ def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_date_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_date_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2274,8 +3110,14 @@ def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: return deserialized + + @distributed_trace - def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: Any) -> None: + def put_date_valid( + self, + array_body: Dict[str, datetime.date], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. :param array_body: @@ -2292,11 +3134,13 @@ def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: Any) -> "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2307,7 +3151,9 @@ def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2318,8 +3164,13 @@ def put_date_valid(self, array_body: Dict[str, datetime.date], **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: + def get_date_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"}. :return: dict mapping str to date @@ -2334,15 +3185,21 @@ def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_date_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_date_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2360,8 +3217,13 @@ def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: return deserialized + + @distributed_trace - def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: + def get_date_invalid_chars( + self, + **kwargs: Any + ) -> Dict[str, datetime.date]: """Get date dictionary value {"0": "2011-03-22", "1": "date"}. :return: dict mapping str to date @@ -2376,15 +3238,21 @@ def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.date]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_date_invalid_chars_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.date]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_date_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2402,8 +3270,13 @@ def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: return deserialized + + @distributed_trace - def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + def get_date_time_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -2419,15 +3292,21 @@ def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_date_time_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_date_time_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2445,8 +3324,14 @@ def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: return deserialized + + @distributed_trace - def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], **kwargs: Any) -> None: + def put_date_time_valid( + self, + array_body: Dict[str, datetime.datetime], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -2464,11 +3349,13 @@ def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], **kwargs "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2479,7 +3366,9 @@ def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2490,8 +3379,13 @@ def put_date_time_valid(self, array_body: Dict[str, datetime.datetime], **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + def get_date_time_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null}. :return: dict mapping str to datetime @@ -2506,15 +3400,21 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.dateti "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_date_time_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_date_time_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2532,8 +3432,13 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.dateti return deserialized + + @distributed_trace - def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + def get_date_time_invalid_chars( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}. :return: dict mapping str to datetime @@ -2548,15 +3453,21 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datet "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_date_time_invalid_chars_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_date_time_invalid_chars_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2574,8 +3485,13 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datet return deserialized + + @distributed_trace - def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: + def get_date_time_rfc1123_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.datetime]: """Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -2591,15 +3507,21 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datet "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_date_time_rfc1123_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_date_time_rfc1123_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2617,8 +3539,14 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datet return deserialized + + @distributed_trace - def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datetime], **kwargs: Any) -> None: + def put_date_time_rfc1123_valid( + self, + array_body: Dict[str, datetime.datetime], + **kwargs: Any + ) -> None: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -2636,11 +3564,13 @@ def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datetime], "str": "2020-02-20 00:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2651,7 +3581,9 @@ def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datetime], request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2662,8 +3594,13 @@ def put_date_time_rfc1123_valid(self, array_body: Dict[str, datetime.datetime], if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: + def get_duration_valid( + self, + **kwargs: Any + ) -> Dict[str, datetime.timedelta]: """Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. :return: dict mapping str to timedelta @@ -2678,15 +3615,21 @@ def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: "str": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_duration_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_duration_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2704,8 +3647,14 @@ def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: return deserialized + + @distributed_trace - def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], **kwargs: Any) -> None: + def put_duration_valid( + self, + array_body: Dict[str, datetime.timedelta], + **kwargs: Any + ) -> None: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. :param array_body: @@ -2722,11 +3671,13 @@ def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], **kwargs "str": "1 day, 0:00:00" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2737,7 +3688,9 @@ def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2748,8 +3701,13 @@ def put_duration_valid(self, array_body: Dict[str, datetime.timedelta], **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: + def get_byte_valid( + self, + **kwargs: Any + ) -> Dict[str, bytearray]: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each item encoded in base64. @@ -2765,15 +3723,21 @@ def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: "str": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_byte_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_byte_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2791,8 +3755,14 @@ def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytearray]: return deserialized + + @distributed_trace - def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) -> None: + def put_byte_valid( + self, + array_body: Dict[str, bytearray], + **kwargs: Any + ) -> None: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -2810,11 +3780,13 @@ def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) -> Non "str": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -2825,7 +3797,9 @@ def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) -> Non request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2836,8 +3810,13 @@ def put_byte_valid(self, array_body: Dict[str, bytearray], **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: + def get_byte_invalid_null( + self, + **kwargs: Any + ) -> Dict[str, bytearray]: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 encoded. @@ -2853,15 +3832,21 @@ def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: "str": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytearray]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_byte_invalid_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytearray]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_byte_invalid_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2879,8 +3864,13 @@ def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytearray]: return deserialized + + @distributed_trace - def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: + def get_base64_url( + self, + **kwargs: Any + ) -> Dict[str, bytes]: """Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test string", "2": "Lorem ipsum"}. @@ -2896,15 +3886,21 @@ def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_base64_url_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_base64_url_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2922,8 +3918,13 @@ def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: return deserialized + + @distributed_trace - def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSONType]]: + def get_complex_null( + self, + **kwargs: Any + ) -> Optional[Dict[str, JSONType]]: """Get dictionary of complex type null value. :return: dict mapping str to JSON object or None @@ -2941,15 +3942,21 @@ def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSONType]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, JSONType]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_complex_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, JSONType]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_complex_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2967,8 +3974,13 @@ def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSONType]]: return deserialized + + @distributed_trace - def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSONType]: + def get_complex_empty( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get empty dictionary of complex type {}. :return: dict mapping str to JSON object @@ -2986,15 +3998,21 @@ def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_complex_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_complex_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3012,8 +4030,13 @@ def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace - def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSONType]: + def get_complex_item_null( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}}. @@ -3032,15 +4055,21 @@ def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_complex_item_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_complex_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3058,8 +4087,13 @@ def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace - def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSONType]: + def get_complex_item_empty( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}}. @@ -3078,15 +4112,21 @@ def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_complex_item_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_complex_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3104,8 +4144,13 @@ def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace - def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSONType]: + def get_complex_valid( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -3124,15 +4169,21 @@ def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_complex_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_complex_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3150,8 +4201,14 @@ def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace - def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any) -> None: + def put_complex_valid( + self, + array_body: Dict[str, JSONType], + **kwargs: Any + ) -> None: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -3172,11 +4229,13 @@ def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any) -> N } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3187,7 +4246,9 @@ def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3198,8 +4259,13 @@ def put_complex_valid(self, array_body: Dict[str, JSONType], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: + def get_array_null( + self, + **kwargs: Any + ) -> Optional[Dict[str, List[str]]]: """Get a null array. :return: dict mapping str to list of str or None @@ -3216,15 +4282,21 @@ def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[Dict[str, List[str]]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_array_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Dict[str, List[str]]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_array_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3242,8 +4314,13 @@ def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: return deserialized + + @distributed_trace - def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: + def get_array_empty( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an empty dictionary {}. :return: dict mapping str to list of str @@ -3260,15 +4337,21 @@ def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_array_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_array_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3286,8 +4369,13 @@ def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace - def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: + def get_array_item_null( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]}. :return: dict mapping str to list of str @@ -3304,15 +4392,21 @@ def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_array_item_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_array_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3330,8 +4424,13 @@ def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace - def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: + def get_array_item_empty( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}. :return: dict mapping str to list of str @@ -3348,15 +4447,21 @@ def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_array_item_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_array_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3374,8 +4479,13 @@ def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace - def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: + def get_array_valid( + self, + **kwargs: Any + ) -> Dict[str, List[str]]: """Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -3393,15 +4503,21 @@ def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_array_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_array_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3419,8 +4535,14 @@ def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: return deserialized + + @distributed_trace - def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) -> None: + def put_array_valid( + self, + array_body: Dict[str, List[str]], + **kwargs: Any + ) -> None: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -3440,11 +4562,13 @@ def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) -> No ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3455,7 +4579,9 @@ def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) -> No request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3466,8 +4592,13 @@ def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + def get_dictionary_null( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries with value null. :return: dict mapping str to dict mapping str to str @@ -3484,15 +4615,21 @@ def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_dictionary_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_dictionary_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3510,8 +4647,13 @@ def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + def get_dictionary_empty( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {}. :return: dict mapping str to dict mapping str to str @@ -3528,15 +4670,21 @@ def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_dictionary_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_dictionary_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3554,8 +4702,13 @@ def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + def get_dictionary_item_null( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -3573,15 +4726,21 @@ def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_dictionary_item_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_dictionary_item_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3599,8 +4758,13 @@ def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + def get_dictionary_item_empty( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -3618,15 +4782,21 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_dictionary_item_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_dictionary_item_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3644,8 +4814,13 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: return deserialized + + @distributed_trace - def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: + def get_dictionary_valid( + self, + **kwargs: Any + ) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -3664,15 +4839,21 @@ def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_dictionary_get_dictionary_valid_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, Dict[str, str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_dictionary_get_dictionary_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3690,8 +4871,14 @@ def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: return deserialized + + @distributed_trace - def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kwargs: Any) -> None: + def put_dictionary_valid( + self, + array_body: Dict[str, Dict[str, str]], + **kwargs: Any + ) -> None: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -3712,11 +4899,13 @@ def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kwargs: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = array_body @@ -3727,7 +4916,9 @@ def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3737,3 +4928,5 @@ def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kwargs: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py index 17faa081a7f..75ab9f722ed 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py index 623e438eb9c..48ac23f1972 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py index ff49498be27..a66288e2684 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_auto_rest_duration_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py index d3e575e957c..b9017b0ff7b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py index ecd1d021c33..2db0a55fdb1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_duration_test_service import AutoRestDurationTestService - -__all__ = ["AutoRestDurationTestService"] +__all__ = ['AutoRestDurationTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py index b12477e9c96..2ac6d5777b0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_auto_rest_duration_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestDurationTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestDurationTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.duration = DurationOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py index 029a04192bc..5994e663a71 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestDurationTestServiceConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestDurationTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestdurationtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestdurationtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py index c1711cf5b56..5de425fb108 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index 93b3398bd61..967a5c51fe8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -9,30 +9,17 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_duration_get_invalid_request, - build_duration_get_null_request, - build_duration_get_positive_duration_request, - build_duration_put_positive_duration_request, -) - -T = TypeVar("T") +from ...operations._operations import build_duration_get_invalid_request, build_duration_get_null_request, build_duration_get_positive_duration_request, build_duration_put_positive_duration_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class DurationOperations: """DurationOperations async operations. @@ -52,22 +39,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.timedelta]: """Get null duration value. :return: timedelta or None :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -85,8 +81,14 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: return deserialized + + @distributed_trace_async - async def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any) -> None: + async def put_positive_duration( + self, + duration_body: datetime.timedelta, + **kwargs: Any + ) -> None: """Put a positive duration value. :param duration_body: duration body. @@ -95,11 +97,13 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = duration_body @@ -110,7 +114,9 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -121,23 +127,34 @@ async def put_positive_duration(self, duration_body: datetime.timedelta, **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: + async def get_positive_duration( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get a positive duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_positive_duration_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_positive_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -155,23 +172,34 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: + async def get_invalid( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get an invalid duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -188,3 +216,5 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py index c1711cf5b56..5de425fb108 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import DurationOperations __all__ = [ - "DurationOperations", + 'DurationOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index 5c41609c940..fafe745b84e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -9,80 +9,102 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_duration_get_null_request(**kwargs: Any) -> HttpRequest: +def build_duration_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/null" + url = '/duration/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_duration_put_positive_duration_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_duration_get_positive_duration_request(**kwargs: Any) -> HttpRequest: +def build_duration_get_positive_duration_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/positiveduration" + url = '/duration/positiveduration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_duration_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_duration_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/duration/invalid" + url = '/duration/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class DurationOperations(object): """DurationOperations operations. @@ -103,22 +125,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: + def get_null( + self, + **kwargs: Any + ) -> Optional[datetime.timedelta]: """Get null duration value. :return: timedelta or None :rtype: ~datetime.timedelta or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.timedelta]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.timedelta]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -136,8 +167,14 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: return deserialized + + @distributed_trace - def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any) -> None: + def put_positive_duration( + self, + duration_body: datetime.timedelta, + **kwargs: Any + ) -> None: """Put a positive duration value. :param duration_body: duration body. @@ -146,11 +183,13 @@ def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = duration_body @@ -161,7 +200,9 @@ def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -172,23 +213,34 @@ def put_positive_duration(self, duration_body: datetime.timedelta, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: + def get_positive_duration( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get a positive duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_positive_duration_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_positive_duration_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -206,23 +258,34 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> datetime.timedelta: + def get_invalid( + self, + **kwargs: Any + ) -> datetime.timedelta: """Get an invalid duration value. :return: timedelta :rtype: ~datetime.timedelta :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.timedelta] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_duration_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.timedelta] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_duration_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -239,3 +302,5 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py index 385afe6573c..05c0d98d9d2 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/__init__.py index fedd7c51bff..b7164036958 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATFileService"] +__all__ = ['AutoRestSwaggerBATFileService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_auto_rest_swagger_bat_file_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_auto_rest_swagger_bat_file_service.py index 5b8b9ec5433..87994a66ee4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_auto_rest_swagger_bat_file_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_auto_rest_swagger_bat_file_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFileService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,8 +29,13 @@ class AutoRestSwaggerBATFileService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATFileServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_configuration.py index 9fe80719315..34a638e7354 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATFileServiceConfiguration(Configuration): # pylint: disa attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFileServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatfileservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatfileservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/__init__.py index be4bf5f38d9..23e0f2a3206 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_file_service import AutoRestSwaggerBATFileService - -__all__ = ["AutoRestSwaggerBATFileService"] +__all__ = ['AutoRestSwaggerBATFileService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_auto_rest_swagger_bat_file_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_auto_rest_swagger_bat_file_service.py index 11cc571a145..089561ea336 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_auto_rest_swagger_bat_file_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_auto_rest_swagger_bat_file_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFileService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,7 +29,12 @@ class AutoRestSwaggerBATFileService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATFileServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_configuration.py index 4ae048a7d95..f8818da4138 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATFileServiceConfiguration(Configuration): # pylint: disa attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFileServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatfileservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatfileservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/__init__.py index 326f170b7fb..45c91ccee8a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import FilesOperations __all__ = [ - "FilesOperations", + 'FilesOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py index dc02b46a7e9..36d70205a8f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py @@ -8,29 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_files_get_empty_file_request, - build_files_get_file_large_request, - build_files_get_file_request, -) - -T = TypeVar("T") +from ...operations._operations import build_files_get_empty_file_request, build_files_get_file_large_request, build_files_get_file_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FilesOperations: """FilesOperations async operations. @@ -50,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_file(self, **kwargs: Any) -> IO: + async def get_file( + self, + **kwargs: Any + ) -> IO: """Get file. :return: IO :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_files_get_file_request() + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_files_get_file_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -80,23 +77,34 @@ async def get_file(self, **kwargs: Any) -> IO: return deserialized + + @distributed_trace_async - async def get_file_large(self, **kwargs: Any) -> IO: + async def get_file_large( + self, + **kwargs: Any + ) -> IO: """Get a large file. :return: IO :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_files_get_file_large_request() + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_files_get_file_large_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -111,23 +119,34 @@ async def get_file_large(self, **kwargs: Any) -> IO: return deserialized + + @distributed_trace_async - async def get_empty_file(self, **kwargs: Any) -> IO: + async def get_empty_file( + self, + **kwargs: Any + ) -> IO: """Get empty file. :return: IO :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_files_get_empty_file_request() + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_files_get_empty_file_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -141,3 +160,5 @@ async def get_empty_file(self, **kwargs: Any) -> IO: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/__init__.py index 326f170b7fb..45c91ccee8a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import FilesOperations __all__ = [ - "FilesOperations", + 'FilesOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py index cb8d6553119..55d43e540c1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py @@ -8,62 +8,74 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_files_get_file_request(**kwargs: Any) -> HttpRequest: +def build_files_get_file_request( + **kwargs: Any +) -> HttpRequest: accept = "image/png, application/json" # Construct URL - url = "/files/stream/nonempty" + url = '/files/stream/nonempty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_files_get_file_large_request(**kwargs: Any) -> HttpRequest: +def build_files_get_file_large_request( + **kwargs: Any +) -> HttpRequest: accept = "image/png, application/json" # Construct URL - url = "/files/stream/verylarge" + url = '/files/stream/verylarge' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_files_get_empty_file_request(**kwargs: Any) -> HttpRequest: +def build_files_get_empty_file_request( + **kwargs: Any +) -> HttpRequest: accept = "image/png, application/json" # Construct URL - url = "/files/stream/empty" + url = '/files/stream/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class FilesOperations(object): """FilesOperations operations. @@ -84,22 +96,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_file(self, **kwargs: Any) -> IO: + def get_file( + self, + **kwargs: Any + ) -> IO: """Get file. :return: IO :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_files_get_file_request() + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_files_get_file_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -114,23 +135,34 @@ def get_file(self, **kwargs: Any) -> IO: return deserialized + + @distributed_trace - def get_file_large(self, **kwargs: Any) -> IO: + def get_file_large( + self, + **kwargs: Any + ) -> IO: """Get a large file. :return: IO :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_files_get_file_large_request() + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_files_get_file_large_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -145,23 +177,34 @@ def get_file_large(self, **kwargs: Any) -> IO: return deserialized + + @distributed_trace - def get_empty_file(self, **kwargs: Any) -> IO: + def get_empty_file( + self, + **kwargs: Any + ) -> IO: """Get empty file. :return: IO :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_files_get_empty_file_request() + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_files_get_empty_file_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -175,3 +218,5 @@ def get_empty_file(self, **kwargs: Any) -> IO: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py index da0628aad71..fbaa7e44694 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/__init__.py index 3778d845e32..2c1d02ebfdb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATFormDataService"] +__all__ = ['AutoRestSwaggerBATFormDataService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_auto_rest_swagger_bat_form_data_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_auto_rest_swagger_bat_form_data_service.py index 93aa7feecc8..fa27f52ca8b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_auto_rest_swagger_bat_form_data_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_auto_rest_swagger_bat_form_data_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFormDataService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,8 +29,13 @@ class AutoRestSwaggerBATFormDataService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATFormDataServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.formdata = FormdataOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_configuration.py index a1bbac2fc1b..8cf83183801 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): # pylint: attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFormDataServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatformdataservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatformdataservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/__init__.py index e27460706e4..255b1419e0b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_form_data_service import AutoRestSwaggerBATFormDataService - -__all__ = ["AutoRestSwaggerBATFormDataService"] +__all__ = ['AutoRestSwaggerBATFormDataService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_auto_rest_swagger_bat_form_data_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_auto_rest_swagger_bat_form_data_service.py index 987f8cea292..84db4f37c8f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_auto_rest_swagger_bat_form_data_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_auto_rest_swagger_bat_form_data_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATFormDataService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,7 +29,12 @@ class AutoRestSwaggerBATFormDataService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATFormDataServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.formdata = FormdataOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_configuration.py index c5eef4f228c..c1c299343e5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATFormDataServiceConfiguration(Configuration): # pylint: attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATFormDataServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatformdataservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatformdataservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/__init__.py index 675d82b24e3..cc6ac9b99d1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import FormdataOperations __all__ = [ - "FormdataOperations", + 'FormdataOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py index 5ef8f74091a..758a1099efc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py @@ -8,29 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_formdata_upload_file_request, - build_formdata_upload_file_via_body_request, - build_formdata_upload_files_request, -) - -T = TypeVar("T") +from ...operations._operations import build_formdata_upload_file_request, build_formdata_upload_file_via_body_request, build_formdata_upload_files_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FormdataOperations: """FormdataOperations async operations. @@ -50,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: + async def upload_file( + self, + files: Dict[str, Any], + **kwargs: Any + ) -> IO: """Upload file. :param files: Multipart input for files. See the template in our example to find the input @@ -70,12 +62,15 @@ async def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: written here. } """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] + request = build_formdata_upload_file_request( content_type=content_type, files=files, @@ -83,7 +78,9 @@ async def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -98,8 +95,14 @@ async def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: return deserialized + + @distributed_trace_async - async def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: + async def upload_file_via_body( + self, + file_content: IO, + **kwargs: Any + ) -> IO: """Upload file. :param file_content: File to upload. @@ -108,11 +111,13 @@ async def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_content @@ -123,7 +128,9 @@ async def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -138,8 +145,14 @@ async def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: return deserialized + + @distributed_trace_async - async def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: + async def upload_files( + self, + files: Dict[str, Any], + **kwargs: Any + ) -> IO: """Upload multiple files. :param files: Multipart input for files. See the template in our example to find the input @@ -159,12 +172,15 @@ async def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] + request = build_formdata_upload_files_request( content_type=content_type, files=files, @@ -172,7 +188,9 @@ async def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -186,3 +204,5 @@ async def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/__init__.py index 675d82b24e3..cc6ac9b99d1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import FormdataOperations __all__ = [ - "FormdataOperations", + 'FormdataOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py index bcfa82a04e3..f56da44ff1b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py @@ -8,78 +8,99 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_formdata_upload_file_request( - *, files: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + files: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/octet-stream, application/json" # Construct URL - url = "/formdata/stream/uploadfile" + url = '/formdata/stream/uploadfile' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, files=files, content=content, **kwargs) - - -def build_formdata_upload_file_via_body_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + files=files, + content=content, + **kwargs + ) + + +def build_formdata_upload_file_via_body_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/octet-stream, application/json" # Construct URL - url = "/formdata/stream/uploadfile" + url = '/formdata/stream/uploadfile' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_formdata_upload_files_request( - *, files: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + files: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/octet-stream, application/json" # Construct URL - url = "/formdata/stream/uploadfiles" + url = '/formdata/stream/uploadfiles' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, files=files, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + files=files, + content=content, + **kwargs + ) class FormdataOperations(object): """FormdataOperations operations. @@ -100,7 +121,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: + def upload_file( + self, + files: Dict[str, Any], + **kwargs: Any + ) -> IO: """Upload file. :param files: Multipart input for files. See the template in our example to find the input @@ -120,12 +145,15 @@ def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: written here. } """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] + request = build_formdata_upload_file_request( content_type=content_type, files=files, @@ -133,7 +161,9 @@ def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -148,8 +178,14 @@ def upload_file(self, files: Dict[str, Any], **kwargs: Any) -> IO: return deserialized + + @distributed_trace - def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: + def upload_file_via_body( + self, + file_content: IO, + **kwargs: Any + ) -> IO: """Upload file. :param file_content: File to upload. @@ -158,11 +194,13 @@ def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: :rtype: IO :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = file_content @@ -173,7 +211,9 @@ def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -188,8 +228,14 @@ def upload_file_via_body(self, file_content: IO, **kwargs: Any) -> IO: return deserialized + + @distributed_trace - def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: + def upload_files( + self, + files: Dict[str, Any], + **kwargs: Any + ) -> IO: """Upload multiple files. :param files: Multipart input for files. See the template in our example to find the input @@ -209,12 +255,15 @@ def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[IO] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] + request = build_formdata_upload_files_request( content_type=content_type, files=files, @@ -222,7 +271,9 @@ def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=True, **kwargs + request, + stream=True, + **kwargs ) response = pipeline_response.http_response @@ -236,3 +287,5 @@ def upload_files(self, files: Dict[str, Any], **kwargs: Any) -> IO: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py index b9c8a22987e..39e98d75b27 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/__init__.py index 1bbfaf60a8b..39430c90415 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["BodyFormsDataURLEncoded"] +__all__ = ['BodyFormsDataURLEncoded'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_body_forms_data_url_encoded.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_body_forms_data_url_encoded.py index d63ccf0d6f1..64a2a8be1f6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_body_forms_data_url_encoded.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_body_forms_data_url_encoded.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BodyFormsDataURLEncoded: """Test Infrastructure for AutoRest Swagger BAT. @@ -31,17 +30,21 @@ class BodyFormsDataURLEncoded: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = BodyFormsDataURLEncodedConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.formdataurlencoded = FormdataurlencodedOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.formdataurlencoded = FormdataurlencodedOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_configuration.py index 38ea6b61030..a3bc9a0f47a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class BodyFormsDataURLEncodedConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BodyFormsDataURLEncodedConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "bodyformsdataurlencoded/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodyformsdataurlencoded/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/__init__.py index 9eda7cfdb59..71fa91da75b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._body_forms_data_url_encoded import BodyFormsDataURLEncoded - -__all__ = ["BodyFormsDataURLEncoded"] +__all__ = ['BodyFormsDataURLEncoded'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_body_forms_data_url_encoded.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_body_forms_data_url_encoded.py index 8d3c4bc9002..68974a0b282 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_body_forms_data_url_encoded.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_body_forms_data_url_encoded.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class BodyFormsDataURLEncoded: """Test Infrastructure for AutoRest Swagger BAT. @@ -31,18 +30,26 @@ class BodyFormsDataURLEncoded: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = BodyFormsDataURLEncodedConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.formdataurlencoded = FormdataurlencodedOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.formdataurlencoded = FormdataurlencodedOperations(self._client, self._config, self._serialize, self._deserialize) + - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_configuration.py index 60d34b8149c..f95a73a26b1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class BodyFormsDataURLEncodedConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(BodyFormsDataURLEncodedConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "bodyformsdataurlencoded/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'bodyformsdataurlencoded/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/__init__.py index 0e8053ce76c..d884864db5f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import FormdataurlencodedOperations __all__ = [ - "FormdataurlencodedOperations", + 'FormdataurlencodedOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py index b986087cb42..c0a306bf00c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_operations.py @@ -8,28 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_formdataurlencoded_partial_constant_body_request, - build_formdataurlencoded_update_pet_with_form_request, -) - -T = TypeVar("T") +from ...operations._operations import build_formdataurlencoded_partial_constant_body_request, build_formdataurlencoded_update_pet_with_form_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class FormdataurlencodedOperations: """FormdataurlencodedOperations async operations. @@ -49,7 +38,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs: Any) -> None: + async def update_pet_with_form( + self, + pet_id: int, + data: Dict[str, Any], + **kwargs: Any + ) -> None: """Updates a pet in the store with form data. Updates a pet in the store with form data. @@ -77,12 +71,15 @@ async def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs "status": "str" # Optional. Updated status of the pet. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + request = build_formdataurlencoded_update_pet_with_form_request( pet_id=pet_id, content_type=content_type, @@ -91,7 +88,9 @@ async def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -102,8 +101,14 @@ async def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> None: + async def partial_constant_body( + self, + data: Dict[str, Any], + **kwargs: Any + ) -> None: """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: 'foo', service: 'bar' } to pass the test. @@ -127,12 +132,15 @@ async def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> No "service": "str" # Indicates the name of your Azure container registry. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + request = build_formdataurlencoded_partial_constant_body_request( content_type=content_type, data=data, @@ -140,7 +148,9 @@ async def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> No request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -150,3 +160,5 @@ async def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/__init__.py index 0e8053ce76c..d884864db5f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import FormdataurlencodedOperations __all__ = [ - "FormdataurlencodedOperations", + 'FormdataurlencodedOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py index c5ec9fde403..ae7e2034cf7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,24 +16,26 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_formdataurlencoded_update_pet_with_form_request( - pet_id: int, *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + pet_id: int, + *, + data: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/formsdataurlencoded/pet/add/{petId}" + url = '/formsdataurlencoded/pet/add/{petId}' path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, "int"), + "petId": _SERIALIZER.url("pet_id", pet_id, 'int'), } url = _format_url_section(url, **path_format_arguments) @@ -47,26 +43,42 @@ def build_formdataurlencoded_update_pet_with_form_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + data=data, + content=content, + **kwargs + ) def build_formdataurlencoded_partial_constant_body_request( - *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + data: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/formsdataurlencoded/partialConstantBody" + url = '/formsdataurlencoded/partialConstantBody' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, data=data, content=content, **kwargs) + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + data=data, + content=content, + **kwargs + ) class FormdataurlencodedOperations(object): """FormdataurlencodedOperations operations. @@ -87,7 +99,12 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs: Any) -> None: + def update_pet_with_form( + self, + pet_id: int, + data: Dict[str, Any], + **kwargs: Any + ) -> None: """Updates a pet in the store with form data. Updates a pet in the store with form data. @@ -115,12 +132,15 @@ def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs: Any) "status": "str" # Optional. Updated status of the pet. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + request = build_formdataurlencoded_update_pet_with_form_request( pet_id=pet_id, content_type=content_type, @@ -129,7 +149,9 @@ def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -140,8 +162,14 @@ def update_pet_with_form(self, pet_id: int, data: Dict[str, Any], **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> None: + def partial_constant_body( + self, + data: Dict[str, Any], + **kwargs: Any + ) -> None: """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: 'foo', service: 'bar' } to pass the test. @@ -165,12 +193,15 @@ def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> None: "service": "str" # Indicates the name of your Azure container registry. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + request = build_formdataurlencoded_partial_constant_body_request( content_type=content_type, data=data, @@ -178,7 +209,9 @@ def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -188,3 +221,5 @@ def partial_constant_body(self, data: Dict[str, Any], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py index 865983fb584..7d71a848053 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/__init__.py index 57b034a143f..df30011173d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestIntegerTestService"] +__all__ = ['AutoRestIntegerTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_auto_rest_integer_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_auto_rest_integer_test_service.py index 6403f1078f0..6150c47adf4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_auto_rest_integer_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_auto_rest_integer_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestIntegerTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestIntegerTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestIntegerTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_configuration.py index b87ccec77bd..284e94b4ea6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestIntegerTestServiceConfiguration(Configuration): # pylint: disable attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestIntegerTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestintegertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestintegertestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/__init__.py index 92e3cb60c63..6c38252cb2b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_integer_test_service import AutoRestIntegerTestService - -__all__ = ["AutoRestIntegerTestService"] +__all__ = ['AutoRestIntegerTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_auto_rest_integer_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_auto_rest_integer_test_service.py index f0d839ecb1c..457a827597e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_auto_rest_integer_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_auto_rest_integer_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestIntegerTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestIntegerTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestIntegerTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_configuration.py index 5a760bb48ef..57034c6aa91 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestIntegerTestServiceConfiguration(Configuration): # pylint: disable attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestIntegerTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestintegertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestintegertestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/__init__.py index 6516088f317..518c8d107b9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import IntOperations __all__ = [ - "IntOperations", + 'IntOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py index 47ef8410d46..3836aafc3c3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py @@ -9,40 +9,17 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_int_get_invalid_request, - build_int_get_invalid_unix_time_request, - build_int_get_null_request, - build_int_get_null_unix_time_request, - build_int_get_overflow_int32_request, - build_int_get_overflow_int64_request, - build_int_get_underflow_int32_request, - build_int_get_underflow_int64_request, - build_int_get_unix_time_request, - build_int_put_max32_request, - build_int_put_max64_request, - build_int_put_min32_request, - build_int_put_min64_request, - build_int_put_unix_time_date_request, -) - -T = TypeVar("T") +from ...operations._operations import build_int_get_invalid_request, build_int_get_invalid_unix_time_request, build_int_get_null_request, build_int_get_null_unix_time_request, build_int_get_overflow_int32_request, build_int_get_overflow_int64_request, build_int_get_underflow_int32_request, build_int_get_underflow_int64_request, build_int_get_unix_time_request, build_int_put_max32_request, build_int_put_max64_request, build_int_put_min32_request, build_int_put_min64_request, build_int_put_unix_time_date_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class IntOperations: """IntOperations async operations. @@ -62,22 +39,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[int]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[int]: """Get null Int value. :return: int or None :rtype: int or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -95,23 +81,34 @@ async def get_null(self, **kwargs: Any) -> Optional[int]: return deserialized + + @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> int: + async def get_invalid( + self, + **kwargs: Any + ) -> int: """Get invalid Int value. :return: int :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -129,23 +126,34 @@ async def get_invalid(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace_async - async def get_overflow_int32(self, **kwargs: Any) -> int: + async def get_overflow_int32( + self, + **kwargs: Any + ) -> int: """Get overflow Int32 value. :return: int :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_overflow_int32_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_overflow_int32_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -163,23 +171,34 @@ async def get_overflow_int32(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace_async - async def get_underflow_int32(self, **kwargs: Any) -> int: + async def get_underflow_int32( + self, + **kwargs: Any + ) -> int: """Get underflow Int32 value. :return: int :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_underflow_int32_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_underflow_int32_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -197,23 +216,34 @@ async def get_underflow_int32(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace_async - async def get_overflow_int64(self, **kwargs: Any) -> int: + async def get_overflow_int64( + self, + **kwargs: Any + ) -> int: """Get overflow Int64 value. :return: long :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_overflow_int64_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_overflow_int64_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -231,23 +261,34 @@ async def get_overflow_int64(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace_async - async def get_underflow_int64(self, **kwargs: Any) -> int: + async def get_underflow_int64( + self, + **kwargs: Any + ) -> int: """Get underflow Int64 value. :return: long :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_underflow_int64_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_underflow_int64_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -265,8 +306,14 @@ async def get_underflow_int64(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace_async - async def put_max32(self, int_body: int, **kwargs: Any) -> None: + async def put_max32( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put max int32 value. :param int_body: int body. @@ -275,11 +322,13 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -290,7 +339,9 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -301,8 +352,14 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_max64(self, int_body: int, **kwargs: Any) -> None: + async def put_max64( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put max int64 value. :param int_body: int body. @@ -311,11 +368,13 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -326,7 +385,9 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -337,8 +398,14 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_min32(self, int_body: int, **kwargs: Any) -> None: + async def put_min32( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put min int32 value. :param int_body: int body. @@ -347,11 +414,13 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -362,7 +431,9 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -373,8 +444,14 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_min64(self, int_body: int, **kwargs: Any) -> None: + async def put_min64( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put min int64 value. :param int_body: int body. @@ -383,11 +460,13 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -398,7 +477,9 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -409,23 +490,34 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: + async def get_unix_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get datetime encoded as Unix time value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_unix_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_unix_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -443,8 +535,14 @@ async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) -> None: + async def put_unix_time_date( + self, + int_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put datetime encoded as Unix time. :param int_body: int body. @@ -453,11 +551,13 @@ async def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -468,7 +568,9 @@ async def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -479,23 +581,34 @@ async def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: + async def get_invalid_unix_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid Unix time value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_invalid_unix_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_invalid_unix_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -513,23 +626,34 @@ async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace_async - async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: + async def get_null_unix_time( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null Unix time value. :return: datetime or None :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_null_unix_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_null_unix_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -546,3 +670,5 @@ async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime] return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/__init__.py index 6516088f317..518c8d107b9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import IntOperations __all__ = [ - "IntOperations", + 'IntOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py index 5ca94dace60..06c4bd0af10 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py @@ -9,214 +9,328 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_int_get_null_request(**kwargs: Any) -> HttpRequest: +def build_int_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/null" + url = '/int/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_get_invalid_request(**kwargs: Any) -> HttpRequest: +def build_int_get_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/invalid" + url = '/int/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_get_overflow_int32_request(**kwargs: Any) -> HttpRequest: +def build_int_get_overflow_int32_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/overflowint32" + url = '/int/overflowint32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_get_underflow_int32_request(**kwargs: Any) -> HttpRequest: +def build_int_get_underflow_int32_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/underflowint32" + url = '/int/underflowint32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_get_overflow_int64_request(**kwargs: Any) -> HttpRequest: +def build_int_get_overflow_int64_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/overflowint64" + url = '/int/overflowint64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_get_underflow_int64_request(**kwargs: Any) -> HttpRequest: +def build_int_get_underflow_int64_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/underflowint64" + url = '/int/underflowint64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_put_max32_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_int_put_max32_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/max/32" + url = '/int/max/32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_int_put_max64_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_int_put_max64_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/max/64" + url = '/int/max/64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_int_put_min32_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_int_put_min32_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/min/32" + url = '/int/min/32' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_int_put_min64_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_int_put_min64_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/min/64" + url = '/int/min/64' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_int_get_unix_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_int_get_unix_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/unixtime" + url = '/int/unixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_put_unix_time_date_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_int_put_unix_time_date_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/int/unixtime" + url = '/int/unixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_int_get_invalid_unix_time_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_int_get_invalid_unix_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/invalidunixtime" + url = '/int/invalidunixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_int_get_null_unix_time_request(**kwargs: Any) -> HttpRequest: +def build_int_get_null_unix_time_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/int/nullunixtime" + url = '/int/nullunixtime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class IntOperations(object): """IntOperations operations. @@ -237,22 +351,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[int]: + def get_null( + self, + **kwargs: Any + ) -> Optional[int]: """Get null Int value. :return: int or None :rtype: int or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -270,23 +393,34 @@ def get_null(self, **kwargs: Any) -> Optional[int]: return deserialized + + @distributed_trace - def get_invalid(self, **kwargs: Any) -> int: + def get_invalid( + self, + **kwargs: Any + ) -> int: """Get invalid Int value. :return: int :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_invalid_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -304,23 +438,34 @@ def get_invalid(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace - def get_overflow_int32(self, **kwargs: Any) -> int: + def get_overflow_int32( + self, + **kwargs: Any + ) -> int: """Get overflow Int32 value. :return: int :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_overflow_int32_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_overflow_int32_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -338,23 +483,34 @@ def get_overflow_int32(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace - def get_underflow_int32(self, **kwargs: Any) -> int: + def get_underflow_int32( + self, + **kwargs: Any + ) -> int: """Get underflow Int32 value. :return: int :rtype: int :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_underflow_int32_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_underflow_int32_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -372,23 +528,34 @@ def get_underflow_int32(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace - def get_overflow_int64(self, **kwargs: Any) -> int: + def get_overflow_int64( + self, + **kwargs: Any + ) -> int: """Get overflow Int64 value. :return: long :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_overflow_int64_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_overflow_int64_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -406,23 +573,34 @@ def get_overflow_int64(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace - def get_underflow_int64(self, **kwargs: Any) -> int: + def get_underflow_int64( + self, + **kwargs: Any + ) -> int: """Get underflow Int64 value. :return: long :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_underflow_int64_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_underflow_int64_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -440,8 +618,14 @@ def get_underflow_int64(self, **kwargs: Any) -> int: return deserialized + + @distributed_trace - def put_max32(self, int_body: int, **kwargs: Any) -> None: + def put_max32( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put max int32 value. :param int_body: int body. @@ -450,11 +634,13 @@ def put_max32(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -465,7 +651,9 @@ def put_max32(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -476,8 +664,14 @@ def put_max32(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_max64(self, int_body: int, **kwargs: Any) -> None: + def put_max64( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put max int64 value. :param int_body: int body. @@ -486,11 +680,13 @@ def put_max64(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -501,7 +697,9 @@ def put_max64(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -512,8 +710,14 @@ def put_max64(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_min32(self, int_body: int, **kwargs: Any) -> None: + def put_min32( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put min int32 value. :param int_body: int body. @@ -522,11 +726,13 @@ def put_min32(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -537,7 +743,9 @@ def put_min32(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -548,8 +756,14 @@ def put_min32(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_min64(self, int_body: int, **kwargs: Any) -> None: + def put_min64( + self, + int_body: int, + **kwargs: Any + ) -> None: """Put min int64 value. :param int_body: int body. @@ -558,11 +772,13 @@ def put_min64(self, int_body: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -573,7 +789,9 @@ def put_min64(self, int_body: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -584,23 +802,34 @@ def put_min64(self, int_body: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_unix_time(self, **kwargs: Any) -> datetime.datetime: + def get_unix_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get datetime encoded as Unix time value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_unix_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_unix_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -618,8 +847,14 @@ def get_unix_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) -> None: + def put_unix_time_date( + self, + int_body: datetime.datetime, + **kwargs: Any + ) -> None: """Put datetime encoded as Unix time. :param int_body: int body. @@ -628,11 +863,13 @@ def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = int_body @@ -643,7 +880,9 @@ def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -654,23 +893,34 @@ def put_unix_time_date(self, int_body: datetime.datetime, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: + def get_invalid_unix_time( + self, + **kwargs: Any + ) -> datetime.datetime: """Get invalid Unix time value. :return: datetime :rtype: ~datetime.datetime :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.datetime] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_invalid_unix_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.datetime] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_invalid_unix_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -688,23 +938,34 @@ def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: return deserialized + + @distributed_trace - def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: + def get_null_unix_time( + self, + **kwargs: Any + ) -> Optional[datetime.datetime]: """Get null Unix time value. :return: datetime or None :rtype: ~datetime.datetime or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[datetime.datetime]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_null_unix_time_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[datetime.datetime]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_null_unix_time_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -721,3 +982,5 @@ def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py index bcd0dece55b..2171cf31990 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/__init__.py index 9b131940e32..f031d50102e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestNumberTestService"] +__all__ = ['AutoRestNumberTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_auto_rest_number_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_auto_rest_number_test_service.py index 5f936eaf45e..7880b918cc3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_auto_rest_number_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_auto_rest_number_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestNumberTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestNumberTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestNumberTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.number = NumberOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_configuration.py index 06b75f515c1..e7b8cfd2766 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestNumberTestServiceConfiguration(Configuration): # pylint: disable= attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestNumberTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestnumbertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestnumbertestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/__init__.py index 4b6e06f5364..b3cdd84231d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_number_test_service import AutoRestNumberTestService - -__all__ = ["AutoRestNumberTestService"] +__all__ = ['AutoRestNumberTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_auto_rest_number_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_auto_rest_number_test_service.py index 56e354b1877..94ffe004f75 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_auto_rest_number_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_auto_rest_number_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestNumberTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestNumberTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestNumberTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.number = NumberOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_configuration.py index 40dac1b308b..d6e3c56a3e0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestNumberTestServiceConfiguration(Configuration): # pylint: disable= attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestNumberTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestnumbertestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestnumbertestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/__init__.py index 85dfb6359bb..4c4de8ef8a4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import NumberOperations __all__ = [ - "NumberOperations", + 'NumberOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py index 6bc8e84afe6..b4782cb992b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py @@ -8,50 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_number_get_big_decimal_negative_decimal_request, - build_number_get_big_decimal_positive_decimal_request, - build_number_get_big_decimal_request, - build_number_get_big_double_negative_decimal_request, - build_number_get_big_double_positive_decimal_request, - build_number_get_big_double_request, - build_number_get_big_float_request, - build_number_get_invalid_decimal_request, - build_number_get_invalid_double_request, - build_number_get_invalid_float_request, - build_number_get_null_request, - build_number_get_small_decimal_request, - build_number_get_small_double_request, - build_number_get_small_float_request, - build_number_put_big_decimal_negative_decimal_request, - build_number_put_big_decimal_positive_decimal_request, - build_number_put_big_decimal_request, - build_number_put_big_double_negative_decimal_request, - build_number_put_big_double_positive_decimal_request, - build_number_put_big_double_request, - build_number_put_big_float_request, - build_number_put_small_decimal_request, - build_number_put_small_double_request, - build_number_put_small_float_request, -) - -T = TypeVar("T") +from ...operations._operations import build_number_get_big_decimal_negative_decimal_request, build_number_get_big_decimal_positive_decimal_request, build_number_get_big_decimal_request, build_number_get_big_double_negative_decimal_request, build_number_get_big_double_positive_decimal_request, build_number_get_big_double_request, build_number_get_big_float_request, build_number_get_invalid_decimal_request, build_number_get_invalid_double_request, build_number_get_invalid_float_request, build_number_get_null_request, build_number_get_small_decimal_request, build_number_get_small_double_request, build_number_get_small_float_request, build_number_put_big_decimal_negative_decimal_request, build_number_put_big_decimal_positive_decimal_request, build_number_put_big_decimal_request, build_number_put_big_double_negative_decimal_request, build_number_put_big_double_positive_decimal_request, build_number_put_big_double_request, build_number_put_big_float_request, build_number_put_small_decimal_request, build_number_put_small_double_request, build_number_put_small_float_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class NumberOperations: # pylint: disable=too-many-public-methods """NumberOperations async operations. @@ -71,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[float]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[float]: """Get null Number value. :return: float or None :rtype: float or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -104,23 +80,34 @@ async def get_null(self, **kwargs: Any) -> Optional[float]: return deserialized + + @distributed_trace_async - async def get_invalid_float(self, **kwargs: Any) -> float: + async def get_invalid_float( + self, + **kwargs: Any + ) -> float: """Get invalid float Number value. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_invalid_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_invalid_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -138,23 +125,34 @@ async def get_invalid_float(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def get_invalid_double(self, **kwargs: Any) -> float: + async def get_invalid_double( + self, + **kwargs: Any + ) -> float: """Get invalid double Number value. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_invalid_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_invalid_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -172,23 +170,34 @@ async def get_invalid_double(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def get_invalid_decimal(self, **kwargs: Any) -> float: + async def get_invalid_decimal( + self, + **kwargs: Any + ) -> float: """Get invalid decimal Number value. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_invalid_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_invalid_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -206,8 +215,14 @@ async def get_invalid_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_big_float(self, number_body: float, **kwargs: Any) -> None: + async def put_big_float( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big float value 3.402823e+20. :param number_body: number body. @@ -216,11 +231,13 @@ async def put_big_float(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -231,7 +248,9 @@ async def put_big_float(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -242,23 +261,34 @@ async def put_big_float(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_big_float(self, **kwargs: Any) -> float: + async def get_big_float( + self, + **kwargs: Any + ) -> float: """Get big float value 3.402823e+20. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -276,8 +306,14 @@ async def get_big_float(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_big_double(self, number_body: float, **kwargs: Any) -> None: + async def put_big_double( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big double value 2.5976931e+101. :param number_body: number body. @@ -286,11 +322,13 @@ async def put_big_double(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -301,7 +339,9 @@ async def put_big_double(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -312,23 +352,34 @@ async def put_big_double(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_big_double(self, **kwargs: Any) -> float: + async def get_big_double( + self, + **kwargs: Any + ) -> float: """Get big double value 2.5976931e+101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -346,8 +397,13 @@ async def get_big_double(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_big_double_positive_decimal(self, **kwargs: Any) -> None: + async def put_big_double_positive_decimal( + self, + **kwargs: Any + ) -> None: """Put big double value 99999999.99. :keyword number_body: The default value is 99999999.99. Note that overriding this default value @@ -357,13 +413,16 @@ async def put_big_double_positive_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_number_put_big_double_positive_decimal_request( content_type=content_type, json=number_body, @@ -371,7 +430,9 @@ async def put_big_double_positive_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -382,23 +443,34 @@ async def put_big_double_positive_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: + async def get_big_double_positive_decimal( + self, + **kwargs: Any + ) -> float: """Get big double value 99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_double_positive_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_double_positive_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -416,8 +488,13 @@ async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_big_double_negative_decimal(self, **kwargs: Any) -> None: + async def put_big_double_negative_decimal( + self, + **kwargs: Any + ) -> None: """Put big double value -99999999.99. :keyword number_body: The default value is -99999999.99. Note that overriding this default @@ -427,13 +504,16 @@ async def put_big_double_negative_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_number_put_big_double_negative_decimal_request( content_type=content_type, json=number_body, @@ -441,7 +521,9 @@ async def put_big_double_negative_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -452,23 +534,34 @@ async def put_big_double_negative_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: + async def get_big_double_negative_decimal( + self, + **kwargs: Any + ) -> float: """Get big double value -99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_double_negative_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_double_negative_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -486,8 +579,14 @@ async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: + async def put_big_decimal( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big decimal value 2.5976931e+101. :param number_body: number body. @@ -496,11 +595,13 @@ async def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -511,7 +612,9 @@ async def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -522,23 +625,34 @@ async def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_big_decimal(self, **kwargs: Any) -> float: + async def get_big_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value 2.5976931e+101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -556,8 +670,13 @@ async def get_big_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: + async def put_big_decimal_positive_decimal( + self, + **kwargs: Any + ) -> None: """Put big decimal value 99999999.99. :keyword number_body: The default value is 99999999.99. Note that overriding this default value @@ -567,13 +686,16 @@ async def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_number_put_big_decimal_positive_decimal_request( content_type=content_type, json=number_body, @@ -581,7 +703,9 @@ async def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -592,23 +716,34 @@ async def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: + async def get_big_decimal_positive_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value 99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_decimal_positive_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_decimal_positive_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -626,8 +761,13 @@ async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: + async def put_big_decimal_negative_decimal( + self, + **kwargs: Any + ) -> None: """Put big decimal value -99999999.99. :keyword number_body: The default value is -99999999.99. Note that overriding this default @@ -637,13 +777,16 @@ async def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_number_put_big_decimal_negative_decimal_request( content_type=content_type, json=number_body, @@ -651,7 +794,9 @@ async def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -662,23 +807,34 @@ async def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: + async def get_big_decimal_negative_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value -99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_decimal_negative_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_decimal_negative_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -696,8 +852,14 @@ async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_small_float(self, number_body: float, **kwargs: Any) -> None: + async def put_small_float( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small float value 3.402823e-20. :param number_body: number body. @@ -706,11 +868,13 @@ async def put_small_float(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -721,7 +885,9 @@ async def put_small_float(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -732,23 +898,34 @@ async def put_small_float(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_small_float(self, **kwargs: Any) -> float: + async def get_small_float( + self, + **kwargs: Any + ) -> float: """Get big double value 3.402823e-20. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_small_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_small_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -766,8 +943,14 @@ async def get_small_float(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_small_double(self, number_body: float, **kwargs: Any) -> None: + async def put_small_double( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small double value 2.5976931e-101. :param number_body: number body. @@ -776,11 +959,13 @@ async def put_small_double(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -791,7 +976,9 @@ async def put_small_double(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -802,23 +989,34 @@ async def put_small_double(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_small_double(self, **kwargs: Any) -> float: + async def get_small_double( + self, + **kwargs: Any + ) -> float: """Get big double value 2.5976931e-101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_small_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_small_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -836,8 +1034,14 @@ async def get_small_double(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace_async - async def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: + async def put_small_decimal( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small decimal value 2.5976931e-101. :param number_body: number body. @@ -846,11 +1050,13 @@ async def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -861,7 +1067,9 @@ async def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -872,23 +1080,34 @@ async def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_small_decimal(self, **kwargs: Any) -> float: + async def get_small_decimal( + self, + **kwargs: Any + ) -> float: """Get small decimal value 2.5976931e-101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_small_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_small_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -905,3 +1124,5 @@ async def get_small_decimal(self, **kwargs: Any) -> float: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/__init__.py index 85dfb6359bb..4c4de8ef8a4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import NumberOperations __all__ = [ - "NumberOperations", + 'NumberOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py index ba0646be634..54ccaf2dd3a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py @@ -8,358 +8,551 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_number_get_null_request(**kwargs: Any) -> HttpRequest: +def build_number_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/null" + url = '/number/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_get_invalid_float_request(**kwargs: Any) -> HttpRequest: +def build_number_get_invalid_float_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/invalidfloat" + url = '/number/invalidfloat' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_get_invalid_double_request(**kwargs: Any) -> HttpRequest: +def build_number_get_invalid_double_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/invaliddouble" + url = '/number/invaliddouble' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_get_invalid_decimal_request(**kwargs: Any) -> HttpRequest: +def build_number_get_invalid_decimal_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/invaliddecimal" + url = '/number/invaliddecimal' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_big_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_number_put_big_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/big/float/3.402823e+20" + url = '/number/big/float/3.402823e+20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_number_get_big_float_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_number_get_big_float_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/float/3.402823e+20" + url = '/number/big/float/3.402823e+20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_big_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_number_put_big_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/big/double/2.5976931e+101" + url = '/number/big/double/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_number_get_big_double_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_number_get_big_double_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/double/2.5976931e+101" + url = '/number/big/double/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", 99999999.99) # type: float +def build_number_put_big_double_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', 99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/double/99999999.99" + url = '/number/big/double/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_number_get_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: +def build_number_get_big_double_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/double/99999999.99" + url = '/number/big/double/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", -99999999.99) # type: float +def build_number_put_big_double_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', -99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/double/-99999999.99" + url = '/number/big/double/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_number_get_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: +def build_number_get_big_double_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/double/-99999999.99" + url = '/number/big/double/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_big_decimal_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_number_put_big_decimal_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/big/decimal/2.5976931e+101" + url = '/number/big/decimal/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_number_get_big_decimal_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_number_get_big_decimal_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/decimal/2.5976931e+101" + url = '/number/big/decimal/2.5976931e+101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", 99999999.99) # type: float +def build_number_put_big_decimal_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', 99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/decimal/99999999.99" + url = '/number/big/decimal/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_number_get_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest: +def build_number_get_big_decimal_positive_decimal_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/decimal/99999999.99" + url = '/number/big/decimal/99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", -99999999.99) # type: float +def build_number_put_big_decimal_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', -99999999.99) # type: float accept = "application/json" # Construct URL - url = "/number/big/decimal/-99999999.99" + url = '/number/big/decimal/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_number_get_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest: +def build_number_get_big_decimal_negative_decimal_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/big/decimal/-99999999.99" + url = '/number/big/decimal/-99999999.99' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_small_float_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_number_put_small_float_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/small/float/3.402823e-20" + url = '/number/small/float/3.402823e-20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_number_get_small_float_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_number_get_small_float_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/small/float/3.402823e-20" + url = '/number/small/float/3.402823e-20' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_small_double_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_number_put_small_double_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/small/double/2.5976931e-101" + url = '/number/small/double/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_number_get_small_double_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_number_get_small_double_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/small/double/2.5976931e-101" + url = '/number/small/double/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_number_put_small_decimal_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_number_put_small_decimal_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/number/small/decimal/2.5976931e-101" + url = '/number/small/decimal/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_number_get_small_decimal_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_number_get_small_decimal_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/number/small/decimal/2.5976931e-101" + url = '/number/small/decimal/2.5976931e-101' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class NumberOperations(object): # pylint: disable=too-many-public-methods """NumberOperations operations. @@ -380,22 +573,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[float]: + def get_null( + self, + **kwargs: Any + ) -> Optional[float]: """Get null Number value. :return: float or None :rtype: float or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[float]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[float]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -413,23 +615,34 @@ def get_null(self, **kwargs: Any) -> Optional[float]: return deserialized + + @distributed_trace - def get_invalid_float(self, **kwargs: Any) -> float: + def get_invalid_float( + self, + **kwargs: Any + ) -> float: """Get invalid float Number value. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_invalid_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_invalid_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -447,23 +660,34 @@ def get_invalid_float(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def get_invalid_double(self, **kwargs: Any) -> float: + def get_invalid_double( + self, + **kwargs: Any + ) -> float: """Get invalid double Number value. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_invalid_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_invalid_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -481,23 +705,34 @@ def get_invalid_double(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def get_invalid_decimal(self, **kwargs: Any) -> float: + def get_invalid_decimal( + self, + **kwargs: Any + ) -> float: """Get invalid decimal Number value. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_invalid_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_invalid_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -515,8 +750,14 @@ def get_invalid_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_big_float(self, number_body: float, **kwargs: Any) -> None: + def put_big_float( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big float value 3.402823e+20. :param number_body: number body. @@ -525,11 +766,13 @@ def put_big_float(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -540,7 +783,9 @@ def put_big_float(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -551,23 +796,34 @@ def put_big_float(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_big_float(self, **kwargs: Any) -> float: + def get_big_float( + self, + **kwargs: Any + ) -> float: """Get big float value 3.402823e+20. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -585,8 +841,14 @@ def get_big_float(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_big_double(self, number_body: float, **kwargs: Any) -> None: + def put_big_double( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big double value 2.5976931e+101. :param number_body: number body. @@ -595,11 +857,13 @@ def put_big_double(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -610,7 +874,9 @@ def put_big_double(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -621,23 +887,34 @@ def put_big_double(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_big_double(self, **kwargs: Any) -> float: + def get_big_double( + self, + **kwargs: Any + ) -> float: """Get big double value 2.5976931e+101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -655,8 +932,13 @@ def get_big_double(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_big_double_positive_decimal(self, **kwargs: Any) -> None: + def put_big_double_positive_decimal( + self, + **kwargs: Any + ) -> None: """Put big double value 99999999.99. :keyword number_body: The default value is 99999999.99. Note that overriding this default value @@ -666,13 +948,16 @@ def put_big_double_positive_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_number_put_big_double_positive_decimal_request( content_type=content_type, json=number_body, @@ -680,7 +965,9 @@ def put_big_double_positive_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -691,23 +978,34 @@ def put_big_double_positive_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_big_double_positive_decimal(self, **kwargs: Any) -> float: + def get_big_double_positive_decimal( + self, + **kwargs: Any + ) -> float: """Get big double value 99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_double_positive_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_double_positive_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -725,8 +1023,13 @@ def get_big_double_positive_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_big_double_negative_decimal(self, **kwargs: Any) -> None: + def put_big_double_negative_decimal( + self, + **kwargs: Any + ) -> None: """Put big double value -99999999.99. :keyword number_body: The default value is -99999999.99. Note that overriding this default @@ -736,13 +1039,16 @@ def put_big_double_negative_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_number_put_big_double_negative_decimal_request( content_type=content_type, json=number_body, @@ -750,7 +1056,9 @@ def put_big_double_negative_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -761,23 +1069,34 @@ def put_big_double_negative_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_big_double_negative_decimal(self, **kwargs: Any) -> float: + def get_big_double_negative_decimal( + self, + **kwargs: Any + ) -> float: """Get big double value -99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_double_negative_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_double_negative_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -795,8 +1114,14 @@ def get_big_double_negative_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: + def put_big_decimal( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put big decimal value 2.5976931e+101. :param number_body: number body. @@ -805,11 +1130,13 @@ def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -820,7 +1147,9 @@ def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -831,23 +1160,34 @@ def put_big_decimal(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_big_decimal(self, **kwargs: Any) -> float: + def get_big_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value 2.5976931e+101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -865,8 +1205,13 @@ def get_big_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: + def put_big_decimal_positive_decimal( + self, + **kwargs: Any + ) -> None: """Put big decimal value 99999999.99. :keyword number_body: The default value is 99999999.99. Note that overriding this default value @@ -876,13 +1221,16 @@ def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", 99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', 99999999.99) # type: float + request = build_number_put_big_decimal_positive_decimal_request( content_type=content_type, json=number_body, @@ -890,7 +1238,9 @@ def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -901,23 +1251,34 @@ def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: + def get_big_decimal_positive_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value 99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_decimal_positive_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_decimal_positive_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -935,8 +1296,13 @@ def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: + def put_big_decimal_negative_decimal( + self, + **kwargs: Any + ) -> None: """Put big decimal value -99999999.99. :keyword number_body: The default value is -99999999.99. Note that overriding this default @@ -946,13 +1312,16 @@ def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - number_body = kwargs.pop("number_body", -99999999.99) # type: float + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + number_body = kwargs.pop('number_body', -99999999.99) # type: float + request = build_number_put_big_decimal_negative_decimal_request( content_type=content_type, json=number_body, @@ -960,7 +1329,9 @@ def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -971,23 +1342,34 @@ def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: + def get_big_decimal_negative_decimal( + self, + **kwargs: Any + ) -> float: """Get big decimal value -99999999.99. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_big_decimal_negative_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_big_decimal_negative_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1005,8 +1387,14 @@ def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_small_float(self, number_body: float, **kwargs: Any) -> None: + def put_small_float( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small float value 3.402823e-20. :param number_body: number body. @@ -1015,11 +1403,13 @@ def put_small_float(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -1030,7 +1420,9 @@ def put_small_float(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1041,23 +1433,34 @@ def put_small_float(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_small_float(self, **kwargs: Any) -> float: + def get_small_float( + self, + **kwargs: Any + ) -> float: """Get big double value 3.402823e-20. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_small_float_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_small_float_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1075,8 +1478,14 @@ def get_small_float(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_small_double(self, number_body: float, **kwargs: Any) -> None: + def put_small_double( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small double value 2.5976931e-101. :param number_body: number body. @@ -1085,11 +1494,13 @@ def put_small_double(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -1100,7 +1511,9 @@ def put_small_double(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1111,23 +1524,34 @@ def put_small_double(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_small_double(self, **kwargs: Any) -> float: + def get_small_double( + self, + **kwargs: Any + ) -> float: """Get big double value 2.5976931e-101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_small_double_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_small_double_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1145,8 +1569,14 @@ def get_small_double(self, **kwargs: Any) -> float: return deserialized + + @distributed_trace - def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: + def put_small_decimal( + self, + number_body: float, + **kwargs: Any + ) -> None: """Put small decimal value 2.5976931e-101. :param number_body: number body. @@ -1155,11 +1585,13 @@ def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = number_body @@ -1170,7 +1602,9 @@ def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1181,23 +1615,34 @@ def put_small_decimal(self, number_body: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_small_decimal(self, **kwargs: Any) -> float: + def get_small_decimal( + self, + **kwargs: Any + ) -> float: """Get small decimal value 2.5976931e-101. :return: float :rtype: float :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_number_get_small_decimal_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_number_get_small_decimal_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1214,3 +1659,5 @@ def get_small_decimal(self, **kwargs: Any) -> float: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py index f2c282a12aa..b71e9aed9fc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/__init__.py index 86f0d888647..d160e037104 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATService"] +__all__ = ['AutoRestSwaggerBATService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_auto_rest_swagger_bat_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_auto_rest_swagger_bat_service.py index 7a4b7be2f7f..ec5495f9aa3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_auto_rest_swagger_bat_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_auto_rest_swagger_bat_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATService: """Test Infrastructure for AutoRest Swagger BAT. @@ -32,8 +31,13 @@ class AutoRestSwaggerBATService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -43,6 +47,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.string = StringOperations(self._client, self._config, self._serialize, self._deserialize) self.enum = EnumOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_configuration.py index 1239968e001..abe4315ba6a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATServiceConfiguration(Configuration): # pylint: disable= attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/__init__.py index 865075d6286..9fe2b43623d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_service import AutoRestSwaggerBATService - -__all__ = ["AutoRestSwaggerBATService"] +__all__ = ['AutoRestSwaggerBATService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_auto_rest_swagger_bat_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_auto_rest_swagger_bat_service.py index d7afc70aba1..b6370b08d8f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_auto_rest_swagger_bat_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_auto_rest_swagger_bat_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATService: """Test Infrastructure for AutoRest Swagger BAT. @@ -32,7 +31,12 @@ class AutoRestSwaggerBATService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -42,7 +46,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.string = StringOperations(self._client, self._config, self._serialize, self._deserialize) self.enum = EnumOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_configuration.py index 9f14e32ca57..95456b43dd5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATServiceConfiguration(Configuration): # pylint: disable= attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/__init__.py index 8ff22dfdab2..17de4587c53 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import EnumOperations __all__ = [ - "StringOperations", - "EnumOperations", + 'StringOperations', + 'EnumOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py index 7ce1d323aae..41174285d57 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py @@ -8,45 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_enum_get_not_expandable_request, - build_enum_get_referenced_constant_request, - build_enum_get_referenced_request, - build_enum_put_not_expandable_request, - build_enum_put_referenced_constant_request, - build_enum_put_referenced_request, - build_string_get_base64_encoded_request, - build_string_get_base64_url_encoded_request, - build_string_get_empty_request, - build_string_get_mbcs_request, - build_string_get_not_provided_request, - build_string_get_null_base64_url_encoded_request, - build_string_get_null_request, - build_string_get_whitespace_request, - build_string_put_base64_url_encoded_request, - build_string_put_empty_request, - build_string_put_mbcs_request, - build_string_put_null_request, - build_string_put_whitespace_request, -) - -T = TypeVar("T") +from ...operations._operations import build_enum_get_not_expandable_request, build_enum_get_referenced_constant_request, build_enum_get_referenced_request, build_enum_put_not_expandable_request, build_enum_put_referenced_constant_request, build_enum_put_referenced_request, build_string_get_base64_encoded_request, build_string_get_base64_url_encoded_request, build_string_get_empty_request, build_string_get_mbcs_request, build_string_get_not_provided_request, build_string_get_null_base64_url_encoded_request, build_string_get_null_request, build_string_get_whitespace_request, build_string_put_base64_url_encoded_request, build_string_put_empty_request, build_string_put_mbcs_request, build_string_put_null_request, build_string_put_whitespace_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class StringOperations: """StringOperations async operations. @@ -66,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_null(self, **kwargs: Any) -> Optional[str]: + async def get_null( + self, + **kwargs: Any + ) -> Optional[str]: """Get null string value value. :return: str or None :rtype: str or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -99,8 +80,14 @@ async def get_null(self, **kwargs: Any) -> Optional[str]: return deserialized + + @distributed_trace_async - async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> None: + async def put_null( + self, + string_body: Optional[str] = None, + **kwargs: Any + ) -> None: """Set string value null. :param string_body: string body. @@ -109,11 +96,13 @@ async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if string_body is not None: _json = string_body @@ -127,7 +116,9 @@ async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> No request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -138,23 +129,34 @@ async def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> str: + async def get_empty( + self, + **kwargs: Any + ) -> str: """Get empty string value value ''. :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -172,8 +174,13 @@ async def get_empty(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def put_empty(self, **kwargs: Any) -> None: + async def put_empty( + self, + **kwargs: Any + ) -> None: """Set string value empty ''. :keyword string_body: string body. The default value is "". Note that overriding this default @@ -183,13 +190,16 @@ async def put_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop("string_body", "") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "") # type: str + request = build_string_put_empty_request( content_type=content_type, json=string_body, @@ -197,7 +207,9 @@ async def put_empty(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -208,23 +220,34 @@ async def put_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_mbcs(self, **kwargs: Any) -> str: + async def get_mbcs( + self, + **kwargs: Any + ) -> str: """Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_mbcs_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_mbcs_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -242,8 +265,13 @@ async def get_mbcs(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def put_mbcs(self, **kwargs: Any) -> None: + async def put_mbcs( + self, + **kwargs: Any + ) -> None: """Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. :keyword string_body: string body. The default value is @@ -254,15 +282,16 @@ async def put_mbcs(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€" - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str + request = build_string_put_mbcs_request( content_type=content_type, json=string_body, @@ -270,7 +299,9 @@ async def put_mbcs(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -281,8 +312,13 @@ async def put_mbcs(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_whitespace(self, **kwargs: Any) -> str: + async def get_whitespace( + self, + **kwargs: Any + ) -> str: """Get string value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -291,15 +327,21 @@ async def get_whitespace(self, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_whitespace_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_whitespace_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -317,8 +359,13 @@ async def get_whitespace(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def put_whitespace(self, **kwargs: Any) -> None: + async def put_whitespace( + self, + **kwargs: Any + ) -> None: """Set String value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -331,15 +378,16 @@ async def put_whitespace(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", " Now is the time for all good men to come to the aid of their country " - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', " Now is the time for all good men to come to the aid of their country ") # type: str + request = build_string_put_whitespace_request( content_type=content_type, json=string_body, @@ -347,7 +395,9 @@ async def put_whitespace(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -358,23 +408,34 @@ async def put_whitespace(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_not_provided(self, **kwargs: Any) -> str: + async def get_not_provided( + self, + **kwargs: Any + ) -> str: """Get String value when no string value is sent in response payload. :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -392,23 +453,34 @@ async def get_not_provided(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def get_base64_encoded(self, **kwargs: Any) -> bytearray: + async def get_base64_encoded( + self, + **kwargs: Any + ) -> bytearray: """Get value that is base64 encoded. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_base64_encoded_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_base64_encoded_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -426,23 +498,34 @@ async def get_base64_encoded(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace_async - async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: + async def get_base64_url_encoded( + self, + **kwargs: Any + ) -> bytes: """Get value that is base64url encoded. :return: bytes :rtype: bytes :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytes] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_base64_url_encoded_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytes] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_base64_url_encoded_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -460,8 +543,14 @@ async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: return deserialized + + @distributed_trace_async - async def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> None: + async def put_base64_url_encoded( + self, + string_body: bytes, + **kwargs: Any + ) -> None: """Put value that is base64url encoded. :param string_body: string body. @@ -470,11 +559,13 @@ async def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = string_body @@ -485,7 +576,9 @@ async def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> Non request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -496,23 +589,34 @@ async def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: + async def get_null_base64_url_encoded( + self, + **kwargs: Any + ) -> Optional[bytes]: """Get null value that is expected to be base64url encoded. :return: bytes or None :rtype: bytes or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_null_base64_url_encoded_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_null_base64_url_encoded_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -550,7 +654,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_not_expandable(self, **kwargs: Any) -> str: + async def get_not_expandable( + self, + **kwargs: Any + ) -> str: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :return: str. Possible values are: "red color", "green-color", and "blue_color". @@ -563,15 +670,21 @@ async def get_not_expandable(self, **kwargs: Any) -> str: # response body for status code(s): 200 response.json() == "str" # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_enum_get_not_expandable_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_enum_get_not_expandable_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -589,8 +702,14 @@ async def get_not_expandable(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: + async def put_not_expandable( + self, + string_body: str, + **kwargs: Any + ) -> None: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :param string_body: string body. Possible values are: "red color", "green-color", and @@ -600,11 +719,13 @@ async def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = string_body @@ -615,7 +736,9 @@ async def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -626,8 +749,13 @@ async def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_referenced(self, **kwargs: Any) -> str: + async def get_referenced( + self, + **kwargs: Any + ) -> str: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :return: str. Possible values are: "red color", "green-color", and "blue_color". @@ -640,15 +768,21 @@ async def get_referenced(self, **kwargs: Any) -> str: # response body for status code(s): 200 response.json() == "str" # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_enum_get_referenced_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_enum_get_referenced_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -666,8 +800,14 @@ async def get_referenced(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: + async def put_referenced( + self, + enum_string_body: str, + **kwargs: Any + ) -> None: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :param enum_string_body: enum string body. Possible values are: "red color", "green-color", and @@ -677,11 +817,13 @@ async def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = enum_string_body @@ -692,7 +834,9 @@ async def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -703,8 +847,13 @@ async def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_referenced_constant(self, **kwargs: Any) -> JSONType: + async def get_referenced_constant( + self, + **kwargs: Any + ) -> JSONType: """Get value 'green-color' from the constant. :return: JSON object @@ -721,15 +870,21 @@ async def get_referenced_constant(self, **kwargs: Any) -> JSONType: "field1": "str" # Optional. Sample string. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_enum_get_referenced_constant_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_enum_get_referenced_constant_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -747,8 +902,14 @@ async def get_referenced_constant(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: Any) -> None: + async def put_referenced_constant( + self, + enum_string_body: JSONType, + **kwargs: Any + ) -> None: """Sends value 'green-color' from a constant. :param enum_string_body: enum string body. @@ -767,11 +928,13 @@ async def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: An "field1": "str" # Optional. Sample string. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = enum_string_body @@ -782,7 +945,9 @@ async def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -792,3 +957,5 @@ async def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: An if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/__init__.py index 8ff22dfdab2..17de4587c53 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import EnumOperations __all__ = [ - "StringOperations", - "EnumOperations", + 'StringOperations', + 'EnumOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py index 62642adf5cc..8823926e98b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py @@ -8,295 +8,441 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_string_get_null_request(**kwargs: Any) -> HttpRequest: +def build_string_get_null_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/null" + url = '/string/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_put_null_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_string_put_null_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/null" + url = '/string/null' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_string_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_string_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/empty" + url = '/string/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_put_empty_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", "") # type: str +def build_string_put_empty_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', "") # type: str accept = "application/json" # Construct URL - url = "/string/empty" + url = '/string/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_string_get_mbcs_request(**kwargs: Any) -> HttpRequest: +def build_string_get_mbcs_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/mbcs" + url = '/string/mbcs' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_put_mbcs_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop("json", "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str +def build_string_put_mbcs_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str accept = "application/json" # Construct URL - url = "/string/mbcs" + url = '/string/mbcs' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_string_get_whitespace_request(**kwargs: Any) -> HttpRequest: +def build_string_get_whitespace_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/whitespace" + url = '/string/whitespace' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_put_whitespace_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] - json = kwargs.pop( - "json", " Now is the time for all good men to come to the aid of their country " - ) # type: str +def build_string_put_whitespace_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + json = kwargs.pop('json', " Now is the time for all good men to come to the aid of their country ") # type: str accept = "application/json" # Construct URL - url = "/string/whitespace" + url = '/string/whitespace' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + **kwargs + ) -def build_string_get_not_provided_request(**kwargs: Any) -> HttpRequest: +def build_string_get_not_provided_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/notProvided" + url = '/string/notProvided' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_get_base64_encoded_request(**kwargs: Any) -> HttpRequest: +def build_string_get_base64_encoded_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/base64Encoding" + url = '/string/base64Encoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_string_get_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: +def build_string_get_base64_url_encoded_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/base64UrlEncoding" + url = '/string/base64UrlEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_string_put_base64_url_encoded_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/base64UrlEncoding" + url = '/string/base64UrlEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_string_get_null_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: +def build_string_get_null_base64_url_encoded_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/nullBase64UrlEncoding" + url = '/string/nullBase64UrlEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_enum_get_not_expandable_request(**kwargs: Any) -> HttpRequest: +def build_enum_get_not_expandable_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/enum/notExpandable" + url = '/string/enum/notExpandable' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_enum_put_not_expandable_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_enum_put_not_expandable_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/enum/notExpandable" + url = '/string/enum/notExpandable' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_enum_get_referenced_request(**kwargs: Any) -> HttpRequest: +def build_enum_get_referenced_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/enum/Referenced" + url = '/string/enum/Referenced' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_enum_put_referenced_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_enum_put_referenced_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/enum/Referenced" + url = '/string/enum/Referenced' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_enum_get_referenced_constant_request(**kwargs: Any) -> HttpRequest: +def build_enum_get_referenced_constant_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/string/enum/ReferencedConstant" + url = '/string/enum/ReferencedConstant' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_enum_put_referenced_constant_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/string/enum/ReferencedConstant" + url = '/string/enum/ReferencedConstant' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class StringOperations(object): """StringOperations operations. @@ -317,22 +463,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_null(self, **kwargs: Any) -> Optional[str]: + def get_null( + self, + **kwargs: Any + ) -> Optional[str]: """Get null string value value. :return: str or None :rtype: str or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[str]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_null_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[str]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_null_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -350,8 +505,14 @@ def get_null(self, **kwargs: Any) -> Optional[str]: return deserialized + + @distributed_trace - def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> None: + def put_null( + self, + string_body: Optional[str] = None, + **kwargs: Any + ) -> None: """Set string value null. :param string_body: string body. @@ -360,11 +521,13 @@ def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if string_body is not None: _json = string_body @@ -378,7 +541,9 @@ def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -389,23 +554,34 @@ def put_null(self, string_body: Optional[str] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty(self, **kwargs: Any) -> str: + def get_empty( + self, + **kwargs: Any + ) -> str: """Get empty string value value ''. :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_empty_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -423,8 +599,13 @@ def get_empty(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def put_empty(self, **kwargs: Any) -> None: + def put_empty( + self, + **kwargs: Any + ) -> None: """Set string value empty ''. :keyword string_body: string body. The default value is "". Note that overriding this default @@ -434,13 +615,16 @@ def put_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop("string_body", "") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "") # type: str + request = build_string_put_empty_request( content_type=content_type, json=string_body, @@ -448,7 +632,9 @@ def put_empty(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -459,23 +645,34 @@ def put_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_mbcs(self, **kwargs: Any) -> str: + def get_mbcs( + self, + **kwargs: Any + ) -> str: """Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_mbcs_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_mbcs_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -493,8 +690,13 @@ def get_mbcs(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def put_mbcs(self, **kwargs: Any) -> None: + def put_mbcs( + self, + **kwargs: Any + ) -> None: """Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. :keyword string_body: string body. The default value is @@ -505,15 +707,16 @@ def put_mbcs(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€" - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str + request = build_string_put_mbcs_request( content_type=content_type, json=string_body, @@ -521,7 +724,9 @@ def put_mbcs(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -532,8 +737,13 @@ def put_mbcs(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_whitespace(self, **kwargs: Any) -> str: + def get_whitespace( + self, + **kwargs: Any + ) -> str: """Get string value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -542,15 +752,21 @@ def get_whitespace(self, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_whitespace_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_whitespace_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -568,8 +784,13 @@ def get_whitespace(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def put_whitespace(self, **kwargs: Any) -> None: + def put_whitespace( + self, + **kwargs: Any + ) -> None: """Set String value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -582,15 +803,16 @@ def put_whitespace(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - string_body = kwargs.pop( - "string_body", " Now is the time for all good men to come to the aid of their country " - ) # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + string_body = kwargs.pop('string_body', " Now is the time for all good men to come to the aid of their country ") # type: str + request = build_string_put_whitespace_request( content_type=content_type, json=string_body, @@ -598,7 +820,9 @@ def put_whitespace(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -609,23 +833,34 @@ def put_whitespace(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_not_provided(self, **kwargs: Any) -> str: + def get_not_provided( + self, + **kwargs: Any + ) -> str: """Get String value when no string value is sent in response payload. :return: str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_not_provided_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_not_provided_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -643,23 +878,34 @@ def get_not_provided(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def get_base64_encoded(self, **kwargs: Any) -> bytearray: + def get_base64_encoded( + self, + **kwargs: Any + ) -> bytearray: """Get value that is base64 encoded. :return: bytearray :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytearray] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_base64_encoded_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_base64_encoded_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -677,23 +923,34 @@ def get_base64_encoded(self, **kwargs: Any) -> bytearray: return deserialized + + @distributed_trace - def get_base64_url_encoded(self, **kwargs: Any) -> bytes: + def get_base64_url_encoded( + self, + **kwargs: Any + ) -> bytes: """Get value that is base64url encoded. :return: bytes :rtype: bytes :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bytes] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_base64_url_encoded_request() + cls = kwargs.pop('cls', None) # type: ClsType[bytes] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_base64_url_encoded_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -711,8 +968,14 @@ def get_base64_url_encoded(self, **kwargs: Any) -> bytes: return deserialized + + @distributed_trace - def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> None: + def put_base64_url_encoded( + self, + string_body: bytes, + **kwargs: Any + ) -> None: """Put value that is base64url encoded. :param string_body: string body. @@ -721,11 +984,13 @@ def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = string_body @@ -736,7 +1001,9 @@ def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -747,23 +1014,34 @@ def put_base64_url_encoded(self, string_body: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: + def get_null_base64_url_encoded( + self, + **kwargs: Any + ) -> Optional[bytes]: """Get null value that is expected to be base64url encoded. :return: bytes or None :rtype: bytes or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[bytes]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_string_get_null_base64_url_encoded_request() + cls = kwargs.pop('cls', None) # type: ClsType[Optional[bytes]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_string_get_null_base64_url_encoded_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -801,7 +1079,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_not_expandable(self, **kwargs: Any) -> str: + def get_not_expandable( + self, + **kwargs: Any + ) -> str: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :return: str. Possible values are: "red color", "green-color", and "blue_color". @@ -814,15 +1095,21 @@ def get_not_expandable(self, **kwargs: Any) -> str: # response body for status code(s): 200 response.json() == "str" # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_enum_get_not_expandable_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_enum_get_not_expandable_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -840,8 +1127,14 @@ def get_not_expandable(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: + def put_not_expandable( + self, + string_body: str, + **kwargs: Any + ) -> None: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :param string_body: string body. Possible values are: "red color", "green-color", and @@ -851,11 +1144,13 @@ def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = string_body @@ -866,7 +1161,9 @@ def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -877,8 +1174,13 @@ def put_not_expandable(self, string_body: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_referenced(self, **kwargs: Any) -> str: + def get_referenced( + self, + **kwargs: Any + ) -> str: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :return: str. Possible values are: "red color", "green-color", and "blue_color". @@ -891,15 +1193,21 @@ def get_referenced(self, **kwargs: Any) -> str: # response body for status code(s): 200 response.json() == "str" # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_enum_get_referenced_request() + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_enum_get_referenced_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -917,8 +1225,14 @@ def get_referenced(self, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: + def put_referenced( + self, + enum_string_body: str, + **kwargs: Any + ) -> None: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. :param enum_string_body: enum string body. Possible values are: "red color", "green-color", and @@ -928,11 +1242,13 @@ def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = enum_string_body @@ -943,7 +1259,9 @@ def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -954,8 +1272,13 @@ def put_referenced(self, enum_string_body: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_referenced_constant(self, **kwargs: Any) -> JSONType: + def get_referenced_constant( + self, + **kwargs: Any + ) -> JSONType: """Get value 'green-color' from the constant. :return: JSON object @@ -972,15 +1295,21 @@ def get_referenced_constant(self, **kwargs: Any) -> JSONType: "field1": "str" # Optional. Sample string. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_enum_get_referenced_constant_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_enum_get_referenced_constant_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -998,8 +1327,14 @@ def get_referenced_constant(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: Any) -> None: + def put_referenced_constant( + self, + enum_string_body: JSONType, + **kwargs: Any + ) -> None: """Sends value 'green-color' from a constant. :param enum_string_body: enum string body. @@ -1018,11 +1353,13 @@ def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: Any) -> "field1": "str" # Optional. Sample string. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = enum_string_body @@ -1033,7 +1370,9 @@ def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1043,3 +1382,5 @@ def put_referenced_constant(self, enum_string_body: JSONType, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py index f9bbe0b13fa..ae0d28c8999 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/__init__.py index 56812fdf84f..53543c20c80 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestTimeTestService"] +__all__ = ['AutoRestTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_auto_rest_time_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_auto_rest_time_test_service.py index 6c4b530ed31..29ca95cff2e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_auto_rest_time_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_auto_rest_time_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestTimeTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.time = TimeOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_configuration.py index 92c452e95b6..352745eeef4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestTimeTestServiceConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresttimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresttimetestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/__init__.py index fc22a80891c..2bd831529fc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_time_test_service import AutoRestTimeTestService - -__all__ = ["AutoRestTimeTestService"] +__all__ = ['AutoRestTimeTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_auto_rest_time_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_auto_rest_time_test_service.py index 33471b55954..64fb042c842 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_auto_rest_time_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_auto_rest_time_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestTimeTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestTimeTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestTimeTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.time = TimeOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_configuration.py index 4cc72dc2ebf..16d51d576b8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestTimeTestServiceConfiguration(Configuration): # pylint: disable=to attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestTimeTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresttimetestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresttimetestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/__init__.py index 0e2ee0deef8..4706a5e4b8c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import TimeOperations __all__ = [ - "TimeOperations", + 'TimeOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py index a6049fa5d6a..939bdd6f4d2 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py @@ -9,25 +9,17 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ...operations._operations import build_time_get_request, build_time_put_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class TimeOperations: """TimeOperations async operations. @@ -47,22 +39,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get(self, **kwargs: Any) -> datetime.time: + async def get( + self, + **kwargs: Any + ) -> datetime.time: """Get time value "11:34:56". :return: time :rtype: ~datetime.time :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.time] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_time_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.time] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_time_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -80,8 +81,14 @@ async def get(self, **kwargs: Any) -> datetime.time: return deserialized + + @distributed_trace_async - async def put(self, time_body: datetime.time, **kwargs: Any) -> str: + async def put( + self, + time_body: datetime.time, + **kwargs: Any + ) -> str: """Put time value "08:07:56". :param time_body: Put time value "08:07:56" in parameter to pass testserver. @@ -90,11 +97,13 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = time_body @@ -105,7 +114,9 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -122,3 +133,5 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/__init__.py index 0e2ee0deef8..4706a5e4b8c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import TimeOperations __all__ = [ - "TimeOperations", + 'TimeOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py index a803a0f12af..4c449dbdabc 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py @@ -9,54 +9,64 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_time_get_request(**kwargs: Any) -> HttpRequest: +def build_time_get_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/time/get" + url = '/time/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_time_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_time_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/time/put" + url = '/time/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class TimeOperations(object): """TimeOperations operations. @@ -77,22 +87,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get(self, **kwargs: Any) -> datetime.time: + def get( + self, + **kwargs: Any + ) -> datetime.time: """Get time value "11:34:56". :return: time :rtype: ~datetime.time :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[datetime.time] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_time_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[datetime.time] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_time_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -110,8 +129,14 @@ def get(self, **kwargs: Any) -> datetime.time: return deserialized + + @distributed_trace - def put(self, time_body: datetime.time, **kwargs: Any) -> str: + def put( + self, + time_body: datetime.time, + **kwargs: Any + ) -> str: """Put time value "08:07:56". :param time_body: Put time value "08:07:56" in parameter to pass testserver. @@ -120,11 +145,13 @@ def put(self, time_body: datetime.time, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = time_body @@ -135,7 +162,9 @@ def put(self, time_body: datetime.time, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -152,3 +181,5 @@ def put(self, time_body: datetime.time, **kwargs: Any) -> str: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py index 4c61b19cc21..83bbaeff6d5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/__init__.py index 6010eb2ed79..1fbf0c53df8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerConstantService"] +__all__ = ['AutoRestSwaggerConstantService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_auto_rest_swagger_constant_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_auto_rest_swagger_constant_service.py index f3dcf7ec18b..ba77ce5794f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_auto_rest_swagger_constant_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_auto_rest_swagger_constant_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerConstantService: """Test Infrastructure for AutoRest Swagger Constant. @@ -42,8 +41,13 @@ class AutoRestSwaggerConstantService: :paramtype path_constant: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerConstantServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -52,6 +56,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.contants = ContantsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_configuration.py index 921890aeb1a..69d830fd5f5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_configuration.py @@ -34,28 +34,33 @@ class AutoRestSwaggerConstantServiceConfiguration(Configuration): # pylint: dis :paramtype path_constant: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerConstantServiceConfiguration, self).__init__(**kwargs) - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str + self.header_constant = header_constant self.query_constant = query_constant self.path_constant = path_constant - kwargs.setdefault("sdk_moniker", "autorestswaggerconstantservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerconstantservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/__init__.py index 84d9e53e91d..06b58b00b84 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_constant_service import AutoRestSwaggerConstantService - -__all__ = ["AutoRestSwaggerConstantService"] +__all__ = ['AutoRestSwaggerConstantService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_auto_rest_swagger_constant_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_auto_rest_swagger_constant_service.py index cf6a18180c2..edda7bb6111 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_auto_rest_swagger_constant_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_auto_rest_swagger_constant_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerConstantService: """Test Infrastructure for AutoRest Swagger Constant. @@ -42,7 +41,12 @@ class AutoRestSwaggerConstantService: :paramtype path_constant: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerConstantServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -51,7 +55,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.contants = ContantsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_configuration.py index 220039724e9..7b9bc4f8ac9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_configuration.py @@ -34,25 +34,32 @@ class AutoRestSwaggerConstantServiceConfiguration(Configuration): # pylint: dis :paramtype path_constant: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerConstantServiceConfiguration, self).__init__(**kwargs) - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str + self.header_constant = header_constant self.query_constant = query_constant self.path_constant = path_constant - kwargs.setdefault("sdk_moniker", "autorestswaggerconstantservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerconstantservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/__init__.py index b517725bbb1..a7591d91339 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ContantsOperations __all__ = [ - "ContantsOperations", + 'ContantsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py index ff2c98e0c53..639e09f6271 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py @@ -8,42 +8,16 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_contants_put_client_constants_request, - build_contants_put_model_as_string_no_required_one_value_default_request, - build_contants_put_model_as_string_no_required_one_value_no_default_request, - build_contants_put_model_as_string_no_required_two_value_default_request, - build_contants_put_model_as_string_no_required_two_value_no_default_request, - build_contants_put_model_as_string_required_one_value_default_request, - build_contants_put_model_as_string_required_one_value_no_default_request, - build_contants_put_model_as_string_required_two_value_default_request, - build_contants_put_model_as_string_required_two_value_no_default_request, - build_contants_put_no_model_as_string_no_required_one_value_default_request, - build_contants_put_no_model_as_string_no_required_one_value_no_default_request, - build_contants_put_no_model_as_string_no_required_two_value_default_request, - build_contants_put_no_model_as_string_no_required_two_value_no_default_request, - build_contants_put_no_model_as_string_required_one_value_default_request, - build_contants_put_no_model_as_string_required_one_value_no_default_request, - build_contants_put_no_model_as_string_required_two_value_default_request, - build_contants_put_no_model_as_string_required_two_value_no_default_request, -) - -T = TypeVar("T") +from ...operations._operations import build_contants_put_client_constants_request, build_contants_put_model_as_string_no_required_one_value_default_request, build_contants_put_model_as_string_no_required_one_value_no_default_request, build_contants_put_model_as_string_no_required_two_value_default_request, build_contants_put_model_as_string_no_required_two_value_no_default_request, build_contants_put_model_as_string_required_one_value_default_request, build_contants_put_model_as_string_required_one_value_no_default_request, build_contants_put_model_as_string_required_two_value_default_request, build_contants_put_model_as_string_required_two_value_no_default_request, build_contants_put_no_model_as_string_no_required_one_value_default_request, build_contants_put_no_model_as_string_no_required_one_value_no_default_request, build_contants_put_no_model_as_string_no_required_two_value_default_request, build_contants_put_no_model_as_string_no_required_two_value_no_default_request, build_contants_put_no_model_as_string_required_one_value_default_request, build_contants_put_no_model_as_string_required_one_value_no_default_request, build_contants_put_no_model_as_string_required_two_value_default_request, build_contants_put_no_model_as_string_required_two_value_no_default_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ContantsOperations: """ContantsOperations async operations. @@ -64,7 +38,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: @distributed_trace_async async def put_no_model_as_string_no_required_two_value_no_default( - self, *, input: Optional[str] = None, **kwargs: Any + self, + *, + input: Optional[str] = None, + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -76,17 +53,22 @@ async def put_no_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_no_model_as_string_no_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -97,9 +79,14 @@ async def put_no_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def put_no_model_as_string_no_required_two_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -111,17 +98,22 @@ async def put_no_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_no_model_as_string_no_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -132,9 +124,14 @@ async def put_no_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def put_no_model_as_string_no_required_one_value_no_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -146,17 +143,22 @@ async def put_no_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_no_model_as_string_no_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -167,9 +169,14 @@ async def put_no_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def put_no_model_as_string_no_required_one_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -181,17 +188,22 @@ async def put_no_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_no_model_as_string_no_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -202,8 +214,15 @@ async def put_no_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_no_model_as_string_required_two_value_no_default(self, *, input: str, **kwargs: Any) -> None: + async def put_no_model_as_string_required_two_value_no_default( + self, + *, + input: str, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -214,17 +233,22 @@ async def put_no_model_as_string_required_two_value_no_default(self, *, input: s :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_no_model_as_string_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -235,8 +259,15 @@ async def put_no_model_as_string_required_two_value_no_default(self, *, input: s if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_no_model_as_string_required_two_value_default(self, *, input: str = "value1", **kwargs: Any) -> None: + async def put_no_model_as_string_required_two_value_default( + self, + *, + input: str = "value1", + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -247,17 +278,22 @@ async def put_no_model_as_string_required_two_value_default(self, *, input: str :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_no_model_as_string_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -268,8 +304,13 @@ async def put_no_model_as_string_required_two_value_default(self, *, input: str if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_no_model_as_string_required_one_value_no_default(self, **kwargs: Any) -> None: + async def put_no_model_as_string_required_one_value_no_default( + self, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -281,19 +322,24 @@ async def put_no_model_as_string_required_one_value_no_default(self, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_contants_put_no_model_as_string_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -304,8 +350,13 @@ async def put_no_model_as_string_required_one_value_no_default(self, **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) -> None: + async def put_no_model_as_string_required_one_value_default( + self, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -317,19 +368,24 @@ async def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_contants_put_no_model_as_string_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -340,9 +396,14 @@ async def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def put_model_as_string_no_required_two_value_no_default( - self, *, input: Optional[str] = None, **kwargs: Any + self, + *, + input: Optional[str] = None, + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -354,17 +415,22 @@ async def put_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_no_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -375,9 +441,14 @@ async def put_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def put_model_as_string_no_required_two_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -389,17 +460,22 @@ async def put_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_no_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -410,9 +486,14 @@ async def put_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def put_model_as_string_no_required_one_value_no_default( - self, *, input: Optional[str] = None, **kwargs: Any + self, + *, + input: Optional[str] = None, + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -424,17 +505,22 @@ async def put_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_no_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -445,9 +531,14 @@ async def put_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def put_model_as_string_no_required_one_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -459,17 +550,22 @@ async def put_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_no_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -480,8 +576,15 @@ async def put_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_model_as_string_required_two_value_no_default(self, *, input: str, **kwargs: Any) -> None: + async def put_model_as_string_required_two_value_no_default( + self, + *, + input: str, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -492,17 +595,22 @@ async def put_model_as_string_required_two_value_no_default(self, *, input: str, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -513,8 +621,15 @@ async def put_model_as_string_required_two_value_no_default(self, *, input: str, if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_model_as_string_required_two_value_default(self, *, input: str = "value1", **kwargs: Any) -> None: + async def put_model_as_string_required_two_value_default( + self, + *, + input: str = "value1", + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -525,17 +640,22 @@ async def put_model_as_string_required_two_value_default(self, *, input: str = " :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -546,8 +666,15 @@ async def put_model_as_string_required_two_value_default(self, *, input: str = " if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_model_as_string_required_one_value_no_default(self, *, input: str, **kwargs: Any) -> None: + async def put_model_as_string_required_one_value_no_default( + self, + *, + input: str, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -558,17 +685,22 @@ async def put_model_as_string_required_one_value_no_default(self, *, input: str, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -579,8 +711,15 @@ async def put_model_as_string_required_one_value_no_default(self, *, input: str, if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_model_as_string_required_one_value_default(self, *, input: str = "value1", **kwargs: Any) -> None: + async def put_model_as_string_required_one_value_default( + self, + *, + input: str = "value1", + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -591,17 +730,22 @@ async def put_model_as_string_required_one_value_default(self, *, input: str = " :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_model_as_string_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -612,8 +756,13 @@ async def put_model_as_string_required_one_value_default(self, *, input: str = " if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_client_constants(self, **kwargs: Any) -> None: + async def put_client_constants( + self, + **kwargs: Any + ) -> None: """Pass constants from the client to this function. Will pass in constant path, query, and header parameters. @@ -621,10 +770,13 @@ async def put_client_constants(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_client_constants_request( header_constant=self._config.header_constant, query_constant=self._config.query_constant, @@ -633,7 +785,9 @@ async def put_client_constants(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -643,3 +797,5 @@ async def put_client_constants(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/__init__.py index b517725bbb1..a7591d91339 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ContantsOperations __all__ = [ - "ContantsOperations", + 'ContantsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py index c6de16a2f42..b3205aeda3e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,253 +16,370 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_contants_put_no_model_as_string_no_required_two_value_no_default_request( - *, input: Optional[str] = None, **kwargs: Any + *, + input: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putNoModelAsStringNoRequiredTwoValueNoDefault" + url = '/constants/putNoModelAsStringNoRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_no_model_as_string_no_required_two_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putNoModelAsStringNoRequiredTwoValueDefault" + url = '/constants/putNoModelAsStringNoRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_no_model_as_string_no_required_one_value_no_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putNoModelAsStringNoRequiredOneValueNoDefault" + url = '/constants/putNoModelAsStringNoRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_no_model_as_string_no_required_one_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putNoModelAsStringNoRequiredOneValueDefault" + url = '/constants/putNoModelAsStringNoRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_no_model_as_string_required_two_value_no_default_request( - *, input: str, **kwargs: Any + *, + input: str, + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putNoModelAsStringRequiredTwoValueNoDefault" + url = '/constants/putNoModelAsStringRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_no_model_as_string_required_two_value_default_request( - *, input: str = "value1", **kwargs: Any + *, + input: str = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putNoModelAsStringRequiredTwoValueDefault" + url = '/constants/putNoModelAsStringRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_contants_put_no_model_as_string_required_one_value_no_default_request(**kwargs: Any) -> HttpRequest: - input = kwargs.pop("input", "value1") # type: str +def build_contants_put_no_model_as_string_required_one_value_no_default_request( + **kwargs: Any +) -> HttpRequest: + input = kwargs.pop('input', "value1") # type: str # Construct URL - url = "/constants/putNoModelAsStringRequiredOneValueNoDefault" + url = '/constants/putNoModelAsStringRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_contants_put_no_model_as_string_required_one_value_default_request(**kwargs: Any) -> HttpRequest: - input = kwargs.pop("input", "value1") # type: str +def build_contants_put_no_model_as_string_required_one_value_default_request( + **kwargs: Any +) -> HttpRequest: + input = kwargs.pop('input', "value1") # type: str # Construct URL - url = "/constants/putNoModelAsStringRequiredOneValueDefault" + url = '/constants/putNoModelAsStringRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_no_required_two_value_no_default_request( - *, input: Optional[str] = None, **kwargs: Any + *, + input: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringNoRequiredTwoValueNoDefault" + url = '/constants/putModelAsStringNoRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_no_required_two_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringNoRequiredTwoValueDefault" + url = '/constants/putModelAsStringNoRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_no_required_one_value_no_default_request( - *, input: Optional[str] = None, **kwargs: Any + *, + input: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringNoRequiredOneValueNoDefault" + url = '/constants/putModelAsStringNoRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_no_required_one_value_default_request( - *, input: Optional[str] = "value1", **kwargs: Any + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringNoRequiredOneValueDefault" + url = '/constants/putModelAsStringNoRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if input is not None: - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_required_two_value_no_default_request( - *, input: str, **kwargs: Any + *, + input: str, + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringRequiredTwoValueNoDefault" + url = '/constants/putModelAsStringRequiredTwoValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_required_two_value_default_request( - *, input: str = "value1", **kwargs: Any + *, + input: str = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringRequiredTwoValueDefault" + url = '/constants/putModelAsStringRequiredTwoValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_required_one_value_no_default_request( - *, input: str, **kwargs: Any + *, + input: str, + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringRequiredOneValueNoDefault" + url = '/constants/putModelAsStringRequiredOneValueNoDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) def build_contants_put_model_as_string_required_one_value_default_request( - *, input: str = "value1", **kwargs: Any + *, + input: str = "value1", + **kwargs: Any ) -> HttpRequest: # Construct URL - url = "/constants/putModelAsStringRequiredOneValueDefault" + url = '/constants/putModelAsStringRequiredOneValueDefault' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["input"] = _SERIALIZER.query("input", input, "str") + query_parameters['input'] = _SERIALIZER.query("input", input, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + **kwargs + ) -def build_contants_put_client_constants_request(**kwargs: Any) -> HttpRequest: - header_constant = kwargs.pop("header_constant", True) # type: bool - query_constant = kwargs.pop("query_constant", 100) # type: int - path_constant = kwargs.pop("path_constant", "path") # type: str +def build_contants_put_client_constants_request( + **kwargs: Any +) -> HttpRequest: + header_constant = kwargs.pop('header_constant', True) # type: bool + query_constant = kwargs.pop('query_constant', 100) # type: int + path_constant = kwargs.pop('path_constant', "path") # type: str # Construct URL - url = "/constants/clientConstants/{path-constant}" + url = '/constants/clientConstants/{path-constant}' path_format_arguments = { - "path-constant": _SERIALIZER.url("path_constant", path_constant, "str"), + "path-constant": _SERIALIZER.url("path_constant", path_constant, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["query-constant"] = _SERIALIZER.query("query_constant", query_constant, "int") + query_parameters['query-constant'] = _SERIALIZER.query("query_constant", query_constant, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["header-constant"] = _SERIALIZER.header("header_constant", header_constant, "bool") - - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['header-constant'] = _SERIALIZER.header("header_constant", header_constant, 'bool') + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ContantsOperations(object): """ContantsOperations operations. @@ -290,7 +401,10 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def put_no_model_as_string_no_required_two_value_no_default( - self, *, input: Optional[str] = None, **kwargs: Any + self, + *, + input: Optional[str] = None, + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -302,17 +416,23 @@ def put_no_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_no_model_as_string_no_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -323,9 +443,14 @@ def put_no_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def put_no_model_as_string_no_required_two_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -337,17 +462,23 @@ def put_no_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_no_model_as_string_no_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -358,9 +489,14 @@ def put_no_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def put_no_model_as_string_no_required_one_value_no_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -372,17 +508,23 @@ def put_no_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_no_model_as_string_no_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -393,9 +535,14 @@ def put_no_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def put_no_model_as_string_no_required_one_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -407,17 +554,23 @@ def put_no_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_no_model_as_string_no_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -428,8 +581,15 @@ def put_no_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_no_model_as_string_required_two_value_no_default(self, *, input: str, **kwargs: Any) -> None: + def put_no_model_as_string_required_two_value_no_default( + self, + *, + input: str, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -440,17 +600,23 @@ def put_no_model_as_string_required_two_value_no_default(self, *, input: str, ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_no_model_as_string_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -461,8 +627,15 @@ def put_no_model_as_string_required_two_value_no_default(self, *, input: str, ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_no_model_as_string_required_two_value_default(self, *, input: str = "value1", **kwargs: Any) -> None: + def put_no_model_as_string_required_two_value_default( + self, + *, + input: str = "value1", + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -473,17 +646,23 @@ def put_no_model_as_string_required_two_value_default(self, *, input: str = "val :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_no_model_as_string_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -494,8 +673,13 @@ def put_no_model_as_string_required_two_value_default(self, *, input: str = "val if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_no_model_as_string_required_one_value_no_default(self, **kwargs: Any) -> None: + def put_no_model_as_string_required_one_value_no_default( + self, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -507,19 +691,24 @@ def put_no_model_as_string_required_one_value_no_default(self, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_contants_put_no_model_as_string_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -530,8 +719,13 @@ def put_no_model_as_string_required_one_value_no_default(self, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) -> None: + def put_no_model_as_string_required_one_value_default( + self, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -543,19 +737,24 @@ def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - input = kwargs.pop("input", "value1") # type: str + input = kwargs.pop('input', "value1") # type: str + request = build_contants_put_no_model_as_string_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -566,9 +765,14 @@ def put_no_model_as_string_required_one_value_default(self, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def put_model_as_string_no_required_two_value_no_default( - self, *, input: Optional[str] = None, **kwargs: Any + self, + *, + input: Optional[str] = None, + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -580,17 +784,23 @@ def put_model_as_string_no_required_two_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_no_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -601,9 +811,14 @@ def put_model_as_string_no_required_two_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def put_model_as_string_no_required_two_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -615,17 +830,23 @@ def put_model_as_string_no_required_two_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_no_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -636,9 +857,14 @@ def put_model_as_string_no_required_two_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def put_model_as_string_no_required_one_value_no_default( - self, *, input: Optional[str] = None, **kwargs: Any + self, + *, + input: Optional[str] = None, + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -650,17 +876,23 @@ def put_model_as_string_no_required_one_value_no_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_no_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -671,9 +903,14 @@ def put_model_as_string_no_required_one_value_no_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def put_model_as_string_no_required_one_value_default( - self, *, input: Optional[str] = "value1", **kwargs: Any + self, + *, + input: Optional[str] = "value1", + **kwargs: Any ) -> None: """Puts constants to the testserver. @@ -685,17 +922,23 @@ def put_model_as_string_no_required_one_value_default( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_no_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -706,8 +949,15 @@ def put_model_as_string_no_required_one_value_default( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_model_as_string_required_two_value_no_default(self, *, input: str, **kwargs: Any) -> None: + def put_model_as_string_required_two_value_no_default( + self, + *, + input: str, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -718,17 +968,23 @@ def put_model_as_string_required_two_value_no_default(self, *, input: str, **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_required_two_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -739,8 +995,15 @@ def put_model_as_string_required_two_value_no_default(self, *, input: str, **kwa if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_model_as_string_required_two_value_default(self, *, input: str = "value1", **kwargs: Any) -> None: + def put_model_as_string_required_two_value_default( + self, + *, + input: str = "value1", + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -751,17 +1014,23 @@ def put_model_as_string_required_two_value_default(self, *, input: str = "value1 :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_required_two_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -772,8 +1041,15 @@ def put_model_as_string_required_two_value_default(self, *, input: str = "value1 if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_model_as_string_required_one_value_no_default(self, *, input: str, **kwargs: Any) -> None: + def put_model_as_string_required_one_value_no_default( + self, + *, + input: str, + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -784,17 +1060,23 @@ def put_model_as_string_required_one_value_no_default(self, *, input: str, **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_required_one_value_no_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -805,8 +1087,15 @@ def put_model_as_string_required_one_value_no_default(self, *, input: str, **kwa if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_model_as_string_required_one_value_default(self, *, input: str = "value1", **kwargs: Any) -> None: + def put_model_as_string_required_one_value_default( + self, + *, + input: str = "value1", + **kwargs: Any + ) -> None: """Puts constants to the testserver. Puts constants to the testserver. @@ -817,17 +1106,23 @@ def put_model_as_string_required_one_value_default(self, *, input: str = "value1 :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_contants_put_model_as_string_required_one_value_default_request( input=input, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -838,8 +1133,13 @@ def put_model_as_string_required_one_value_default(self, *, input: str = "value1 if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_client_constants(self, **kwargs: Any) -> None: + def put_client_constants( + self, + **kwargs: Any + ) -> None: """Pass constants from the client to this function. Will pass in constant path, query, and header parameters. @@ -847,10 +1147,13 @@ def put_client_constants(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_contants_put_client_constants_request( header_constant=self._config.header_constant, query_constant=self._config.query_constant, @@ -859,7 +1162,9 @@ def put_client_constants(self, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -869,3 +1174,5 @@ def put_client_constants(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py index 56088d4f1fe..5bad33ccda0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger Constant. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/__init__.py index d7e63b40724..d8d75b9e768 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedCustomHostTestClient"] +__all__ = ['AutoRestParameterizedCustomHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_auto_rest_parameterized_custom_host_test_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_auto_rest_parameterized_custom_host_test_client.py index 1b7cf5340a3..ec425e031a1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_auto_rest_parameterized_custom_host_test_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_auto_rest_parameterized_custom_host_test_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedCustomHostTestClient: """Test Infrastructure for AutoRest. @@ -33,11 +32,14 @@ class AutoRestParameterizedCustomHostTestClient: :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: - _endpoint = "{vault}{secret}{dnsSuffix}" - self._config = AutoRestParameterizedCustomHostTestClientConfiguration( - subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs - ) + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: + _endpoint = '{vault}{secret}{dnsSuffix}' + self._config = AutoRestParameterizedCustomHostTestClientConfiguration(subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -45,6 +47,7 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self._serialize.client_side_validation = False self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest @@ -69,9 +72,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_configuration.py index d3f3509bb69..4f48e8e8f71 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_configuration.py @@ -14,9 +14,7 @@ from ._version import VERSION -class AutoRestParameterizedCustomHostTestClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedCustomHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -29,7 +27,12 @@ class AutoRestParameterizedCustomHostTestClientConfiguration( :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedCustomHostTestClientConfiguration, self).__init__(**kwargs) if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -38,19 +41,20 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self.subscription_id = subscription_id self.dns_suffix = dns_suffix - kwargs.setdefault("sdk_moniker", "autorestparameterizedcustomhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedcustomhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/__init__.py index 2a17c79123c..d3a3857329b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_custom_host_test_client import AutoRestParameterizedCustomHostTestClient - -__all__ = ["AutoRestParameterizedCustomHostTestClient"] +__all__ = ['AutoRestParameterizedCustomHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_auto_rest_parameterized_custom_host_test_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_auto_rest_parameterized_custom_host_test_client.py index 7f10ddf2b21..7c94711a50c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_auto_rest_parameterized_custom_host_test_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_auto_rest_parameterized_custom_host_test_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedCustomHostTestClient: """Test Infrastructure for AutoRest. @@ -33,11 +32,14 @@ class AutoRestParameterizedCustomHostTestClient: :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: - _endpoint = "{vault}{secret}{dnsSuffix}" - self._config = AutoRestParameterizedCustomHostTestClientConfiguration( - subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs - ) + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: + _endpoint = '{vault}{secret}{dnsSuffix}' + self._config = AutoRestParameterizedCustomHostTestClientConfiguration(subscription_id=subscription_id, dns_suffix=dns_suffix, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -45,7 +47,12 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self._serialize.client_side_validation = False self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -65,9 +72,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_configuration.py index da0209e9a1f..8e3df826b37 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_configuration.py @@ -14,9 +14,7 @@ from .._version import VERSION -class AutoRestParameterizedCustomHostTestClientConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestParameterizedCustomHostTestClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestParameterizedCustomHostTestClient. Note that all parameters used to create this instance are saved as instance @@ -29,7 +27,12 @@ class AutoRestParameterizedCustomHostTestClientConfiguration( :type dns_suffix: str """ - def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + dns_suffix: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedCustomHostTestClientConfiguration, self).__init__(**kwargs) if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") @@ -38,16 +41,19 @@ def __init__(self, subscription_id: str, dns_suffix: str = "host", **kwargs: Any self.subscription_id = subscription_id self.dns_suffix = dns_suffix - kwargs.setdefault("sdk_moniker", "autorestparameterizedcustomhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedcustomhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/__init__.py index 43999a2ac80..d8955720c96 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py index 7e3ecc81566..b82e240162e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py @@ -8,24 +8,16 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ...operations._operations import build_paths_get_empty_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathsOperations: """PathsOperations async operations. @@ -46,7 +38,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: @distributed_trace_async async def get_empty( - self, vault: str, secret: str, key_name: str, *, key_version: Optional[str] = "v1", **kwargs: Any + self, + vault: str, + secret: str, + key_name: str, + *, + key_version: Optional[str] = "v1", + **kwargs: Any ) -> None: """Get a 200 to test a valid base uri. @@ -62,26 +60,29 @@ async def get_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_get_empty_request( key_name=key_name, subscription_id=self._config.subscription_id, key_version=key_version, ) path_format_arguments = { - "vault": self._serialize.url("vault", vault, "str", skip_quote=True), - "secret": self._serialize.url("secret", secret, "str", skip_quote=True), - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "vault": self._serialize.url("vault", vault, 'str', skip_quote=True), + "secret": self._serialize.url("secret", secret, 'str', skip_quote=True), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -91,3 +92,5 @@ async def get_empty( if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/__init__.py index 43999a2ac80..d8955720c96 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py index f058a89677b..47ed8601151 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,23 +16,25 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_paths_get_empty_request( - key_name: str, subscription_id: str, *, key_version: Optional[str] = "v1", **kwargs: Any + key_name: str, + subscription_id: str, + *, + key_version: Optional[str] = "v1", + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/customuri/{subscriptionId}/{keyName}" + url = '/customuri/{subscriptionId}/{keyName}' path_format_arguments = { - "keyName": _SERIALIZER.url("key_name", key_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "keyName": _SERIALIZER.url("key_name", key_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -46,14 +42,19 @@ def build_paths_get_empty_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if key_version is not None: - query_parameters["keyVersion"] = _SERIALIZER.query("key_version", key_version, "str") + query_parameters['keyVersion'] = _SERIALIZER.query("key_version", key_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PathsOperations(object): """PathsOperations operations. @@ -75,7 +76,13 @@ def __init__(self, client, config, serializer, deserializer): @distributed_trace def get_empty( - self, vault: str, secret: str, key_name: str, *, key_version: Optional[str] = "v1", **kwargs: Any + self, + vault: str, + secret: str, + key_name: str, + *, + key_version: Optional[str] = "v1", + **kwargs: Any ) -> None: """Get a 200 to test a valid base uri. @@ -91,26 +98,30 @@ def get_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + request = build_paths_get_empty_request( key_name=key_name, subscription_id=self._config.subscription_id, key_version=key_version, ) path_format_arguments = { - "vault": self._serialize.url("vault", vault, "str", skip_quote=True), - "secret": self._serialize.url("secret", secret, "str", skip_quote=True), - "dnsSuffix": self._serialize.url( - "self._config.dns_suffix", self._config.dns_suffix, "str", skip_quote=True - ), + "vault": self._serialize.url("vault", vault, 'str', skip_quote=True), + "secret": self._serialize.url("secret", secret, 'str', skip_quote=True), + "dnsSuffix": self._serialize.url("self._config.dns_suffix", self._config.dns_suffix, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -120,3 +131,5 @@ def get_empty( if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py index d2c84ca63b8..633bfcb7cf4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py index bcd7bcd9fec..6ef996852a7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py index 33592190623..9e0e4796e72 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_auto_rest_parameterized_host_test_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -30,8 +29,12 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -39,6 +42,7 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest @@ -63,7 +67,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py index 8d1336c7464..840dcb8cfa4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_configuration.py @@ -24,25 +24,30 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py index 0fe5782d645..3b422c27c1d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient - -__all__ = ["AutoRestParameterizedHostTestClient"] +__all__ = ['AutoRestParameterizedHostTestClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py index 11fa28c9bd9..16da86035d5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_auto_rest_parameterized_host_test_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterizedHostTestClient: """Test Infrastructure for AutoRest. @@ -30,8 +29,12 @@ class AutoRestParameterizedHostTestClient: :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: - _endpoint = "http://{accountName}{host}" + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: + _endpoint = 'http://{accountName}{host}' self._config = AutoRestParameterizedHostTestClientConfiguration(host=host, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -39,7 +42,12 @@ def __init__(self, host: str = "host", **kwargs: Any) -> None: self._deserialize = Deserializer() self.paths = PathsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -59,7 +67,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py index 54699ce96b9..789b6e8a4d7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_configuration.py @@ -24,22 +24,29 @@ class AutoRestParameterizedHostTestClientConfiguration(Configuration): # pylint :type host: str """ - def __init__(self, host: str = "host", **kwargs: Any) -> None: + def __init__( + self, + host: str = "host", + **kwargs: Any + ) -> None: super(AutoRestParameterizedHostTestClientConfiguration, self).__init__(**kwargs) if host is None: raise ValueError("Parameter 'host' must not be None.") self.host = host - kwargs.setdefault("sdk_moniker", "autorestparameterizedhosttestclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterizedhosttestclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py index 43999a2ac80..d8955720c96 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py index 0af3687d327..b65dab33b42 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py @@ -8,24 +8,16 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ...operations._operations import build_paths_get_empty_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathsOperations: """PathsOperations async operations. @@ -45,7 +37,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_empty(self, account_name: str, **kwargs: Any) -> None: + async def get_empty( + self, + account_name: str, + **kwargs: Any + ) -> None: """Get a 200 to test a valid base uri. :param account_name: Account Name. @@ -54,19 +50,25 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_paths_get_empty_request() + + request = build_paths_get_empty_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -76,3 +78,5 @@ async def get_empty(self, account_name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py index 43999a2ac80..d8955720c96 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PathsOperations __all__ = [ - "PathsOperations", + 'PathsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py index 0d8c5f76933..5a93eea3f25 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py @@ -8,36 +8,34 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - -def build_paths_get_empty_request(**kwargs: Any) -> HttpRequest: +def build_paths_get_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/customuri" + url = '/customuri' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class PathsOperations(object): """PathsOperations operations. @@ -58,7 +56,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_empty(self, account_name: str, **kwargs: Any) -> None: + def get_empty( + self, + account_name: str, + **kwargs: Any + ) -> None: """Get a 200 to test a valid base uri. :param account_name: Account Name. @@ -67,19 +69,25 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_paths_get_empty_request() + + request = build_paths_get_empty_request( + ) path_format_arguments = { - "accountName": self._serialize.url("account_name", account_name, "str", skip_quote=True), - "host": self._serialize.url("self._config.host", self._config.host, "str", skip_quote=True), + "accountName": self._serialize.url("account_name", account_name, 'str', skip_quote=True), + "host": self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -89,3 +97,5 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index c250c733c08..63bc16d691a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/__init__.py index e0c77f64b36..28acd6da58d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["PetStoreInc"] +__all__ = ['PetStoreInc'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_configuration.py index 98dc7e482c5..b50cc3d70f1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class PetStoreIncConfiguration(Configuration): # pylint: disable=too-many-insta attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(PetStoreIncConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "petstoreinc/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'petstoreinc/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_pet_store_inc.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_pet_store_inc.py index 6941fc938d0..c3620ef0b0d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_pet_store_inc.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_pet_store_inc.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class PetStoreInc: """PetStore. @@ -30,8 +29,13 @@ class PetStoreInc: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = PetStoreIncConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/__init__.py index 98a70166f99..668e6ffc1a8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._pet_store_inc import PetStoreInc - -__all__ = ["PetStoreInc"] +__all__ = ['PetStoreInc'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_configuration.py index dbcf37bdcd3..b49c97d8170 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class PetStoreIncConfiguration(Configuration): # pylint: disable=too-many-insta attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(PetStoreIncConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "petstoreinc/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'petstoreinc/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_pet_store_inc.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_pet_store_inc.py index 4c1f10674f0..064d4f1c165 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_pet_store_inc.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_pet_store_inc.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class PetStoreInc: """PetStore. @@ -30,7 +29,12 @@ class PetStoreInc: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = PetStoreIncConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/__init__.py index ffb3964def4..6376c7a3a74 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py index 3fa7f67763e..5476540f052 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py @@ -8,25 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ...operations._operations import build_pet_add_pet_request, build_pet_get_by_pet_id_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PetOperations: """PetOperations async operations. @@ -46,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSONType: + async def get_by_pet_id( + self, + pet_id: str, + **kwargs: Any + ) -> JSONType: """get pet by id. :param pet_id: Pet id. @@ -67,17 +63,22 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSONType: "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_pet_get_by_pet_id_request( pet_id=pet_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -95,8 +96,14 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: + async def add_pet( + self, + pet_param: JSONType = None, + **kwargs: Any + ) -> JSONType: """add pet. :param pet_param: pet param. @@ -126,11 +133,13 @@ async def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if pet_param is not None: _json = pet_param @@ -144,7 +153,9 @@ async def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -161,3 +172,5 @@ async def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/__init__.py index ffb3964def4..6376c7a3a74 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py index 7646225797e..a0f7facc7eb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,47 +16,64 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_pet_get_by_pet_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: +def build_pet_get_by_pet_id_request( + pet_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/extensibleenums/pet/{petId}" + url = '/extensibleenums/pet/{petId}' path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, "str"), + "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_pet_add_pet_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_pet_add_pet_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/extensibleenums/pet/addPet" + url = '/extensibleenums/pet/addPet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class PetOperations(object): """PetOperations operations. @@ -83,7 +94,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSONType: + def get_by_pet_id( + self, + pet_id: str, + **kwargs: Any + ) -> JSONType: """get pet by id. :param pet_id: Pet id. @@ -104,17 +119,22 @@ def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSONType: "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_pet_get_by_pet_id_request( pet_id=pet_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -132,8 +152,14 @@ def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: + def add_pet( + self, + pet_param: JSONType = None, + **kwargs: Any + ) -> JSONType: """add pet. :param pet_param: pet param. @@ -163,11 +189,13 @@ def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: "name": "str" # Optional. name. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if pet_param is not None: _json = pet_param @@ -181,7 +209,9 @@ def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -198,3 +228,5 @@ def add_pet(self, pet_param: JSONType = None, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py index a7ea89c9d01..e8dfe80d67d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ PetStore. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/__init__.py index 3fe0f0f8751..d10c57f2e46 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATHeaderService"] +__all__ = ['AutoRestSwaggerBATHeaderService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_auto_rest_swagger_bat_header_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_auto_rest_swagger_bat_header_service.py index 64df4621153..8fd5ae68696 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_auto_rest_swagger_bat_header_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_auto_rest_swagger_bat_header_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATHeaderService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestSwaggerBATHeaderService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATHeaderServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_configuration.py index fefd719aa05..5a3e89b090a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): # pylint: di attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATHeaderServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatheaderservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatheaderservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/__init__.py index cf7d0b372e7..2df70cd716b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_bat_header_service import AutoRestSwaggerBATHeaderService - -__all__ = ["AutoRestSwaggerBATHeaderService"] +__all__ = ['AutoRestSwaggerBATHeaderService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_auto_rest_swagger_bat_header_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_auto_rest_swagger_bat_header_service.py index bbbb343778d..b53ffd54251 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_auto_rest_swagger_bat_header_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_auto_rest_swagger_bat_header_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATHeaderService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestSwaggerBATHeaderService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATHeaderServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.header = HeaderOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_configuration.py index 04c790d0397..352eabee6af 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATHeaderServiceConfiguration(Configuration): # pylint: di attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATHeaderServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatheaderservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatheaderservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/__init__.py index e6c6db39424..d6cd5c88300 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import HeaderOperations __all__ = [ - "HeaderOperations", + 'HeaderOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py index 37b20017c08..7c5092372a6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py @@ -9,54 +9,16 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_header_custom_request_id_request, - build_header_param_bool_request, - build_header_param_byte_request, - build_header_param_date_request, - build_header_param_datetime_request, - build_header_param_datetime_rfc1123_request, - build_header_param_double_request, - build_header_param_duration_request, - build_header_param_enum_request, - build_header_param_existing_key_request, - build_header_param_float_request, - build_header_param_integer_request, - build_header_param_long_request, - build_header_param_protected_key_request, - build_header_param_string_request, - build_header_response_bool_request, - build_header_response_byte_request, - build_header_response_date_request, - build_header_response_datetime_request, - build_header_response_datetime_rfc1123_request, - build_header_response_double_request, - build_header_response_duration_request, - build_header_response_enum_request, - build_header_response_existing_key_request, - build_header_response_float_request, - build_header_response_integer_request, - build_header_response_long_request, - build_header_response_protected_key_request, - build_header_response_string_request, -) - -T = TypeVar("T") +from ...operations._operations import build_header_custom_request_id_request, build_header_param_bool_request, build_header_param_byte_request, build_header_param_date_request, build_header_param_datetime_request, build_header_param_datetime_rfc1123_request, build_header_param_double_request, build_header_param_duration_request, build_header_param_enum_request, build_header_param_existing_key_request, build_header_param_float_request, build_header_param_integer_request, build_header_param_long_request, build_header_param_protected_key_request, build_header_param_string_request, build_header_response_bool_request, build_header_response_byte_request, build_header_response_date_request, build_header_response_datetime_request, build_header_response_datetime_rfc1123_request, build_header_response_double_request, build_header_response_duration_request, build_header_response_enum_request, build_header_response_existing_key_request, build_header_response_float_request, build_header_response_integer_request, build_header_response_long_request, build_header_response_protected_key_request, build_header_response_string_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HeaderOperations: # pylint: disable=too-many-public-methods """HeaderOperations async operations. @@ -76,7 +38,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def param_existing_key(self, *, user_agent_parameter: str, **kwargs: Any) -> None: + async def param_existing_key( + self, + *, + user_agent_parameter: str, + **kwargs: Any + ) -> None: """Send a post request with header value "User-Agent": "overwrite". :keyword user_agent_parameter: Send a post request with header value "User-Agent": "overwrite". @@ -85,17 +52,22 @@ async def param_existing_key(self, *, user_agent_parameter: str, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_existing_key_request( user_agent_parameter=user_agent_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -106,23 +78,34 @@ async def param_existing_key(self, *, user_agent_parameter: str, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_existing_key(self, **kwargs: Any) -> None: + async def response_existing_key( + self, + **kwargs: Any + ) -> None: """Get a response with header value "User-Agent": "overwrite". :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_header_response_existing_key_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_existing_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -131,32 +114,43 @@ async def response_existing_key(self, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["User-Agent"] = self._deserialize("str", response.headers.get("User-Agent")) + response_headers['User-Agent']=self._deserialize('str', response.headers.get('User-Agent')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_protected_key(self, **kwargs: Any) -> None: + async def param_protected_key( + self, + **kwargs: Any + ) -> None: """Send a post request with header value "Content-Type": "text/html". :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type") # type: str + content_type = kwargs.pop('content_type') # type: str + request = build_header_param_protected_key_request( content_type=content_type, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -167,23 +161,34 @@ async def param_protected_key(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_protected_key(self, **kwargs: Any) -> None: + async def response_protected_key( + self, + **kwargs: Any + ) -> None: """Get a response with header value "Content-Type": "text/html". :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_header_response_protected_key_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_protected_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -192,13 +197,22 @@ async def response_protected_key(self, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> None: + async def param_integer( + self, + *, + scenario: str, + value: int, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 1 or "scenario": "negative", "value": -2. @@ -210,10 +224,13 @@ async def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_integer_request( scenario=scenario, value=value, @@ -221,7 +238,9 @@ async def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> No request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -232,8 +251,15 @@ async def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_integer(self, *, scenario: str, **kwargs: Any) -> None: + async def response_integer( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 1 or -2. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -242,17 +268,22 @@ async def response_integer(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_integer_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -261,13 +292,22 @@ async def response_integer(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("int", response.headers.get("value")) + response_headers['value']=self._deserialize('int', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: + async def param_long( + self, + *, + scenario: str, + value: int, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 105 or "scenario": "negative", "value": -2. @@ -279,10 +319,13 @@ async def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_long_request( scenario=scenario, value=value, @@ -290,7 +333,9 @@ async def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -301,8 +346,15 @@ async def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_long(self, *, scenario: str, **kwargs: Any) -> None: + async def response_long( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 105 or -2. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -311,17 +363,22 @@ async def response_long(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_long_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -330,13 +387,22 @@ async def response_long(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("long", response.headers.get("value")) + response_headers['value']=self._deserialize('long', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> None: + async def param_float( + self, + *, + scenario: str, + value: float, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": "negative", "value": -3.0. @@ -348,10 +414,13 @@ async def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_float_request( scenario=scenario, value=value, @@ -359,7 +428,9 @@ async def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> No request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -370,8 +441,15 @@ async def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_float(self, *, scenario: str, **kwargs: Any) -> None: + async def response_float( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 0.07 or -3.0. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -380,17 +458,22 @@ async def response_float(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_float_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -399,13 +482,22 @@ async def response_float(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> None: + async def param_double( + self, + *, + scenario: str, + value: float, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": "negative", "value": -3.0. @@ -417,10 +509,13 @@ async def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_double_request( scenario=scenario, value=value, @@ -428,7 +523,9 @@ async def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -439,8 +536,15 @@ async def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_double(self, *, scenario: str, **kwargs: Any) -> None: + async def response_double( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 7e120 or -3.0. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -449,17 +553,22 @@ async def response_double(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_double_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -468,13 +577,22 @@ async def response_double(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None: + async def param_bool( + self, + *, + scenario: str, + value: bool, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "true", "value": true or "scenario": "false", "value": false. @@ -486,10 +604,13 @@ async def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_bool_request( scenario=scenario, value=value, @@ -497,7 +618,9 @@ async def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -508,8 +631,15 @@ async def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_bool(self, *, scenario: str, **kwargs: Any) -> None: + async def response_bool( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": true or false. :keyword scenario: Send a post request with header values "scenario": "true" or "false". @@ -518,17 +648,22 @@ async def response_bool(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_bool_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -537,13 +672,22 @@ async def response_bool(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("bool", response.headers.get("value")) + response_headers['value']=self._deserialize('bool', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_string(self, *, scenario: str, value: Optional[str] = None, **kwargs: Any) -> None: + async def param_string( + self, + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps over the lazy dog" or "scenario": "null", "value": null or "scenario": "empty", "value": "". @@ -557,10 +701,13 @@ async def param_string(self, *, scenario: str, value: Optional[str] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_string_request( scenario=scenario, value=value, @@ -568,7 +715,9 @@ async def param_string(self, *, scenario: str, value: Optional[str] = None, **kw request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -579,8 +728,15 @@ async def param_string(self, *, scenario: str, value: Optional[str] = None, **kw if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_string(self, *, scenario: str, **kwargs: Any) -> None: + async def response_string( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "". :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or @@ -590,17 +746,22 @@ async def response_string(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_string_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -609,13 +770,22 @@ async def response_string(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any) -> None: + async def param_date( + self, + *, + scenario: str, + value: datetime.date, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "2010-01-01" or "scenario": "min", "value": "0001-01-01". @@ -627,10 +797,13 @@ async def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_date_request( scenario=scenario, value=value, @@ -638,7 +811,9 @@ async def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -649,8 +824,15 @@ async def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_date(self, *, scenario: str, **kwargs: Any) -> None: + async def response_date( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "2010-01-01" or "0001-01-01". :keyword scenario: Send a post request with header values "scenario": "valid" or "min". @@ -659,17 +841,22 @@ async def response_date(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_date_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -678,13 +865,22 @@ async def response_date(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("date", response.headers.get("value")) + response_headers['value']=self._deserialize('date', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwargs: Any) -> None: + async def param_datetime( + self, + *, + scenario: str, + value: datetime.datetime, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or "scenario": "min", "value": "0001-01-01T00:00:00Z". @@ -697,10 +893,13 @@ async def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_datetime_request( scenario=scenario, value=value, @@ -708,7 +907,9 @@ async def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwa request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -719,8 +920,15 @@ async def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwa if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_datetime(self, *, scenario: str, **kwargs: Any) -> None: + async def response_datetime( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z". :keyword scenario: Send a post request with header values "scenario": "valid" or "min". @@ -729,17 +937,22 @@ async def response_datetime(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_datetime_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -748,14 +961,21 @@ async def response_datetime(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) + response_headers['value']=self._deserialize('iso-8601', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async async def param_datetime_rfc1123( - self, *, scenario: str, value: Optional[datetime.datetime] = None, **kwargs: Any + self, + *, + scenario: str, + value: Optional[datetime.datetime] = None, + **kwargs: Any ) -> None: """Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 00:00:00 GMT". @@ -769,10 +989,13 @@ async def param_datetime_rfc1123( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_datetime_rfc1123_request( scenario=scenario, value=value, @@ -780,7 +1003,9 @@ async def param_datetime_rfc1123( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -791,8 +1016,15 @@ async def param_datetime_rfc1123( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_datetime_rfc1123(self, *, scenario: str, **kwargs: Any) -> None: + async def response_datetime_rfc1123( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT". @@ -802,17 +1034,22 @@ async def response_datetime_rfc1123(self, *, scenario: str, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_datetime_rfc1123_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -821,13 +1058,22 @@ async def response_datetime_rfc1123(self, *, scenario: str, **kwargs: Any) -> No raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + response_headers['value']=self._deserialize('rfc-1123', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_duration(self, *, scenario: str, value: datetime.timedelta, **kwargs: Any) -> None: + async def param_duration( + self, + *, + scenario: str, + value: datetime.timedelta, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -838,10 +1084,13 @@ async def param_duration(self, *, scenario: str, value: datetime.timedelta, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_duration_request( scenario=scenario, value=value, @@ -849,7 +1098,9 @@ async def param_duration(self, *, scenario: str, value: datetime.timedelta, **kw request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -860,8 +1111,15 @@ async def param_duration(self, *, scenario: str, value: datetime.timedelta, **kw if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_duration(self, *, scenario: str, **kwargs: Any) -> None: + async def response_duration( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "P123DT22H14M12.011S". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -870,17 +1128,22 @@ async def response_duration(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_duration_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -889,13 +1152,22 @@ async def response_duration(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("duration", response.headers.get("value")) + response_headers['value']=self._deserialize('duration', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> None: + async def param_byte( + self, + *, + scenario: str, + value: bytearray, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -906,10 +1178,13 @@ async def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_byte_request( scenario=scenario, value=value, @@ -917,7 +1192,9 @@ async def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -928,8 +1205,15 @@ async def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_byte(self, *, scenario: str, **kwargs: Any) -> None: + async def response_byte( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "啊齄丂狛狜隣郎隣兀﨩". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -938,17 +1222,22 @@ async def response_byte(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_byte_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -957,13 +1246,22 @@ async def response_byte(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("bytearray", response.headers.get("value")) + response_headers['value']=self._deserialize('bytearray', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwargs: Any) -> None: + async def param_enum( + self, + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": "null", "value": null. @@ -977,10 +1275,13 @@ async def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwar :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_param_enum_request( scenario=scenario, value=value, @@ -988,7 +1289,9 @@ async def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -999,8 +1302,15 @@ async def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwar if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def response_enum(self, *, scenario: str, **kwargs: Any) -> None: + async def response_enum( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "GREY" or null. :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or @@ -1010,17 +1320,22 @@ async def response_enum(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_header_response_enum_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1029,13 +1344,19 @@ async def response_enum(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def custom_request_id(self, **kwargs: Any) -> None: + async def custom_request_id( + self, + **kwargs: Any + ) -> None: """Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. @@ -1043,15 +1364,21 @@ async def custom_request_id(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_header_custom_request_id_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_custom_request_id_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1061,3 +1388,5 @@ async def custom_request_id(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/__init__.py index e6c6db39424..d6cd5c88300 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import HeaderOperations __all__ = [ - "HeaderOperations", + 'HeaderOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py index ab510b9ad5a..41902d2a4ef 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py @@ -9,418 +9,672 @@ import datetime from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_header_param_existing_key_request(*, user_agent_parameter: str, **kwargs: Any) -> HttpRequest: +def build_header_param_existing_key_request( + *, + user_agent_parameter: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/existingkey" + url = '/header/param/existingkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["User-Agent"] = _SERIALIZER.header("user_agent_parameter", user_agent_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['User-Agent'] = _SERIALIZER.header("user_agent_parameter", user_agent_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_response_existing_key_request(**kwargs: Any) -> HttpRequest: +def build_header_response_existing_key_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/existingkey" + url = '/header/response/existingkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_param_protected_key_request(**kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type") # type: str +def build_header_param_protected_key_request( + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type') # type: str accept = "application/json" # Construct URL - url = "/header/param/protectedkey" + url = '/header/param/protectedkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_response_protected_key_request(**kwargs: Any) -> HttpRequest: +def build_header_response_protected_key_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/protectedkey" + url = '/header/response/protectedkey' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_param_integer_request(*, scenario: str, value: int, **kwargs: Any) -> HttpRequest: +def build_header_param_integer_request( + *, + scenario: str, + value: int, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/integer" + url = '/header/param/prim/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_integer_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_integer_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/integer" + url = '/header/response/prim/integer' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_long_request(*, scenario: str, value: int, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_long_request( + *, + scenario: str, + value: int, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/long" + url = '/header/param/prim/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "long") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_long_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'long') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_long_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/long" + url = '/header/response/prim/long' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_float_request(*, scenario: str, value: float, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_float_request( + *, + scenario: str, + value: float, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/float" + url = '/header/param/prim/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "float") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_float_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'float') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_float_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/float" + url = '/header/response/prim/float' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_double_request(*, scenario: str, value: float, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_double_request( + *, + scenario: str, + value: float, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/double" + url = '/header/param/prim/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "float") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_double_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'float') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_double_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/double" + url = '/header/response/prim/double' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_bool_request(*, scenario: str, value: bool, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_bool_request( + *, + scenario: str, + value: bool, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/bool" + url = '/header/param/prim/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "bool") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_bool_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'bool') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_bool_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/bool" + url = '/header/response/prim/bool' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_string_request(*, scenario: str, value: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_string_request( + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/string" + url = '/header/param/prim/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') if value is not None: - header_parameters["value"] = _SERIALIZER.header("value", value, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['value'] = _SERIALIZER.header("value", value, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_response_string_request(*, scenario: str, **kwargs: Any) -> HttpRequest: +def build_header_response_string_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/string" + url = '/header/response/prim/string' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_date_request(*, scenario: str, value: datetime.date, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_date_request( + *, + scenario: str, + value: datetime.date, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/date" + url = '/header/param/prim/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "date") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_date_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'date') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_date_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/date" + url = '/header/response/prim/date' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_datetime_request(*, scenario: str, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_datetime_request( + *, + scenario: str, + value: datetime.datetime, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/datetime" + url = '/header/param/prim/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "iso-8601") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_datetime_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'iso-8601') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_datetime_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/datetime" + url = '/header/response/prim/datetime' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_header_param_datetime_rfc1123_request( - *, scenario: str, value: Optional[datetime.datetime] = None, **kwargs: Any + *, + scenario: str, + value: Optional[datetime.datetime] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/datetimerfc1123" + url = '/header/param/prim/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') if value is not None: - header_parameters["value"] = _SERIALIZER.header("value", value, "rfc-1123") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['value'] = _SERIALIZER.header("value", value, 'rfc-1123') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_response_datetime_rfc1123_request(*, scenario: str, **kwargs: Any) -> HttpRequest: +def build_header_response_datetime_rfc1123_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/datetimerfc1123" + url = '/header/response/prim/datetimerfc1123' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_duration_request(*, scenario: str, value: datetime.timedelta, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_duration_request( + *, + scenario: str, + value: datetime.timedelta, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/duration" + url = '/header/param/prim/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "duration") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_duration_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'duration') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_duration_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/duration" + url = '/header/response/prim/duration' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_byte_request(*, scenario: str, value: bytearray, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_byte_request( + *, + scenario: str, + value: bytearray, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/byte" + url = '/header/param/prim/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["value"] = _SERIALIZER.header("value", value, "bytearray") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_response_byte_request(*, scenario: str, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['value'] = _SERIALIZER.header("value", value, 'bytearray') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_response_byte_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/byte" + url = '/header/response/prim/byte' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) - - -def build_header_param_enum_request(*, scenario: str, value: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_header_param_enum_request( + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/param/prim/enum" + url = '/header/param/prim/enum' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') if value is not None: - header_parameters["value"] = _SERIALIZER.header("value", value, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['value'] = _SERIALIZER.header("value", value, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_response_enum_request(*, scenario: str, **kwargs: Any) -> HttpRequest: +def build_header_response_enum_request( + *, + scenario: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/response/prim/enum" + url = '/header/response/prim/enum' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["scenario"] = _SERIALIZER.header("scenario", scenario, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_header_custom_request_id_request(**kwargs: Any) -> HttpRequest: +def build_header_custom_request_id_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0" + url = '/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) class HeaderOperations(object): # pylint: disable=too-many-public-methods """HeaderOperations operations. @@ -441,7 +695,12 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def param_existing_key(self, *, user_agent_parameter: str, **kwargs: Any) -> None: + def param_existing_key( + self, + *, + user_agent_parameter: str, + **kwargs: Any + ) -> None: """Send a post request with header value "User-Agent": "overwrite". :keyword user_agent_parameter: Send a post request with header value "User-Agent": "overwrite". @@ -450,17 +709,23 @@ def param_existing_key(self, *, user_agent_parameter: str, **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_existing_key_request( user_agent_parameter=user_agent_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -471,23 +736,34 @@ def param_existing_key(self, *, user_agent_parameter: str, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_existing_key(self, **kwargs: Any) -> None: + def response_existing_key( + self, + **kwargs: Any + ) -> None: """Get a response with header value "User-Agent": "overwrite". :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_header_response_existing_key_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_existing_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -496,32 +772,43 @@ def response_existing_key(self, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["User-Agent"] = self._deserialize("str", response.headers.get("User-Agent")) + response_headers['User-Agent']=self._deserialize('str', response.headers.get('User-Agent')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_protected_key(self, **kwargs: Any) -> None: + def param_protected_key( + self, + **kwargs: Any + ) -> None: """Send a post request with header value "Content-Type": "text/html". :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type") # type: str + content_type = kwargs.pop('content_type') # type: str + request = build_header_param_protected_key_request( content_type=content_type, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -532,23 +819,34 @@ def param_protected_key(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_protected_key(self, **kwargs: Any) -> None: + def response_protected_key( + self, + **kwargs: Any + ) -> None: """Get a response with header value "Content-Type": "text/html". :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_header_response_protected_key_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_protected_key_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -557,13 +855,22 @@ def response_protected_key(self, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["Content-Type"] = self._deserialize("str", response.headers.get("Content-Type")) + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> None: + def param_integer( + self, + *, + scenario: str, + value: int, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 1 or "scenario": "negative", "value": -2. @@ -575,10 +882,14 @@ def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_integer_request( scenario=scenario, value=value, @@ -586,7 +897,9 @@ def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -597,8 +910,15 @@ def param_integer(self, *, scenario: str, value: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_integer(self, *, scenario: str, **kwargs: Any) -> None: + def response_integer( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 1 or -2. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -607,17 +927,23 @@ def response_integer(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_integer_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -626,13 +952,22 @@ def response_integer(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("int", response.headers.get("value")) + response_headers['value']=self._deserialize('int', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: + def param_long( + self, + *, + scenario: str, + value: int, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 105 or "scenario": "negative", "value": -2. @@ -644,10 +979,14 @@ def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_long_request( scenario=scenario, value=value, @@ -655,7 +994,9 @@ def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -666,8 +1007,15 @@ def param_long(self, *, scenario: str, value: int, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_long(self, *, scenario: str, **kwargs: Any) -> None: + def response_long( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 105 or -2. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -676,17 +1024,23 @@ def response_long(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_long_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -695,13 +1049,22 @@ def response_long(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("long", response.headers.get("value")) + response_headers['value']=self._deserialize('long', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> None: + def param_float( + self, + *, + scenario: str, + value: float, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": "negative", "value": -3.0. @@ -713,10 +1076,14 @@ def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_float_request( scenario=scenario, value=value, @@ -724,7 +1091,9 @@ def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -735,8 +1104,15 @@ def param_float(self, *, scenario: str, value: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_float(self, *, scenario: str, **kwargs: Any) -> None: + def response_float( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 0.07 or -3.0. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -745,17 +1121,23 @@ def response_float(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_float_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -764,13 +1146,22 @@ def response_float(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> None: + def param_double( + self, + *, + scenario: str, + value: float, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": "negative", "value": -3.0. @@ -782,10 +1173,14 @@ def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_double_request( scenario=scenario, value=value, @@ -793,7 +1188,9 @@ def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -804,8 +1201,15 @@ def param_double(self, *, scenario: str, value: float, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_double(self, *, scenario: str, **kwargs: Any) -> None: + def response_double( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": 7e120 or -3.0. :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". @@ -814,17 +1218,23 @@ def response_double(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_double_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -833,13 +1243,22 @@ def response_double(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("float", response.headers.get("value")) + response_headers['value']=self._deserialize('float', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None: + def param_bool( + self, + *, + scenario: str, + value: bool, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "true", "value": true or "scenario": "false", "value": false. @@ -851,10 +1270,14 @@ def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_bool_request( scenario=scenario, value=value, @@ -862,7 +1285,9 @@ def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -873,8 +1298,15 @@ def param_bool(self, *, scenario: str, value: bool, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_bool(self, *, scenario: str, **kwargs: Any) -> None: + def response_bool( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header value "value": true or false. :keyword scenario: Send a post request with header values "scenario": "true" or "false". @@ -883,17 +1315,23 @@ def response_bool(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_bool_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -902,13 +1340,22 @@ def response_bool(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("bool", response.headers.get("value")) + response_headers['value']=self._deserialize('bool', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_string(self, *, scenario: str, value: Optional[str] = None, **kwargs: Any) -> None: + def param_string( + self, + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps over the lazy dog" or "scenario": "null", "value": null or "scenario": "empty", "value": "". @@ -922,10 +1369,14 @@ def param_string(self, *, scenario: str, value: Optional[str] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_string_request( scenario=scenario, value=value, @@ -933,7 +1384,9 @@ def param_string(self, *, scenario: str, value: Optional[str] = None, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -944,8 +1397,15 @@ def param_string(self, *, scenario: str, value: Optional[str] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_string(self, *, scenario: str, **kwargs: Any) -> None: + def response_string( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "". :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or @@ -955,17 +1415,23 @@ def response_string(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_string_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -974,13 +1440,22 @@ def response_string(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any) -> None: + def param_date( + self, + *, + scenario: str, + value: datetime.date, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "2010-01-01" or "scenario": "min", "value": "0001-01-01". @@ -992,10 +1467,14 @@ def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_date_request( scenario=scenario, value=value, @@ -1003,7 +1482,9 @@ def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1014,8 +1495,15 @@ def param_date(self, *, scenario: str, value: datetime.date, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_date(self, *, scenario: str, **kwargs: Any) -> None: + def response_date( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "2010-01-01" or "0001-01-01". :keyword scenario: Send a post request with header values "scenario": "valid" or "min". @@ -1024,17 +1512,23 @@ def response_date(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_date_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1043,13 +1537,22 @@ def response_date(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("date", response.headers.get("value")) + response_headers['value']=self._deserialize('date', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwargs: Any) -> None: + def param_datetime( + self, + *, + scenario: str, + value: datetime.datetime, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or "scenario": "min", "value": "0001-01-01T00:00:00Z". @@ -1062,10 +1565,14 @@ def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_datetime_request( scenario=scenario, value=value, @@ -1073,7 +1580,9 @@ def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwargs: A request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1084,8 +1593,15 @@ def param_datetime(self, *, scenario: str, value: datetime.datetime, **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_datetime(self, *, scenario: str, **kwargs: Any) -> None: + def response_datetime( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z". :keyword scenario: Send a post request with header values "scenario": "valid" or "min". @@ -1094,17 +1610,23 @@ def response_datetime(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_datetime_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1113,14 +1635,21 @@ def response_datetime(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) + response_headers['value']=self._deserialize('iso-8601', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace def param_datetime_rfc1123( - self, *, scenario: str, value: Optional[datetime.datetime] = None, **kwargs: Any + self, + *, + scenario: str, + value: Optional[datetime.datetime] = None, + **kwargs: Any ) -> None: """Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 00:00:00 GMT". @@ -1134,10 +1663,14 @@ def param_datetime_rfc1123( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_datetime_rfc1123_request( scenario=scenario, value=value, @@ -1145,7 +1678,9 @@ def param_datetime_rfc1123( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1156,8 +1691,15 @@ def param_datetime_rfc1123( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_datetime_rfc1123(self, *, scenario: str, **kwargs: Any) -> None: + def response_datetime_rfc1123( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT". @@ -1167,17 +1709,23 @@ def response_datetime_rfc1123(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_datetime_rfc1123_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1186,13 +1734,22 @@ def response_datetime_rfc1123(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + response_headers['value']=self._deserialize('rfc-1123', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_duration(self, *, scenario: str, value: datetime.timedelta, **kwargs: Any) -> None: + def param_duration( + self, + *, + scenario: str, + value: datetime.timedelta, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -1203,10 +1760,14 @@ def param_duration(self, *, scenario: str, value: datetime.timedelta, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_duration_request( scenario=scenario, value=value, @@ -1214,7 +1775,9 @@ def param_duration(self, *, scenario: str, value: datetime.timedelta, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1225,8 +1788,15 @@ def param_duration(self, *, scenario: str, value: datetime.timedelta, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_duration(self, *, scenario: str, **kwargs: Any) -> None: + def response_duration( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "P123DT22H14M12.011S". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -1235,17 +1805,23 @@ def response_duration(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_duration_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1254,13 +1830,22 @@ def response_duration(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("duration", response.headers.get("value")) + response_headers['value']=self._deserialize('duration', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> None: + def param_byte( + self, + *, + scenario: str, + value: bytearray, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -1271,10 +1856,14 @@ def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_byte_request( scenario=scenario, value=value, @@ -1282,7 +1871,9 @@ def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1293,8 +1884,15 @@ def param_byte(self, *, scenario: str, value: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_byte(self, *, scenario: str, **kwargs: Any) -> None: + def response_byte( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "啊齄丂狛狜隣郎隣兀﨩". :keyword scenario: Send a post request with header values "scenario": "valid". @@ -1303,17 +1901,23 @@ def response_byte(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_byte_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1322,13 +1926,22 @@ def response_byte(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("bytearray", response.headers.get("value")) + response_headers['value']=self._deserialize('bytearray', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwargs: Any) -> None: + def param_enum( + self, + *, + scenario: str, + value: Optional[str] = None, + **kwargs: Any + ) -> None: """Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": "null", "value": null. @@ -1342,10 +1955,14 @@ def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_param_enum_request( scenario=scenario, value=value, @@ -1353,7 +1970,9 @@ def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1364,8 +1983,15 @@ def param_enum(self, *, scenario: str, value: Optional[str] = None, **kwargs: An if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def response_enum(self, *, scenario: str, **kwargs: Any) -> None: + def response_enum( + self, + *, + scenario: str, + **kwargs: Any + ) -> None: """Get a response with header values "GREY" or null. :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or @@ -1375,17 +2001,23 @@ def response_enum(self, *, scenario: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_response_enum_request( scenario=scenario, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1394,13 +2026,19 @@ def response_enum(self, *, scenario: str, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["value"] = self._deserialize("str", response.headers.get("value")) + response_headers['value']=self._deserialize('str', response.headers.get('value')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def custom_request_id(self, **kwargs: Any) -> None: + def custom_request_id( + self, + **kwargs: Any + ) -> None: """Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. @@ -1408,15 +2046,21 @@ def custom_request_id(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_header_custom_request_id_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_header_custom_request_id_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1426,3 +2070,5 @@ def custom_request_id(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py index 8749e54d402..ecf57c0041c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/__init__.py index 59e83504622..2272153c560 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestHttpInfrastructureTestService"] +__all__ = ['AutoRestHttpInfrastructureTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_auto_rest_http_infrastructure_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_auto_rest_http_infrastructure_test_service.py index 5e2e198e6f8..3d3a86acf75 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_auto_rest_http_infrastructure_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_auto_rest_http_infrastructure_test_service.py @@ -14,22 +14,13 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestHttpInfrastructureTestServiceConfiguration -from .operations import ( - HttpClientFailureOperations, - HttpFailureOperations, - HttpRedirectsOperations, - HttpRetryOperations, - HttpServerFailureOperations, - HttpSuccessOperations, - MultipleResponsesOperations, -) +from .operations import HttpClientFailureOperations, HttpFailureOperations, HttpRedirectsOperations, HttpRetryOperations, HttpServerFailureOperations, HttpSuccessOperations, MultipleResponsesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Dict - -class AutoRestHttpInfrastructureTestService: # pylint: disable=too-many-instance-attributes +class AutoRestHttpInfrastructureTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar http_failure: HttpFailureOperations operations @@ -53,8 +44,13 @@ class AutoRestHttpInfrastructureTestService: # pylint: disable=too-many-instanc :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestHttpInfrastructureTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -64,16 +60,11 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.http_failure = HttpFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) self.http_redirects = HttpRedirectsOperations(self._client, self._config, self._serialize, self._deserialize) - self.http_client_failure = HttpClientFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.http_server_failure = HttpServerFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.http_client_failure = HttpClientFailureOperations(self._client, self._config, self._serialize, self._deserialize) + self.http_server_failure = HttpServerFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_retry = HttpRetryOperations(self._client, self._config, self._serialize, self._deserialize) - self.multiple_responses = MultipleResponsesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.multiple_responses = MultipleResponsesOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_configuration.py index 71776ec85fd..d9c88e34406 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): # pyli attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestHttpInfrastructureTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresthttpinfrastructuretestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresthttpinfrastructuretestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/__init__.py index b4c36fdfe1f..c0fbcc39764 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_http_infrastructure_test_service import AutoRestHttpInfrastructureTestService - -__all__ = ["AutoRestHttpInfrastructureTestService"] +__all__ = ['AutoRestHttpInfrastructureTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_auto_rest_http_infrastructure_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_auto_rest_http_infrastructure_test_service.py index ffc62772dca..6b42fc642ce 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_auto_rest_http_infrastructure_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_auto_rest_http_infrastructure_test_service.py @@ -14,22 +14,13 @@ from msrest import Deserializer, Serializer from ._configuration import AutoRestHttpInfrastructureTestServiceConfiguration -from .operations import ( - HttpClientFailureOperations, - HttpFailureOperations, - HttpRedirectsOperations, - HttpRetryOperations, - HttpServerFailureOperations, - HttpSuccessOperations, - MultipleResponsesOperations, -) +from .operations import HttpClientFailureOperations, HttpFailureOperations, HttpRedirectsOperations, HttpRetryOperations, HttpServerFailureOperations, HttpSuccessOperations, MultipleResponsesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Dict - -class AutoRestHttpInfrastructureTestService: # pylint: disable=too-many-instance-attributes +class AutoRestHttpInfrastructureTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. :ivar http_failure: HttpFailureOperations operations @@ -54,7 +45,12 @@ class AutoRestHttpInfrastructureTestService: # pylint: disable=too-many-instanc :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestHttpInfrastructureTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -64,18 +60,17 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.http_failure = HttpFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) self.http_redirects = HttpRedirectsOperations(self._client, self._config, self._serialize, self._deserialize) - self.http_client_failure = HttpClientFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.http_server_failure = HttpServerFailureOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.http_client_failure = HttpClientFailureOperations(self._client, self._config, self._serialize, self._deserialize) + self.http_server_failure = HttpServerFailureOperations(self._client, self._config, self._serialize, self._deserialize) self.http_retry = HttpRetryOperations(self._client, self._config, self._serialize, self._deserialize) - self.multiple_responses = MultipleResponsesOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.multiple_responses = MultipleResponsesOperations(self._client, self._config, self._serialize, self._deserialize) + - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_configuration.py index cae367ee2b7..8751fa8fcae 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestHttpInfrastructureTestServiceConfiguration(Configuration): # pyli attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestHttpInfrastructureTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresthttpinfrastructuretestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresthttpinfrastructuretestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/__init__.py index 7b4c3112424..496c9c1c46b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/__init__.py @@ -15,11 +15,11 @@ from ._operations import MultipleResponsesOperations __all__ = [ - "HttpFailureOperations", - "HttpSuccessOperations", - "HttpRedirectsOperations", - "HttpClientFailureOperations", - "HttpServerFailureOperations", - "HttpRetryOperations", - "MultipleResponsesOperations", + 'HttpFailureOperations', + 'HttpSuccessOperations', + 'HttpRedirectsOperations', + 'HttpClientFailureOperations', + 'HttpServerFailureOperations', + 'HttpRetryOperations', + 'MultipleResponsesOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py index 51efb3ead32..f2bbdec8020 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py @@ -8,137 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_http_client_failure_delete400_request, - build_http_client_failure_delete407_request, - build_http_client_failure_delete417_request, - build_http_client_failure_get400_request, - build_http_client_failure_get402_request, - build_http_client_failure_get403_request, - build_http_client_failure_get411_request, - build_http_client_failure_get412_request, - build_http_client_failure_get416_request, - build_http_client_failure_head400_request, - build_http_client_failure_head401_request, - build_http_client_failure_head410_request, - build_http_client_failure_head429_request, - build_http_client_failure_options400_request, - build_http_client_failure_options403_request, - build_http_client_failure_options412_request, - build_http_client_failure_patch400_request, - build_http_client_failure_patch405_request, - build_http_client_failure_patch414_request, - build_http_client_failure_post400_request, - build_http_client_failure_post406_request, - build_http_client_failure_post415_request, - build_http_client_failure_put400_request, - build_http_client_failure_put404_request, - build_http_client_failure_put409_request, - build_http_client_failure_put413_request, - build_http_failure_get_empty_error_request, - build_http_failure_get_no_model_empty_request, - build_http_failure_get_no_model_error_request, - build_http_redirects_delete307_request, - build_http_redirects_get300_request, - build_http_redirects_get301_request, - build_http_redirects_get302_request, - build_http_redirects_get307_request, - build_http_redirects_head300_request, - build_http_redirects_head301_request, - build_http_redirects_head302_request, - build_http_redirects_head307_request, - build_http_redirects_options307_request, - build_http_redirects_patch302_request, - build_http_redirects_patch307_request, - build_http_redirects_post303_request, - build_http_redirects_post307_request, - build_http_redirects_put301_request, - build_http_redirects_put307_request, - build_http_retry_delete503_request, - build_http_retry_get502_request, - build_http_retry_head408_request, - build_http_retry_options502_request, - build_http_retry_patch500_request, - build_http_retry_patch504_request, - build_http_retry_post503_request, - build_http_retry_put500_request, - build_http_retry_put504_request, - build_http_server_failure_delete505_request, - build_http_server_failure_get501_request, - build_http_server_failure_head501_request, - build_http_server_failure_post505_request, - build_http_success_delete200_request, - build_http_success_delete202_request, - build_http_success_delete204_request, - build_http_success_get200_request, - build_http_success_head200_request, - build_http_success_head204_request, - build_http_success_head404_request, - build_http_success_options200_request, - build_http_success_patch200_request, - build_http_success_patch202_request, - build_http_success_patch204_request, - build_http_success_post200_request, - build_http_success_post201_request, - build_http_success_post202_request, - build_http_success_post204_request, - build_http_success_put200_request, - build_http_success_put201_request, - build_http_success_put202_request, - build_http_success_put204_request, - build_multiple_responses_get200_model201_model_default_error200_valid_request, - build_multiple_responses_get200_model201_model_default_error201_valid_request, - build_multiple_responses_get200_model201_model_default_error400_valid_request, - build_multiple_responses_get200_model204_no_model_default_error200_valid_request, - build_multiple_responses_get200_model204_no_model_default_error201_invalid_request, - build_multiple_responses_get200_model204_no_model_default_error202_none_request, - build_multiple_responses_get200_model204_no_model_default_error204_valid_request, - build_multiple_responses_get200_model204_no_model_default_error400_valid_request, - build_multiple_responses_get200_model_a200_invalid_request, - build_multiple_responses_get200_model_a200_none_request, - build_multiple_responses_get200_model_a200_valid_request, - build_multiple_responses_get200_model_a201_model_c404_model_d_default_error200_valid_request, - build_multiple_responses_get200_model_a201_model_c404_model_d_default_error201_valid_request, - build_multiple_responses_get200_model_a201_model_c404_model_d_default_error400_valid_request, - build_multiple_responses_get200_model_a201_model_c404_model_d_default_error404_valid_request, - build_multiple_responses_get200_model_a202_valid_request, - build_multiple_responses_get200_model_a400_invalid_request, - build_multiple_responses_get200_model_a400_none_request, - build_multiple_responses_get200_model_a400_valid_request, - build_multiple_responses_get202_none204_none_default_error202_none_request, - build_multiple_responses_get202_none204_none_default_error204_none_request, - build_multiple_responses_get202_none204_none_default_error400_valid_request, - build_multiple_responses_get202_none204_none_default_none202_invalid_request, - build_multiple_responses_get202_none204_none_default_none204_none_request, - build_multiple_responses_get202_none204_none_default_none400_invalid_request, - build_multiple_responses_get202_none204_none_default_none400_none_request, - build_multiple_responses_get_default_model_a200_none_request, - build_multiple_responses_get_default_model_a200_valid_request, - build_multiple_responses_get_default_model_a400_none_request, - build_multiple_responses_get_default_model_a400_valid_request, - build_multiple_responses_get_default_none200_invalid_request, - build_multiple_responses_get_default_none200_none_request, - build_multiple_responses_get_default_none400_invalid_request, - build_multiple_responses_get_default_none400_none_request, -) - -T = TypeVar("T") +from ...operations._operations import build_http_client_failure_delete400_request, build_http_client_failure_delete407_request, build_http_client_failure_delete417_request, build_http_client_failure_get400_request, build_http_client_failure_get402_request, build_http_client_failure_get403_request, build_http_client_failure_get411_request, build_http_client_failure_get412_request, build_http_client_failure_get416_request, build_http_client_failure_head400_request, build_http_client_failure_head401_request, build_http_client_failure_head410_request, build_http_client_failure_head429_request, build_http_client_failure_options400_request, build_http_client_failure_options403_request, build_http_client_failure_options412_request, build_http_client_failure_patch400_request, build_http_client_failure_patch405_request, build_http_client_failure_patch414_request, build_http_client_failure_post400_request, build_http_client_failure_post406_request, build_http_client_failure_post415_request, build_http_client_failure_put400_request, build_http_client_failure_put404_request, build_http_client_failure_put409_request, build_http_client_failure_put413_request, build_http_failure_get_empty_error_request, build_http_failure_get_no_model_empty_request, build_http_failure_get_no_model_error_request, build_http_redirects_delete307_request, build_http_redirects_get300_request, build_http_redirects_get301_request, build_http_redirects_get302_request, build_http_redirects_get307_request, build_http_redirects_head300_request, build_http_redirects_head301_request, build_http_redirects_head302_request, build_http_redirects_head307_request, build_http_redirects_options307_request, build_http_redirects_patch302_request, build_http_redirects_patch307_request, build_http_redirects_post303_request, build_http_redirects_post307_request, build_http_redirects_put301_request, build_http_redirects_put307_request, build_http_retry_delete503_request, build_http_retry_get502_request, build_http_retry_head408_request, build_http_retry_options502_request, build_http_retry_patch500_request, build_http_retry_patch504_request, build_http_retry_post503_request, build_http_retry_put500_request, build_http_retry_put504_request, build_http_server_failure_delete505_request, build_http_server_failure_get501_request, build_http_server_failure_head501_request, build_http_server_failure_post505_request, build_http_success_delete200_request, build_http_success_delete202_request, build_http_success_delete204_request, build_http_success_get200_request, build_http_success_head200_request, build_http_success_head204_request, build_http_success_head404_request, build_http_success_options200_request, build_http_success_patch200_request, build_http_success_patch202_request, build_http_success_patch204_request, build_http_success_post200_request, build_http_success_post201_request, build_http_success_post202_request, build_http_success_post204_request, build_http_success_put200_request, build_http_success_put201_request, build_http_success_put202_request, build_http_success_put204_request, build_multiple_responses_get200_model201_model_default_error200_valid_request, build_multiple_responses_get200_model201_model_default_error201_valid_request, build_multiple_responses_get200_model201_model_default_error400_valid_request, build_multiple_responses_get200_model204_no_model_default_error200_valid_request, build_multiple_responses_get200_model204_no_model_default_error201_invalid_request, build_multiple_responses_get200_model204_no_model_default_error202_none_request, build_multiple_responses_get200_model204_no_model_default_error204_valid_request, build_multiple_responses_get200_model204_no_model_default_error400_valid_request, build_multiple_responses_get200_model_a200_invalid_request, build_multiple_responses_get200_model_a200_none_request, build_multiple_responses_get200_model_a200_valid_request, build_multiple_responses_get200_model_a201_model_c404_model_d_default_error200_valid_request, build_multiple_responses_get200_model_a201_model_c404_model_d_default_error201_valid_request, build_multiple_responses_get200_model_a201_model_c404_model_d_default_error400_valid_request, build_multiple_responses_get200_model_a201_model_c404_model_d_default_error404_valid_request, build_multiple_responses_get200_model_a202_valid_request, build_multiple_responses_get200_model_a400_invalid_request, build_multiple_responses_get200_model_a400_none_request, build_multiple_responses_get200_model_a400_valid_request, build_multiple_responses_get202_none204_none_default_error202_none_request, build_multiple_responses_get202_none204_none_default_error204_none_request, build_multiple_responses_get202_none204_none_default_error400_valid_request, build_multiple_responses_get202_none204_none_default_none202_invalid_request, build_multiple_responses_get202_none204_none_default_none204_none_request, build_multiple_responses_get202_none204_none_default_none400_invalid_request, build_multiple_responses_get202_none204_none_default_none400_none_request, build_multiple_responses_get_default_model_a200_none_request, build_multiple_responses_get_default_model_a200_valid_request, build_multiple_responses_get_default_model_a400_none_request, build_multiple_responses_get_default_model_a400_valid_request, build_multiple_responses_get_default_none200_invalid_request, build_multiple_responses_get_default_none200_none_request, build_multiple_responses_get_default_none400_invalid_request, build_multiple_responses_get_default_none400_none_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class HttpFailureOperations: """HttpFailureOperations async operations. @@ -158,22 +38,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_empty_error(self, **kwargs: Any) -> bool: + async def get_empty_error( + self, + **kwargs: Any + ) -> bool: """Get empty error form server. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_failure_get_empty_error_request() + + request = build_http_failure_get_empty_error_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -191,23 +80,34 @@ async def get_empty_error(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace_async - async def get_no_model_error(self, **kwargs: Any) -> bool: + async def get_no_model_error( + self, + **kwargs: Any + ) -> bool: """Get empty error form server. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_failure_get_no_model_error_request() + + request = build_http_failure_get_no_model_error_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -225,23 +125,34 @@ async def get_no_model_error(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace_async - async def get_no_model_empty(self, **kwargs: Any) -> bool: + async def get_no_model_empty( + self, + **kwargs: Any + ) -> bool: """Get empty response from server. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_failure_get_no_model_empty_request() + + request = build_http_failure_get_no_model_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -279,22 +190,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head200(self, **kwargs: Any) -> None: + async def head200( + self, + **kwargs: Any + ) -> None: """Return 200 status code if successful. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_head200_request() + + request = build_http_success_head200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -305,23 +225,34 @@ async def head200(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get200(self, **kwargs: Any) -> bool: + async def get200( + self, + **kwargs: Any + ) -> bool: """Get 200 success. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_get200_request() + + request = build_http_success_get200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -339,23 +270,34 @@ async def get200(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace_async - async def options200(self, **kwargs: Any) -> bool: + async def options200( + self, + **kwargs: Any + ) -> bool: """Options 200 success. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_options200_request() + + request = build_http_success_options200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -373,8 +315,14 @@ async def options200(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace_async - async def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put boolean value true returning 200 success. :param boolean_value: Simple boolean value true. The default value is True. @@ -383,11 +331,13 @@ async def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -401,7 +351,9 @@ async def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -412,8 +364,14 @@ async def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returning 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -422,11 +380,13 @@ async def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -440,7 +400,9 @@ async def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -451,8 +413,14 @@ async def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post bollean value true in request that returns a 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -461,11 +429,13 @@ async def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -479,7 +449,9 @@ async def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -490,8 +462,14 @@ async def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete simple boolean value true returns 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -500,11 +478,13 @@ async def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -518,7 +498,9 @@ async def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -529,8 +511,14 @@ async def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put201( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 201. :param boolean_value: Simple boolean value true. The default value is True. @@ -539,11 +527,13 @@ async def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -557,7 +547,9 @@ async def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -568,8 +560,14 @@ async def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post201( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 201 (Created). :param boolean_value: Simple boolean value true. The default value is True. @@ -578,11 +576,13 @@ async def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -596,7 +596,9 @@ async def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -607,8 +609,14 @@ async def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 202 (Accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -617,11 +625,13 @@ async def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -635,7 +645,9 @@ async def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -646,8 +658,14 @@ async def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 202. :param boolean_value: Simple boolean value true. The default value is True. @@ -656,11 +674,13 @@ async def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -674,7 +694,9 @@ async def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -685,8 +707,14 @@ async def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 202 (Accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -695,11 +723,13 @@ async def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -713,7 +743,9 @@ async def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -724,8 +756,14 @@ async def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete true Boolean value in request returns 202 (accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -734,11 +772,13 @@ async def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -752,7 +792,9 @@ async def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -763,23 +805,34 @@ async def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def head204(self, **kwargs: Any) -> None: + async def head204( + self, + **kwargs: Any + ) -> None: """Return 204 status code if successful. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_head204_request() + + request = build_http_success_head204_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -790,8 +843,14 @@ async def head204(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -800,11 +859,13 @@ async def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -818,7 +879,9 @@ async def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -829,8 +892,14 @@ async def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -839,11 +908,13 @@ async def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -857,7 +928,9 @@ async def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -868,8 +941,14 @@ async def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -878,11 +957,13 @@ async def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -896,7 +977,9 @@ async def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -907,8 +990,14 @@ async def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -917,11 +1006,13 @@ async def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -935,7 +1026,9 @@ async def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -946,23 +1039,34 @@ async def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def head404(self, **kwargs: Any) -> None: + async def head404( + self, + **kwargs: Any + ) -> None: """Return 404 status code. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_head404_request() + + request = build_http_success_head404_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -993,22 +1097,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head300(self, **kwargs: Any) -> None: + async def head300( + self, + **kwargs: Any + ) -> None: """Return 300 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head300_request() + + request = build_http_redirects_head300_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1018,13 +1131,19 @@ async def head300(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def get300(self, **kwargs: Any) -> Optional[List[str]]: + async def get300( + self, + **kwargs: Any + ) -> Optional[List[str]]: """Return 300 status code and redirect to /http/success/200. :return: list of str @@ -1039,15 +1158,21 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get300_request() + + request = build_http_redirects_get300_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1058,8 +1183,8 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: deserialized = None response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -1070,23 +1195,34 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: return deserialized + + @distributed_trace_async - async def head301(self, **kwargs: Any) -> None: + async def head301( + self, + **kwargs: Any + ) -> None: """Return 301 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head301_request() + + request = build_http_redirects_head301_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1096,28 +1232,40 @@ async def head301(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def get301(self, **kwargs: Any) -> None: + async def get301( + self, + **kwargs: Any + ) -> None: """Return 301 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get301_request() + + request = build_http_redirects_get301_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1127,13 +1275,20 @@ async def get301(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put301( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 to the caller for evaluation. @@ -1143,11 +1298,13 @@ async def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1161,7 +1318,9 @@ async def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1170,28 +1329,40 @@ async def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N raise HttpResponseError(response=response) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def head302(self, **kwargs: Any) -> None: + async def head302( + self, + **kwargs: Any + ) -> None: """Return 302 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head302_request() + + request = build_http_redirects_head302_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1201,28 +1372,40 @@ async def head302(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def get302(self, **kwargs: Any) -> None: + async def get302( + self, + **kwargs: Any + ) -> None: """Return 302 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get302_request() + + request = build_http_redirects_get302_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1232,13 +1415,20 @@ async def get302(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch302( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation. @@ -1248,11 +1438,13 @@ async def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1266,7 +1458,9 @@ async def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1275,13 +1469,20 @@ async def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> raise HttpResponseError(response=response) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post303( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code. @@ -1291,11 +1492,13 @@ async def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1309,7 +1512,9 @@ async def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1319,28 +1524,40 @@ async def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> response_headers = {} if response.status_code == 303: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def head307(self, **kwargs: Any) -> None: + async def head307( + self, + **kwargs: Any + ) -> None: """Redirect with 307, resulting in a 200 success. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head307_request() + + request = build_http_redirects_head307_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1350,28 +1567,40 @@ async def head307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def get307(self, **kwargs: Any) -> None: + async def get307( + self, + **kwargs: Any + ) -> None: """Redirect get with 307, resulting in a 200 success. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get307_request() + + request = build_http_redirects_get307_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1381,28 +1610,40 @@ async def get307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def options307(self, **kwargs: Any) -> None: + async def options307( + self, + **kwargs: Any + ) -> None: """options redirected with 307, resulting in a 200 after redirect. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_options307_request() + + request = build_http_redirects_options307_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1412,13 +1653,20 @@ async def options307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -1427,11 +1675,13 @@ async def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1445,7 +1695,9 @@ async def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1455,13 +1707,20 @@ async def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -1470,11 +1729,13 @@ async def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1488,7 +1749,9 @@ async def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1498,13 +1761,20 @@ async def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -1513,11 +1783,13 @@ async def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1531,7 +1803,9 @@ async def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1541,13 +1815,20 @@ async def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -1556,11 +1837,13 @@ async def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1574,7 +1857,9 @@ async def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1584,7 +1869,8 @@ async def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) - response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) @@ -1609,22 +1895,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head400(self, **kwargs: Any) -> None: + async def head400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head400_request() + + request = build_http_client_failure_head400_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1635,23 +1930,34 @@ async def head400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get400(self, **kwargs: Any) -> None: + async def get400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get400_request() + + request = build_http_client_failure_get400_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1662,23 +1968,34 @@ async def get400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def options400(self, **kwargs: Any) -> None: + async def options400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_options400_request() + + request = build_http_client_failure_options400_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1689,8 +2006,14 @@ async def options400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -1699,11 +2022,13 @@ async def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1717,7 +2042,9 @@ async def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1728,8 +2055,14 @@ async def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -1738,11 +2071,13 @@ async def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1756,7 +2091,9 @@ async def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1767,8 +2104,14 @@ async def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -1777,11 +2120,13 @@ async def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1795,7 +2140,9 @@ async def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1806,8 +2153,14 @@ async def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -1816,11 +2169,13 @@ async def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1834,7 +2189,9 @@ async def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1845,23 +2202,34 @@ async def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def head401(self, **kwargs: Any) -> None: + async def head401( + self, + **kwargs: Any + ) -> None: """Return 401 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head401_request() + + request = build_http_client_failure_head401_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1872,23 +2240,34 @@ async def head401(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get402(self, **kwargs: Any) -> None: + async def get402( + self, + **kwargs: Any + ) -> None: """Return 402 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get402_request() + + request = build_http_client_failure_get402_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1899,23 +2278,34 @@ async def get402(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def options403(self, **kwargs: Any) -> None: + async def options403( + self, + **kwargs: Any + ) -> None: """Return 403 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_options403_request() + + request = build_http_client_failure_options403_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1926,23 +2316,34 @@ async def options403(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get403(self, **kwargs: Any) -> None: + async def get403( + self, + **kwargs: Any + ) -> None: """Return 403 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get403_request() + + request = build_http_client_failure_get403_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1953,8 +2354,14 @@ async def get403(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put404( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 404 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -1963,11 +2370,13 @@ async def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1981,7 +2390,9 @@ async def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1992,8 +2403,14 @@ async def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch405( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 405 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2002,11 +2419,13 @@ async def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2020,7 +2439,9 @@ async def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2031,8 +2452,14 @@ async def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post406( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 406 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2041,11 +2468,13 @@ async def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2059,7 +2488,9 @@ async def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2070,8 +2501,14 @@ async def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete407( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 407 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2080,11 +2517,13 @@ async def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2098,7 +2537,9 @@ async def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2109,8 +2550,14 @@ async def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put409( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 409 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2119,11 +2566,13 @@ async def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2137,7 +2586,9 @@ async def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2148,23 +2599,34 @@ async def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def head410(self, **kwargs: Any) -> None: + async def head410( + self, + **kwargs: Any + ) -> None: """Return 410 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head410_request() + + request = build_http_client_failure_head410_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2175,23 +2637,34 @@ async def head410(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get411(self, **kwargs: Any) -> None: + async def get411( + self, + **kwargs: Any + ) -> None: """Return 411 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get411_request() + + request = build_http_client_failure_get411_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2202,23 +2675,34 @@ async def get411(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def options412(self, **kwargs: Any) -> None: + async def options412( + self, + **kwargs: Any + ) -> None: """Return 412 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_options412_request() + + request = build_http_client_failure_options412_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2229,23 +2713,34 @@ async def options412(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get412(self, **kwargs: Any) -> None: + async def get412( + self, + **kwargs: Any + ) -> None: """Return 412 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get412_request() + + request = build_http_client_failure_get412_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2256,8 +2751,14 @@ async def get412(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put413( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 413 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2266,11 +2767,13 @@ async def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2284,7 +2787,9 @@ async def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2295,8 +2800,14 @@ async def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch414( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 414 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2305,11 +2816,13 @@ async def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2323,7 +2836,9 @@ async def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2334,8 +2849,14 @@ async def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post415( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 415 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2344,11 +2865,13 @@ async def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2362,7 +2885,9 @@ async def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2373,23 +2898,34 @@ async def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get416(self, **kwargs: Any) -> None: + async def get416( + self, + **kwargs: Any + ) -> None: """Return 416 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get416_request() + + request = build_http_client_failure_get416_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2400,8 +2936,14 @@ async def get416(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete417( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 417 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2410,11 +2952,13 @@ async def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2428,7 +2972,9 @@ async def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2439,23 +2985,34 @@ async def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def head429(self, **kwargs: Any) -> None: + async def head429( + self, + **kwargs: Any + ) -> None: """Return 429 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head429_request() + + request = build_http_client_failure_head429_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2486,22 +3043,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head501(self, **kwargs: Any) -> None: + async def head501( + self, + **kwargs: Any + ) -> None: """Return 501 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_server_failure_head501_request() + + request = build_http_server_failure_head501_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2512,23 +3078,34 @@ async def head501(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get501(self, **kwargs: Any) -> None: + async def get501( + self, + **kwargs: Any + ) -> None: """Return 501 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_server_failure_get501_request() + + request = build_http_server_failure_get501_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2539,8 +3116,14 @@ async def get501(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post505( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 505 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2549,11 +3132,13 @@ async def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2567,7 +3152,9 @@ async def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2578,8 +3165,14 @@ async def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete505( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 505 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -2588,11 +3181,13 @@ async def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2606,7 +3201,9 @@ async def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2637,22 +3234,31 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def head408(self, **kwargs: Any) -> None: + async def head408( + self, + **kwargs: Any + ) -> None: """Return 408 status code, then 200 after retry. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_retry_head408_request() + + request = build_http_retry_head408_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2663,8 +3269,14 @@ async def head408(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put500( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 500 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -2673,11 +3285,13 @@ async def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2691,7 +3305,9 @@ async def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2702,8 +3318,14 @@ async def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch500( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 500 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -2712,11 +3334,13 @@ async def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2730,7 +3354,9 @@ async def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2741,23 +3367,34 @@ async def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get502(self, **kwargs: Any) -> None: + async def get502( + self, + **kwargs: Any + ) -> None: """Return 502 status code, then 200 after retry. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_retry_get502_request() + + request = build_http_retry_get502_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2768,23 +3405,34 @@ async def get502(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def options502(self, **kwargs: Any) -> bool: + async def options502( + self, + **kwargs: Any + ) -> bool: """Return 502 status code, then 200 after retry. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_retry_options502_request() + + request = build_http_retry_options502_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2802,8 +3450,14 @@ async def options502(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace_async - async def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def post503( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 503 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -2812,11 +3466,13 @@ async def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2830,7 +3486,9 @@ async def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2841,8 +3499,14 @@ async def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def delete503( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 503 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -2851,11 +3515,13 @@ async def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2869,7 +3535,9 @@ async def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2880,8 +3548,14 @@ async def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def put504( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 504 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -2890,11 +3564,13 @@ async def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2908,7 +3584,9 @@ async def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2919,8 +3597,14 @@ async def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + async def patch504( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 504 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -2929,11 +3613,13 @@ async def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2947,7 +3633,9 @@ async def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2978,7 +3666,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) -> Optional[JSONType]: + async def get200_model204_no_model_default_error200_valid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -2993,15 +3684,21 @@ async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) - "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error200_valid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3021,8 +3718,13 @@ async def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) - return deserialized + + @distributed_trace_async - async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) -> Optional[JSONType]: + async def get200_model204_no_model_default_error204_valid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 204 response with no payload. :return: JSON object @@ -3037,15 +3739,21 @@ async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) - "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error204_valid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error204_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3065,8 +3773,13 @@ async def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) - return deserialized + + @distributed_trace_async - async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) -> Optional[JSONType]: + async def get200_model204_no_model_default_error201_invalid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 201 response with valid payload: {'statusCode': '201'}. :return: JSON object @@ -3081,15 +3794,21 @@ async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error201_invalid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error201_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3109,8 +3828,13 @@ async def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) return deserialized + + @distributed_trace_async - async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> Optional[JSONType]: + async def get200_model204_no_model_default_error202_none( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 202 response with no payload:. :return: JSON object @@ -3125,15 +3849,21 @@ async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error202_none_request() + + request = build_multiple_responses_get200_model204_no_model_default_error202_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3153,8 +3883,13 @@ async def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> return deserialized + + @distributed_trace_async - async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) -> Optional[JSONType]: + async def get200_model204_no_model_default_error400_valid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. :return: JSON object @@ -3169,15 +3904,21 @@ async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) - "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error400_valid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3197,8 +3938,13 @@ async def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) - return deserialized + + @distributed_trace_async - async def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> JSONType: + async def get200_model201_model_default_error200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -3218,15 +3964,21 @@ async def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> J "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model201_model_default_error200_valid_request() + + request = build_multiple_responses_get200_model201_model_default_error200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3251,8 +4003,13 @@ async def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> J return deserialized + + @distributed_trace_async - async def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> JSONType: + async def get200_model201_model_default_error201_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. :return: JSON object @@ -3272,15 +4029,21 @@ async def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> J "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model201_model_default_error201_valid_request() + + request = build_multiple_responses_get200_model201_model_default_error201_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3305,8 +4068,13 @@ async def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> J return deserialized + + @distributed_trace_async - async def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> JSONType: + async def get200_model201_model_default_error400_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object @@ -3326,15 +4094,21 @@ async def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> J "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model201_model_default_error400_valid_request() + + request = build_multiple_responses_get200_model201_model_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3359,8 +4133,13 @@ async def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> J return deserialized + + @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kwargs: Any) -> JSONType: + async def get200_model_a201_model_c404_model_d_default_error200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -3383,15 +4162,21 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error200_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3422,8 +4207,13 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kw return deserialized + + @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kwargs: Any) -> JSONType: + async def get200_model_a201_model_c404_model_d_default_error201_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'httpCode': '201'}. :return: JSON object @@ -3446,15 +4236,21 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error201_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error201_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3485,8 +4281,13 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kw return deserialized + + @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kwargs: Any) -> JSONType: + async def get200_model_a201_model_c404_model_d_default_error404_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'httpStatusCode': '404'}. :return: JSON object @@ -3509,15 +4310,21 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error404_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error404_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3548,8 +4355,13 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kw return deserialized + + @distributed_trace_async - async def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kwargs: Any) -> JSONType: + async def get200_model_a201_model_c404_model_d_default_error400_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object @@ -3572,15 +4384,21 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kw "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error400_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3611,23 +4429,34 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kw return deserialized + + @distributed_trace_async - async def get202_none204_none_default_error202_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_error202_none( + self, + **kwargs: Any + ) -> None: """Send a 202 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_error202_none_request() + + request = build_multiple_responses_get202_none204_none_default_error202_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3638,23 +4467,34 @@ async def get202_none204_none_default_error202_none(self, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get202_none204_none_default_error204_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_error204_none( + self, + **kwargs: Any + ) -> None: """Send a 204 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_error204_none_request() + + request = build_multiple_responses_get202_none204_none_default_error204_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3665,23 +4505,34 @@ async def get202_none204_none_default_error204_none(self, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get202_none204_none_default_error400_valid(self, **kwargs: Any) -> None: + async def get202_none204_none_default_error400_valid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_error400_valid_request() + + request = build_multiple_responses_get202_none204_none_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3692,23 +4543,34 @@ async def get202_none204_none_default_error400_valid(self, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get202_none204_none_default_none202_invalid(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none202_invalid( + self, + **kwargs: Any + ) -> None: """Send a 202 response with an unexpected payload {'property': 'value'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none202_invalid_request() + + request = build_multiple_responses_get202_none204_none_default_none202_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3719,23 +4581,34 @@ async def get202_none204_none_default_none202_invalid(self, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get202_none204_none_default_none204_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none204_none( + self, + **kwargs: Any + ) -> None: """Send a 204 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none204_none_request() + + request = build_multiple_responses_get202_none204_none_default_none204_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3746,23 +4619,34 @@ async def get202_none204_none_default_none204_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get202_none204_none_default_none400_none(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none400_none_request() + + request = build_multiple_responses_get202_none204_none_default_none400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3773,23 +4657,34 @@ async def get202_none204_none_default_none400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> None: + async def get202_none204_none_default_none400_invalid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with an unexpected payload {'property': 'value'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none400_invalid_request() + + request = build_multiple_responses_get202_none204_none_default_none400_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3800,8 +4695,13 @@ async def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_default_model_a200_valid(self, **kwargs: Any) -> JSONType: + async def get_default_model_a200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -3816,15 +4716,21 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a200_valid_request() + + request = build_multiple_responses_get_default_model_a200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3842,8 +4748,13 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_default_model_a200_none(self, **kwargs: Any) -> JSONType: + async def get_default_model_a200_none( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with no payload. :return: JSON object @@ -3858,15 +4769,21 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a200_none_request() + + request = build_multiple_responses_get_default_model_a200_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3884,23 +4801,34 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_default_model_a400_valid(self, **kwargs: Any) -> None: + async def get_default_model_a400_valid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'statusCode': '400'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a400_valid_request() + + request = build_multiple_responses_get_default_model_a400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3911,23 +4839,34 @@ async def get_default_model_a400_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_default_model_a400_none(self, **kwargs: Any) -> None: + async def get_default_model_a400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a400_none_request() + + request = build_multiple_responses_get_default_model_a400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3938,23 +4877,34 @@ async def get_default_model_a400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_default_none200_invalid(self, **kwargs: Any) -> None: + async def get_default_none200_invalid( + self, + **kwargs: Any + ) -> None: """Send a 200 response with invalid payload: {'statusCode': '200'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none200_invalid_request() + + request = build_multiple_responses_get_default_none200_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3965,23 +4915,34 @@ async def get_default_none200_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_default_none200_none(self, **kwargs: Any) -> None: + async def get_default_none200_none( + self, + **kwargs: Any + ) -> None: """Send a 200 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none200_none_request() + + request = build_multiple_responses_get_default_none200_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3992,23 +4953,34 @@ async def get_default_none200_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_default_none400_invalid(self, **kwargs: Any) -> None: + async def get_default_none400_invalid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'statusCode': '400'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none400_invalid_request() + + request = build_multiple_responses_get_default_none400_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4019,23 +4991,34 @@ async def get_default_none400_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_default_none400_none(self, **kwargs: Any) -> None: + async def get_default_none400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none400_none_request() + + request = build_multiple_responses_get_default_none400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4046,8 +5029,13 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get200_model_a200_none(self, **kwargs: Any) -> JSONType: + async def get200_model_a200_none( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A. @@ -4063,15 +5051,21 @@ async def get200_model_a200_none(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a200_none_request() + + request = build_multiple_responses_get200_model_a200_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4089,8 +5083,13 @@ async def get200_model_a200_none(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get200_model_a200_valid(self, **kwargs: Any) -> JSONType: + async def get200_model_a200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with payload {'statusCode': '200'}. :return: JSON object @@ -4105,15 +5104,21 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a200_valid_request() + + request = build_multiple_responses_get200_model_a200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4131,8 +5136,13 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get200_model_a200_invalid(self, **kwargs: Any) -> JSONType: + async def get200_model_a200_invalid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. :return: JSON object @@ -4147,15 +5157,21 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a200_invalid_request() + + request = build_multiple_responses_get200_model_a200_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4173,8 +5189,13 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get200_model_a400_none(self, **kwargs: Any) -> JSONType: + async def get200_model_a400_none( + self, + **kwargs: Any + ) -> JSONType: """Send a 400 response with no payload client should treat as an http error with no error model. :return: JSON object @@ -4189,15 +5210,21 @@ async def get200_model_a400_none(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a400_none_request() + + request = build_multiple_responses_get200_model_a400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4215,8 +5242,13 @@ async def get200_model_a400_none(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get200_model_a400_valid(self, **kwargs: Any) -> JSONType: + async def get200_model_a400_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with payload {'statusCode': '400'}. :return: JSON object @@ -4231,15 +5263,21 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a400_valid_request() + + request = build_multiple_responses_get200_model_a400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4257,8 +5295,13 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get200_model_a400_invalid(self, **kwargs: Any) -> JSONType: + async def get200_model_a400_invalid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. :return: JSON object @@ -4273,15 +5316,21 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a400_invalid_request() + + request = build_multiple_responses_get200_model_a400_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4299,8 +5348,13 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get200_model_a202_valid(self, **kwargs: Any) -> JSONType: + async def get200_model_a202_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 202 response with payload {'statusCode': '202'}. :return: JSON object @@ -4315,15 +5369,21 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a202_valid_request() + + request = build_multiple_responses_get200_model_a202_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4340,3 +5400,5 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/__init__.py index 7b4c3112424..496c9c1c46b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/__init__.py @@ -15,11 +15,11 @@ from ._operations import MultipleResponsesOperations __all__ = [ - "HttpFailureOperations", - "HttpSuccessOperations", - "HttpRedirectsOperations", - "HttpClientFailureOperations", - "HttpServerFailureOperations", - "HttpRetryOperations", - "MultipleResponsesOperations", + 'HttpFailureOperations', + 'HttpSuccessOperations', + 'HttpRedirectsOperations', + 'HttpClientFailureOperations', + 'HttpServerFailureOperations', + 'HttpRetryOperations', + 'MultipleResponsesOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py index 78392a457ec..952108750a5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py @@ -8,1524 +8,2456 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_http_failure_get_empty_error_request(**kwargs: Any) -> HttpRequest: +def build_http_failure_get_empty_error_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/emptybody/error" + url = '/http/failure/emptybody/error' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_failure_get_no_model_error_request(**kwargs: Any) -> HttpRequest: +def build_http_failure_get_no_model_error_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/nomodel/error" + url = '/http/failure/nomodel/error' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_failure_get_no_model_empty_request(**kwargs: Any) -> HttpRequest: +def build_http_failure_get_no_model_empty_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/nomodel/empty" + url = '/http/failure/nomodel/empty' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_success_head200_request(**kwargs: Any) -> HttpRequest: +def build_http_success_head200_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_success_get200_request(**kwargs: Any) -> HttpRequest: +def build_http_success_get200_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_success_options200_request(**kwargs: Any) -> HttpRequest: +def build_http_success_options200_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_success_put200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_http_success_put200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_patch200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_patch200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_post200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_post200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_delete200_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_delete200_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/200" + url = '/http/success/200' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_put201_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_put201_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/201" + url = '/http/success/201' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_post201_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_post201_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/201" + url = '/http/success/201' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_put202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_put202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_patch202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_patch202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_post202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_post202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_delete202_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_delete202_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/202" + url = '/http/success/202' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_success_head204_request(**kwargs: Any) -> HttpRequest: +def build_http_success_head204_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_success_put204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_http_success_put204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_patch204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_patch204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_post204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_post204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_success_delete204_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_success_delete204_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/success/204" + url = '/http/success/204' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_success_head404_request(**kwargs: Any) -> HttpRequest: +def build_http_success_head404_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/success/404" + url = '/http/success/404' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_head300_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_head300_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/300" + url = '/http/redirect/300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_get300_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_get300_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/300" + url = '/http/redirect/300' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_head301_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_head301_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/301" + url = '/http/redirect/301' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_get301_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_get301_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/301" + url = '/http/redirect/301' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_put301_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_http_redirects_put301_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/301" + url = '/http/redirect/301' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_redirects_head302_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_head302_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/302" + url = '/http/redirect/302' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_get302_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_get302_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/302" + url = '/http/redirect/302' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_patch302_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_http_redirects_patch302_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/302" + url = '/http/redirect/302' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_redirects_post303_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_redirects_post303_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/303" + url = '/http/redirect/303' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_redirects_head307_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_head307_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_get307_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_get307_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_options307_request(**kwargs: Any) -> HttpRequest: +def build_http_redirects_options307_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_redirects_put307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_http_redirects_put307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_redirects_patch307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_redirects_patch307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_redirects_post307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_redirects_post307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_redirects_delete307_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_redirects_delete307_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/redirect/307" + url = '/http/redirect/307' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_client_failure_head400_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_head400_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_get400_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_get400_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_options400_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_options400_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) def build_http_client_failure_put400_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_patch400_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_post400_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_delete400_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/400" + url = '/http/failure/client/400' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_client_failure_head401_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_head401_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/401" + url = '/http/failure/client/401' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_get402_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_get402_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/402" + url = '/http/failure/client/402' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_options403_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_options403_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/403" + url = '/http/failure/client/403' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_get403_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_get403_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/403" + url = '/http/failure/client/403' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_http_client_failure_put404_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/404" + url = '/http/failure/client/404' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_patch405_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/405" + url = '/http/failure/client/405' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_post406_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/406" + url = '/http/failure/client/406' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_delete407_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/407" + url = '/http/failure/client/407' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_put409_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/409" + url = '/http/failure/client/409' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_client_failure_head410_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_head410_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/410" + url = '/http/failure/client/410' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_get411_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_get411_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/411" + url = '/http/failure/client/411' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_options412_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_options412_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/412" + url = '/http/failure/client/412' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_client_failure_get412_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_get412_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/412" + url = '/http/failure/client/412' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_http_client_failure_put413_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/413" + url = '/http/failure/client/413' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_patch414_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/414" + url = '/http/failure/client/414' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_client_failure_post415_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/415" + url = '/http/failure/client/415' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_client_failure_get416_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_get416_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/416" + url = '/http/failure/client/416' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_http_client_failure_delete417_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/client/417" + url = '/http/failure/client/417' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_client_failure_head429_request(**kwargs: Any) -> HttpRequest: +def build_http_client_failure_head429_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/client/429" + url = '/http/failure/client/429' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_server_failure_head501_request(**kwargs: Any) -> HttpRequest: +def build_http_server_failure_head501_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/server/501" + url = '/http/failure/server/501' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_server_failure_get501_request(**kwargs: Any) -> HttpRequest: +def build_http_server_failure_get501_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/failure/server/501" + url = '/http/failure/server/501' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_http_server_failure_post505_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/server/505" + url = '/http/failure/server/505' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_http_server_failure_delete505_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/failure/server/505" + url = '/http/failure/server/505' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_retry_head408_request(**kwargs: Any) -> HttpRequest: +def build_http_retry_head408_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/retry/408" + url = '/http/retry/408' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="HEAD", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="HEAD", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_retry_put500_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_http_retry_put500_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/500" + url = '/http/retry/500' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_retry_patch500_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_retry_patch500_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/500" + url = '/http/retry/500' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_http_retry_get502_request(**kwargs: Any) -> HttpRequest: +def build_http_retry_get502_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/retry/502" + url = '/http/retry/502' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_retry_options502_request(**kwargs: Any) -> HttpRequest: +def build_http_retry_options502_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/retry/502" + url = '/http/retry/502' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="OPTIONS", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="OPTIONS", + url=url, + headers=header_parameters, + **kwargs + ) -def build_http_retry_post503_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_http_retry_post503_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/503" + url = '/http/retry/503' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_retry_delete503_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_retry_delete503_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/503" + url = '/http/retry/503' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_retry_put504_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_retry_put504_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/504" + url = '/http/retry/504' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_http_retry_patch504_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_http_retry_patch504_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/http/retry/504" + url = '/http/retry/504' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_multiple_responses_get200_model204_no_model_default_error200_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model204_no_model_default_error200_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/200/valid" + url = '/http/payloads/200/A/204/none/default/Error/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model204_no_model_default_error204_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model204_no_model_default_error204_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/204/none" + url = '/http/payloads/200/A/204/none/default/Error/response/204/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model204_no_model_default_error201_invalid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model204_no_model_default_error201_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/201/valid" + url = '/http/payloads/200/A/204/none/default/Error/response/201/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model204_no_model_default_error202_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model204_no_model_default_error202_none_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/202/none" + url = '/http/payloads/200/A/204/none/default/Error/response/202/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model204_no_model_default_error400_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model204_no_model_default_error400_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/204/none/default/Error/response/400/valid" + url = '/http/payloads/200/A/204/none/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model201_model_default_error200_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model201_model_default_error200_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/B/default/Error/response/200/valid" + url = '/http/payloads/200/A/201/B/default/Error/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model201_model_default_error201_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model201_model_default_error201_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/B/default/Error/response/201/valid" + url = '/http/payloads/200/A/201/B/default/Error/response/201/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model201_model_default_error400_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model201_model_default_error400_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/B/default/Error/response/400/valid" + url = '/http/payloads/200/A/201/B/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_multiple_responses_get200_model_a201_model_c404_model_d_default_error200_valid_request( - **kwargs: Any, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_multiple_responses_get200_model_a201_model_c404_model_d_default_error201_valid_request( - **kwargs: Any, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_multiple_responses_get200_model_a201_model_c404_model_d_default_error404_valid_request( - **kwargs: Any, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) def build_multiple_responses_get200_model_a201_model_c404_model_d_default_error400_valid_request( - **kwargs: Any, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid" + url = '/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get202_none204_none_default_error202_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get202_none204_none_default_error202_none_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/202/none/204/none/default/Error/response/202/none" + url = '/http/payloads/202/none/204/none/default/Error/response/202/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get202_none204_none_default_error204_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get202_none204_none_default_error204_none_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/202/none/204/none/default/Error/response/204/none" + url = '/http/payloads/202/none/204/none/default/Error/response/204/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get202_none204_none_default_error400_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get202_none204_none_default_error400_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/202/none/204/none/default/Error/response/400/valid" + url = '/http/payloads/202/none/204/none/default/Error/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get202_none204_none_default_none202_invalid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get202_none204_none_default_none202_invalid_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/202/invalid" + url = '/http/payloads/202/none/204/none/default/none/response/202/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get202_none204_none_default_none204_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get202_none204_none_default_none204_none_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/204/none" + url = '/http/payloads/202/none/204/none/default/none/response/204/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get202_none204_none_default_none400_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get202_none204_none_default_none400_none_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/400/none" + url = '/http/payloads/202/none/204/none/default/none/response/400/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get202_none204_none_default_none400_invalid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get202_none204_none_default_none400_invalid_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/202/none/204/none/default/none/response/400/invalid" + url = '/http/payloads/202/none/204/none/default/none/response/400/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get_default_model_a200_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_model_a200_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/200/valid" + url = '/http/payloads/default/A/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get_default_model_a200_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_model_a200_none_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/200/none" + url = '/http/payloads/default/A/response/200/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get_default_model_a400_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_model_a400_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/400/valid" + url = '/http/payloads/default/A/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get_default_model_a400_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_model_a400_none_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/default/A/response/400/none" + url = '/http/payloads/default/A/response/400/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get_default_none200_invalid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_none200_invalid_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/default/none/response/200/invalid" + url = '/http/payloads/default/none/response/200/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get_default_none200_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_none200_none_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/default/none/response/200/none" + url = '/http/payloads/default/none/response/200/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get_default_none400_invalid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_none400_invalid_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/default/none/response/400/invalid" + url = '/http/payloads/default/none/response/400/invalid' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get_default_none400_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get_default_none400_none_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/http/payloads/default/none/response/400/none" + url = '/http/payloads/default/none/response/400/none' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_multiple_responses_get200_model_a200_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model_a200_none_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/200/none" + url = '/http/payloads/200/A/response/200/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model_a200_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model_a200_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/200/valid" + url = '/http/payloads/200/A/response/200/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model_a200_invalid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model_a200_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/200/invalid" + url = '/http/payloads/200/A/response/200/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model_a400_none_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model_a400_none_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/400/none" + url = '/http/payloads/200/A/response/400/none' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model_a400_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model_a400_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/400/valid" + url = '/http/payloads/200/A/response/400/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model_a400_invalid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model_a400_invalid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/400/invalid" + url = '/http/payloads/200/A/response/400/invalid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_multiple_responses_get200_model_a202_valid_request(**kwargs: Any) -> HttpRequest: +def build_multiple_responses_get200_model_a202_valid_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/http/payloads/200/A/response/202/valid" + url = '/http/payloads/200/A/response/202/valid' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class HttpFailureOperations(object): """HttpFailureOperations operations. @@ -1546,22 +2478,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_empty_error(self, **kwargs: Any) -> bool: + def get_empty_error( + self, + **kwargs: Any + ) -> bool: """Get empty error form server. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_failure_get_empty_error_request() + + request = build_http_failure_get_empty_error_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1579,23 +2520,34 @@ def get_empty_error(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace - def get_no_model_error(self, **kwargs: Any) -> bool: + def get_no_model_error( + self, + **kwargs: Any + ) -> bool: """Get empty error form server. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_failure_get_no_model_error_request() + + request = build_http_failure_get_no_model_error_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1613,23 +2565,34 @@ def get_no_model_error(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace - def get_no_model_empty(self, **kwargs: Any) -> bool: + def get_no_model_empty( + self, + **kwargs: Any + ) -> bool: """Get empty response from server. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_failure_get_no_model_empty_request() + + request = build_http_failure_get_no_model_empty_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1667,22 +2630,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head200(self, **kwargs: Any) -> None: + def head200( + self, + **kwargs: Any + ) -> None: """Return 200 status code if successful. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_head200_request() + + request = build_http_success_head200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1693,23 +2665,34 @@ def head200(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get200(self, **kwargs: Any) -> bool: + def get200( + self, + **kwargs: Any + ) -> bool: """Get 200 success. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_get200_request() + + request = build_http_success_get200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1727,23 +2710,34 @@ def get200(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace - def options200(self, **kwargs: Any) -> bool: + def options200( + self, + **kwargs: Any + ) -> bool: """Options 200 success. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_options200_request() + + request = build_http_success_options200_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1761,8 +2755,14 @@ def options200(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace - def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put boolean value true returning 200 success. :param boolean_value: Simple boolean value true. The default value is True. @@ -1771,11 +2771,13 @@ def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1789,7 +2791,9 @@ def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1800,8 +2804,14 @@ def put200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returning 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -1810,11 +2820,13 @@ def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1828,7 +2840,9 @@ def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1839,8 +2853,14 @@ def patch200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post bollean value true in request that returns a 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -1849,11 +2869,13 @@ def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1867,7 +2889,9 @@ def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1878,8 +2902,14 @@ def post200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete200( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete simple boolean value true returns 200. :param boolean_value: Simple boolean value true. The default value is True. @@ -1888,11 +2918,13 @@ def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1906,7 +2938,9 @@ def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1917,8 +2951,14 @@ def delete200(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put201( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 201. :param boolean_value: Simple boolean value true. The default value is True. @@ -1927,11 +2967,13 @@ def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1945,7 +2987,9 @@ def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1956,8 +3000,14 @@ def put201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post201( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 201 (Created). :param boolean_value: Simple boolean value true. The default value is True. @@ -1966,11 +3016,13 @@ def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -1984,7 +3036,9 @@ def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1995,8 +3049,14 @@ def post201(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 202 (Accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -2005,11 +3065,13 @@ def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2023,7 +3085,9 @@ def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2034,8 +3098,14 @@ def put202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 202. :param boolean_value: Simple boolean value true. The default value is True. @@ -2044,11 +3114,13 @@ def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2062,7 +3134,9 @@ def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2073,8 +3147,14 @@ def patch202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 202 (Accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -2083,11 +3163,13 @@ def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2101,7 +3183,9 @@ def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2112,8 +3196,14 @@ def post202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete202( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete true Boolean value in request returns 202 (accepted). :param boolean_value: Simple boolean value true. The default value is True. @@ -2122,11 +3212,13 @@ def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2140,7 +3232,9 @@ def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2151,23 +3245,34 @@ def delete202(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def head204(self, **kwargs: Any) -> None: + def head204( + self, + **kwargs: Any + ) -> None: """Return 204 status code if successful. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_head204_request() + + request = build_http_success_head204_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2178,8 +3283,14 @@ def head204(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -2188,11 +3299,13 @@ def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2206,7 +3319,9 @@ def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2217,8 +3332,14 @@ def put204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -2227,11 +3348,13 @@ def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2245,7 +3368,9 @@ def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2256,8 +3381,14 @@ def patch204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -2266,11 +3397,13 @@ def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2284,7 +3417,9 @@ def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2295,8 +3430,14 @@ def post204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete204( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete true Boolean value in request returns 204 (no content). :param boolean_value: Simple boolean value true. The default value is True. @@ -2305,11 +3446,13 @@ def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2323,7 +3466,9 @@ def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2334,23 +3479,34 @@ def delete204(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def head404(self, **kwargs: Any) -> None: + def head404( + self, + **kwargs: Any + ) -> None: """Return 404 status code. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_success_head404_request() + + request = build_http_success_head404_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2381,22 +3537,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head300(self, **kwargs: Any) -> None: + def head300( + self, + **kwargs: Any + ) -> None: """Return 300 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head300_request() + + request = build_http_redirects_head300_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2406,13 +3571,19 @@ def head300(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def get300(self, **kwargs: Any) -> Optional[List[str]]: + def get300( + self, + **kwargs: Any + ) -> Optional[List[str]]: """Return 300 status code and redirect to /http/success/200. :return: list of str @@ -2427,15 +3598,21 @@ def get300(self, **kwargs: Any) -> Optional[List[str]]: "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[List[str]]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[List[str]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get300_request() + + request = build_http_redirects_get300_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2446,8 +3623,8 @@ def get300(self, **kwargs: Any) -> Optional[List[str]]: deserialized = None response_headers = {} if response.status_code == 300: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if response.content: deserialized = response.json() else: @@ -2458,23 +3635,34 @@ def get300(self, **kwargs: Any) -> Optional[List[str]]: return deserialized + + @distributed_trace - def head301(self, **kwargs: Any) -> None: + def head301( + self, + **kwargs: Any + ) -> None: """Return 301 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head301_request() + + request = build_http_redirects_head301_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2484,28 +3672,40 @@ def head301(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def get301(self, **kwargs: Any) -> None: + def get301( + self, + **kwargs: Any + ) -> None: """Return 301 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get301_request() + + request = build_http_redirects_get301_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2515,13 +3715,20 @@ def get301(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 301: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put301( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 to the caller for evaluation. @@ -2531,11 +3738,13 @@ def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2549,7 +3758,9 @@ def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2558,28 +3769,40 @@ def put301(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def head302(self, **kwargs: Any) -> None: + def head302( + self, + **kwargs: Any + ) -> None: """Return 302 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head302_request() + + request = build_http_redirects_head302_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2589,28 +3812,40 @@ def head302(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def get302(self, **kwargs: Any) -> None: + def get302( + self, + **kwargs: Any + ) -> None: """Return 302 status code and redirect to /http/success/200. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get302_request() + + request = build_http_redirects_get302_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2620,13 +3855,20 @@ def get302(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 302: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch302( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation. @@ -2636,11 +3878,13 @@ def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2654,7 +3898,9 @@ def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2663,13 +3909,20 @@ def patch302(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post303( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code. @@ -2679,11 +3932,13 @@ def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2697,7 +3952,9 @@ def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2707,28 +3964,40 @@ def post303(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: response_headers = {} if response.status_code == 303: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def head307(self, **kwargs: Any) -> None: + def head307( + self, + **kwargs: Any + ) -> None: """Redirect with 307, resulting in a 200 success. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_head307_request() + + request = build_http_redirects_head307_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2738,28 +4007,40 @@ def head307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def get307(self, **kwargs: Any) -> None: + def get307( + self, + **kwargs: Any + ) -> None: """Redirect get with 307, resulting in a 200 success. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_get307_request() + + request = build_http_redirects_get307_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2769,28 +4050,40 @@ def get307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def options307(self, **kwargs: Any) -> None: + def options307( + self, + **kwargs: Any + ) -> None: """options redirected with 307, resulting in a 200 after redirect. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_redirects_options307_request() + + request = build_http_redirects_options307_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2800,13 +4093,20 @@ def options307(self, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Put redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -2815,11 +4115,13 @@ def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2833,7 +4135,9 @@ def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2843,13 +4147,20 @@ def put307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Patch redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -2858,11 +4169,13 @@ def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2876,7 +4189,9 @@ def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2886,13 +4201,20 @@ def patch307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Post redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -2901,11 +4223,13 @@ def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2919,7 +4243,9 @@ def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2929,13 +4255,20 @@ def post307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete307( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Delete redirected with 307, resulting in a 200 after redirect. :param boolean_value: Simple boolean value true. The default value is True. @@ -2944,11 +4277,13 @@ def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -2962,7 +4297,9 @@ def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2972,7 +4309,8 @@ def delete307(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None response_headers = {} if response.status_code == 307: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, None, response_headers) @@ -2997,22 +4335,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head400(self, **kwargs: Any) -> None: + def head400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head400_request() + + request = build_http_client_failure_head400_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3023,23 +4370,34 @@ def head400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get400(self, **kwargs: Any) -> None: + def get400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get400_request() + + request = build_http_client_failure_get400_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3050,23 +4408,34 @@ def get400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def options400(self, **kwargs: Any) -> None: + def options400( + self, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_options400_request() + + request = build_http_client_failure_options400_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3077,8 +4446,14 @@ def options400(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3087,11 +4462,13 @@ def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3105,7 +4482,9 @@ def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3116,8 +4495,14 @@ def put400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3126,11 +4511,13 @@ def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3144,7 +4531,9 @@ def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3155,8 +4544,14 @@ def patch400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3165,11 +4560,13 @@ def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3183,7 +4580,9 @@ def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3194,8 +4593,14 @@ def post400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete400( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 400 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3204,11 +4609,13 @@ def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3222,7 +4629,9 @@ def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3233,23 +4642,34 @@ def delete400(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def head401(self, **kwargs: Any) -> None: + def head401( + self, + **kwargs: Any + ) -> None: """Return 401 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head401_request() + + request = build_http_client_failure_head401_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3260,23 +4680,34 @@ def head401(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get402(self, **kwargs: Any) -> None: + def get402( + self, + **kwargs: Any + ) -> None: """Return 402 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get402_request() + + request = build_http_client_failure_get402_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3287,23 +4718,34 @@ def get402(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def options403(self, **kwargs: Any) -> None: + def options403( + self, + **kwargs: Any + ) -> None: """Return 403 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_options403_request() + + request = build_http_client_failure_options403_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3314,23 +4756,34 @@ def options403(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get403(self, **kwargs: Any) -> None: + def get403( + self, + **kwargs: Any + ) -> None: """Return 403 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get403_request() + + request = build_http_client_failure_get403_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3341,8 +4794,14 @@ def get403(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put404( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 404 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3351,11 +4810,13 @@ def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3369,7 +4830,9 @@ def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3380,8 +4843,14 @@ def put404(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch405( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 405 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3390,11 +4859,13 @@ def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3408,7 +4879,9 @@ def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3419,8 +4892,14 @@ def patch405(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post406( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 406 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3429,11 +4908,13 @@ def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3447,7 +4928,9 @@ def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3458,8 +4941,14 @@ def post406(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete407( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 407 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3468,11 +4957,13 @@ def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3486,7 +4977,9 @@ def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3497,8 +4990,14 @@ def delete407(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put409( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 409 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3507,11 +5006,13 @@ def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3525,7 +5026,9 @@ def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3536,23 +5039,34 @@ def put409(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def head410(self, **kwargs: Any) -> None: + def head410( + self, + **kwargs: Any + ) -> None: """Return 410 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head410_request() + + request = build_http_client_failure_head410_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3563,23 +5077,34 @@ def head410(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get411(self, **kwargs: Any) -> None: + def get411( + self, + **kwargs: Any + ) -> None: """Return 411 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get411_request() + + request = build_http_client_failure_get411_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3590,23 +5115,34 @@ def get411(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def options412(self, **kwargs: Any) -> None: + def options412( + self, + **kwargs: Any + ) -> None: """Return 412 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_options412_request() + + request = build_http_client_failure_options412_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3617,23 +5153,34 @@ def options412(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get412(self, **kwargs: Any) -> None: + def get412( + self, + **kwargs: Any + ) -> None: """Return 412 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get412_request() + + request = build_http_client_failure_get412_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3644,8 +5191,14 @@ def get412(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put413( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 413 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3654,11 +5207,13 @@ def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3672,7 +5227,9 @@ def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3683,8 +5240,14 @@ def put413(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch414( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 414 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3693,11 +5256,13 @@ def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3711,7 +5276,9 @@ def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3722,8 +5289,14 @@ def patch414(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post415( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 415 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3732,11 +5305,13 @@ def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3750,7 +5325,9 @@ def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3761,23 +5338,34 @@ def post415(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get416(self, **kwargs: Any) -> None: + def get416( + self, + **kwargs: Any + ) -> None: """Return 416 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_get416_request() + + request = build_http_client_failure_get416_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3788,8 +5376,14 @@ def get416(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete417( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 417 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3798,11 +5392,13 @@ def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3816,7 +5412,9 @@ def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3827,23 +5425,34 @@ def delete417(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def head429(self, **kwargs: Any) -> None: + def head429( + self, + **kwargs: Any + ) -> None: """Return 429 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_client_failure_head429_request() + + request = build_http_client_failure_head429_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3874,22 +5483,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head501(self, **kwargs: Any) -> None: + def head501( + self, + **kwargs: Any + ) -> None: """Return 501 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_server_failure_head501_request() + + request = build_http_server_failure_head501_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3900,23 +5518,34 @@ def head501(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get501(self, **kwargs: Any) -> None: + def get501( + self, + **kwargs: Any + ) -> None: """Return 501 status code - should be represented in the client as an error. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_server_failure_get501_request() + + request = build_http_server_failure_get501_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3927,8 +5556,14 @@ def get501(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post505( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 505 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3937,11 +5572,13 @@ def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3955,7 +5592,9 @@ def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3966,8 +5605,14 @@ def post505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete505( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 505 status code - should be represented in the client as an error. :param boolean_value: Simple boolean value true. The default value is True. @@ -3976,11 +5621,13 @@ def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -3994,7 +5641,9 @@ def delete505(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4025,22 +5674,31 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def head408(self, **kwargs: Any) -> None: + def head408( + self, + **kwargs: Any + ) -> None: """Return 408 status code, then 200 after retry. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_retry_head408_request() + + request = build_http_retry_head408_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4051,8 +5709,14 @@ def head408(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put500( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 500 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -4061,11 +5725,13 @@ def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -4079,7 +5745,9 @@ def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4090,8 +5758,14 @@ def put500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch500( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 500 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -4100,11 +5774,13 @@ def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -4118,7 +5794,9 @@ def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4129,23 +5807,34 @@ def patch500(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get502(self, **kwargs: Any) -> None: + def get502( + self, + **kwargs: Any + ) -> None: """Return 502 status code, then 200 after retry. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_retry_get502_request() + + request = build_http_retry_get502_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4156,23 +5845,34 @@ def get502(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def options502(self, **kwargs: Any) -> bool: + def options502( + self, + **kwargs: Any + ) -> bool: """Return 502 status code, then 200 after retry. :return: bool :rtype: bool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[bool] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_http_retry_options502_request() + + request = build_http_retry_options502_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4190,8 +5890,14 @@ def options502(self, **kwargs: Any) -> bool: return deserialized + + @distributed_trace - def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def post503( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 503 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -4200,11 +5906,13 @@ def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -4218,7 +5926,9 @@ def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4229,8 +5939,14 @@ def post503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def delete503( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 503 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -4239,11 +5955,13 @@ def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -4257,7 +5975,9 @@ def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4268,8 +5988,14 @@ def delete503(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def put504( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 504 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -4278,11 +6004,13 @@ def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -4296,7 +6024,9 @@ def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4307,8 +6037,14 @@ def put504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: + def patch504( + self, + boolean_value: Optional[bool] = True, + **kwargs: Any + ) -> None: """Return 504 status code, then 200 after retry. :param boolean_value: Simple boolean value true. The default value is True. @@ -4317,11 +6053,13 @@ def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if boolean_value is not None: _json = boolean_value @@ -4335,7 +6073,9 @@ def patch504(self, boolean_value: Optional[bool] = True, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4366,7 +6106,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) -> Optional[JSONType]: + def get200_model204_no_model_default_error200_valid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -4381,15 +6124,21 @@ def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) -> Opti "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error200_valid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4409,8 +6158,13 @@ def get200_model204_no_model_default_error200_valid(self, **kwargs: Any) -> Opti return deserialized + + @distributed_trace - def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) -> Optional[JSONType]: + def get200_model204_no_model_default_error204_valid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 204 response with no payload. :return: JSON object @@ -4425,15 +6179,21 @@ def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) -> Opti "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error204_valid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error204_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4453,8 +6213,13 @@ def get200_model204_no_model_default_error204_valid(self, **kwargs: Any) -> Opti return deserialized + + @distributed_trace - def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) -> Optional[JSONType]: + def get200_model204_no_model_default_error201_invalid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 201 response with valid payload: {'statusCode': '201'}. :return: JSON object @@ -4469,15 +6234,21 @@ def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) -> Op "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error201_invalid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error201_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4497,8 +6268,13 @@ def get200_model204_no_model_default_error201_invalid(self, **kwargs: Any) -> Op return deserialized + + @distributed_trace - def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> Optional[JSONType]: + def get200_model204_no_model_default_error202_none( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 202 response with no payload:. :return: JSON object @@ -4513,15 +6289,21 @@ def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> Optio "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error202_none_request() + + request = build_multiple_responses_get200_model204_no_model_default_error202_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4541,8 +6323,13 @@ def get200_model204_no_model_default_error202_none(self, **kwargs: Any) -> Optio return deserialized + + @distributed_trace - def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) -> Optional[JSONType]: + def get200_model204_no_model_default_error400_valid( + self, + **kwargs: Any + ) -> Optional[JSONType]: """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. :return: JSON object @@ -4557,15 +6344,21 @@ def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) -> Opti "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model204_no_model_default_error400_valid_request() + + request = build_multiple_responses_get200_model204_no_model_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4585,8 +6378,13 @@ def get200_model204_no_model_default_error400_valid(self, **kwargs: Any) -> Opti return deserialized + + @distributed_trace - def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> JSONType: + def get200_model201_model_default_error200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -4606,15 +6404,21 @@ def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> JSONTyp "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model201_model_default_error200_valid_request() + + request = build_multiple_responses_get200_model201_model_default_error200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4639,8 +6443,13 @@ def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> JSONTyp return deserialized + + @distributed_trace - def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> JSONType: + def get200_model201_model_default_error201_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. :return: JSON object @@ -4660,15 +6469,21 @@ def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> JSONTyp "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model201_model_default_error201_valid_request() + + request = build_multiple_responses_get200_model201_model_default_error201_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4693,8 +6508,13 @@ def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> JSONTyp return deserialized + + @distributed_trace - def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> JSONType: + def get200_model201_model_default_error400_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object @@ -4714,15 +6534,21 @@ def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> JSONTyp "textStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model201_model_default_error400_valid_request() + + request = build_multiple_responses_get200_model201_model_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4747,8 +6573,13 @@ def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> JSONTyp return deserialized + + @distributed_trace - def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kwargs: Any) -> JSONType: + def get200_model_a201_model_c404_model_d_default_error200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -4771,15 +6602,21 @@ def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kwargs: "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error200_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4810,8 +6647,13 @@ def get200_model_a201_model_c404_model_d_default_error200_valid(self, **kwargs: return deserialized + + @distributed_trace - def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kwargs: Any) -> JSONType: + def get200_model_a201_model_c404_model_d_default_error201_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'httpCode': '201'}. :return: JSON object @@ -4834,15 +6676,21 @@ def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kwargs: "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error201_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error201_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4873,8 +6721,13 @@ def get200_model_a201_model_c404_model_d_default_error201_valid(self, **kwargs: return deserialized + + @distributed_trace - def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kwargs: Any) -> JSONType: + def get200_model_a201_model_c404_model_d_default_error404_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'httpStatusCode': '404'}. :return: JSON object @@ -4897,15 +6750,21 @@ def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kwargs: "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error404_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error404_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4936,8 +6795,13 @@ def get200_model_a201_model_c404_model_d_default_error404_valid(self, **kwargs: return deserialized + + @distributed_trace - def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kwargs: Any) -> JSONType: + def get200_model_a201_model_c404_model_d_default_error400_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: JSON object @@ -4960,15 +6824,21 @@ def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kwargs: "httpStatusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error400_valid_request() + + request = build_multiple_responses_get200_model_a201_model_c404_model_d_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -4999,23 +6869,34 @@ def get200_model_a201_model_c404_model_d_default_error400_valid(self, **kwargs: return deserialized + + @distributed_trace - def get202_none204_none_default_error202_none(self, **kwargs: Any) -> None: + def get202_none204_none_default_error202_none( + self, + **kwargs: Any + ) -> None: """Send a 202 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_error202_none_request() + + request = build_multiple_responses_get202_none204_none_default_error202_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5026,23 +6907,34 @@ def get202_none204_none_default_error202_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get202_none204_none_default_error204_none(self, **kwargs: Any) -> None: + def get202_none204_none_default_error204_none( + self, + **kwargs: Any + ) -> None: """Send a 204 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_error204_none_request() + + request = build_multiple_responses_get202_none204_none_default_error204_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5053,23 +6945,34 @@ def get202_none204_none_default_error204_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get202_none204_none_default_error400_valid(self, **kwargs: Any) -> None: + def get202_none204_none_default_error400_valid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_error400_valid_request() + + request = build_multiple_responses_get202_none204_none_default_error400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5080,23 +6983,34 @@ def get202_none204_none_default_error400_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get202_none204_none_default_none202_invalid(self, **kwargs: Any) -> None: + def get202_none204_none_default_none202_invalid( + self, + **kwargs: Any + ) -> None: """Send a 202 response with an unexpected payload {'property': 'value'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none202_invalid_request() + + request = build_multiple_responses_get202_none204_none_default_none202_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5107,23 +7021,34 @@ def get202_none204_none_default_none202_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get202_none204_none_default_none204_none(self, **kwargs: Any) -> None: + def get202_none204_none_default_none204_none( + self, + **kwargs: Any + ) -> None: """Send a 204 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none204_none_request() + + request = build_multiple_responses_get202_none204_none_default_none204_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5134,23 +7059,34 @@ def get202_none204_none_default_none204_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get202_none204_none_default_none400_none(self, **kwargs: Any) -> None: + def get202_none204_none_default_none400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none400_none_request() + + request = build_multiple_responses_get202_none204_none_default_none400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5161,23 +7097,34 @@ def get202_none204_none_default_none400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> None: + def get202_none204_none_default_none400_invalid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with an unexpected payload {'property': 'value'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get202_none204_none_default_none400_invalid_request() + + request = build_multiple_responses_get202_none204_none_default_none400_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5188,8 +7135,13 @@ def get202_none204_none_default_none400_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_default_model_a200_valid(self, **kwargs: Any) -> JSONType: + def get_default_model_a200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with valid payload: {'statusCode': '200'}. :return: JSON object @@ -5204,15 +7156,21 @@ def get_default_model_a200_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a200_valid_request() + + request = build_multiple_responses_get_default_model_a200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5230,8 +7188,13 @@ def get_default_model_a200_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_default_model_a200_none(self, **kwargs: Any) -> JSONType: + def get_default_model_a200_none( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with no payload. :return: JSON object @@ -5246,15 +7209,21 @@ def get_default_model_a200_none(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a200_none_request() + + request = build_multiple_responses_get_default_model_a200_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5272,23 +7241,34 @@ def get_default_model_a200_none(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_default_model_a400_valid(self, **kwargs: Any) -> None: + def get_default_model_a400_valid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'statusCode': '400'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a400_valid_request() + + request = build_multiple_responses_get_default_model_a400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5299,23 +7279,34 @@ def get_default_model_a400_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_default_model_a400_none(self, **kwargs: Any) -> None: + def get_default_model_a400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_model_a400_none_request() + + request = build_multiple_responses_get_default_model_a400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5326,23 +7317,34 @@ def get_default_model_a400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_default_none200_invalid(self, **kwargs: Any) -> None: + def get_default_none200_invalid( + self, + **kwargs: Any + ) -> None: """Send a 200 response with invalid payload: {'statusCode': '200'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none200_invalid_request() + + request = build_multiple_responses_get_default_none200_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5353,23 +7355,34 @@ def get_default_none200_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_default_none200_none(self, **kwargs: Any) -> None: + def get_default_none200_none( + self, + **kwargs: Any + ) -> None: """Send a 200 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none200_none_request() + + request = build_multiple_responses_get_default_none200_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5380,23 +7393,34 @@ def get_default_none200_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_default_none400_invalid(self, **kwargs: Any) -> None: + def get_default_none400_invalid( + self, + **kwargs: Any + ) -> None: """Send a 400 response with valid payload: {'statusCode': '400'}. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none400_invalid_request() + + request = build_multiple_responses_get_default_none400_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5407,23 +7431,34 @@ def get_default_none400_invalid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_default_none400_none(self, **kwargs: Any) -> None: + def get_default_none400_none( + self, + **kwargs: Any + ) -> None: """Send a 400 response with no payload. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get_default_none400_none_request() + + request = build_multiple_responses_get_default_none400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5434,8 +7469,13 @@ def get_default_none400_none(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get200_model_a200_none(self, **kwargs: Any) -> JSONType: + def get200_model_a200_none( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A. @@ -5451,15 +7491,21 @@ def get200_model_a200_none(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a200_none_request() + + request = build_multiple_responses_get200_model_a200_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5477,8 +7523,13 @@ def get200_model_a200_none(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get200_model_a200_valid(self, **kwargs: Any) -> JSONType: + def get200_model_a200_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with payload {'statusCode': '200'}. :return: JSON object @@ -5493,15 +7544,21 @@ def get200_model_a200_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a200_valid_request() + + request = build_multiple_responses_get200_model_a200_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5519,8 +7576,13 @@ def get200_model_a200_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get200_model_a200_invalid(self, **kwargs: Any) -> JSONType: + def get200_model_a200_invalid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. :return: JSON object @@ -5535,15 +7597,21 @@ def get200_model_a200_invalid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a200_invalid_request() + + request = build_multiple_responses_get200_model_a200_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5561,8 +7629,13 @@ def get200_model_a200_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get200_model_a400_none(self, **kwargs: Any) -> JSONType: + def get200_model_a400_none( + self, + **kwargs: Any + ) -> JSONType: """Send a 400 response with no payload client should treat as an http error with no error model. :return: JSON object @@ -5577,15 +7650,21 @@ def get200_model_a400_none(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a400_none_request() + + request = build_multiple_responses_get200_model_a400_none_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5603,8 +7682,13 @@ def get200_model_a400_none(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get200_model_a400_valid(self, **kwargs: Any) -> JSONType: + def get200_model_a400_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with payload {'statusCode': '400'}. :return: JSON object @@ -5619,15 +7703,21 @@ def get200_model_a400_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a400_valid_request() + + request = build_multiple_responses_get200_model_a400_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5645,8 +7735,13 @@ def get200_model_a400_valid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get200_model_a400_invalid(self, **kwargs: Any) -> JSONType: + def get200_model_a400_invalid( + self, + **kwargs: Any + ) -> JSONType: """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. :return: JSON object @@ -5661,15 +7756,21 @@ def get200_model_a400_invalid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a400_invalid_request() + + request = build_multiple_responses_get200_model_a400_invalid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5687,8 +7788,13 @@ def get200_model_a400_invalid(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get200_model_a202_valid(self, **kwargs: Any) -> JSONType: + def get200_model_a202_valid( + self, + **kwargs: Any + ) -> JSONType: """Send a 202 response with payload {'statusCode': '202'}. :return: JSON object @@ -5703,15 +7809,21 @@ def get200_model_a202_valid(self, **kwargs: Any) -> JSONType: "statusCode": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_multiple_responses_get200_model_a202_valid_request() + + request = build_multiple_responses_get200_model_a202_valid_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -5728,3 +7840,5 @@ def get200_model_a202_valid(self, **kwargs: Any) -> JSONType: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py index 69f380ec95e..af804916116 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/__init__.py index f4cc0652a6a..327d291fc6e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["IncorrectReturnedErrorModel"] +__all__ = ['IncorrectReturnedErrorModel'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_configuration.py index 848911b2ef4..23d9c22f926 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class IncorrectReturnedErrorModelConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(IncorrectReturnedErrorModelConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "incorrectreturnederrormodel/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'incorrectreturnederrormodel/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_incorrect_returned_error_model.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_incorrect_returned_error_model.py index 276e8e93f6c..69acb22e45b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_incorrect_returned_error_model.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_incorrect_returned_error_model.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class IncorrectReturnedErrorModel(IncorrectReturnedErrorModelOperationsMixin): """Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. @@ -29,8 +28,13 @@ class IncorrectReturnedErrorModel(IncorrectReturnedErrorModelOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = IncorrectReturnedErrorModelConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -38,6 +42,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/__init__.py index 01c46246fde..f205fe2e7ed 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import IncorrectReturnedErrorModelOperationsMixin __all__ = [ - "IncorrectReturnedErrorModelOperationsMixin", + 'IncorrectReturnedErrorModelOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py index 93e796ab86c..b2c897b7238 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py @@ -8,36 +8,37 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_incorrect_error_from_server_request(**kwargs: Any) -> HttpRequest: +def build_get_incorrect_error_from_server_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/incorrectError" - - return HttpRequest(method="GET", url=url, **kwargs) + url = '/incorrectError' + return HttpRequest( + method="GET", + url=url, + **kwargs + ) class IncorrectReturnedErrorModelOperationsMixin(object): + @distributed_trace - def get_incorrect_error_from_server(self, **kwargs: Any) -> None: + def get_incorrect_error_from_server( + self, + **kwargs: Any + ) -> None: """Get an error response from the server that is not as described in our Error object. Want to swallow the deserialization error and still return an HttpResponseError to the users. @@ -45,15 +46,21 @@ def get_incorrect_error_from_server(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_get_incorrect_error_from_server_request() + + request = build_get_incorrect_error_from_server_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -63,3 +70,5 @@ def get_incorrect_error_from_server(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/__init__.py index 2a4a1d94e74..13d865896d6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._incorrect_returned_error_model import IncorrectReturnedErrorModel - -__all__ = ["IncorrectReturnedErrorModel"] +__all__ = ['IncorrectReturnedErrorModel'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_configuration.py index 1b670d174d9..f1b3366ed98 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class IncorrectReturnedErrorModelConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(IncorrectReturnedErrorModelConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "incorrectreturnederrormodel/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'incorrectreturnederrormodel/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_incorrect_returned_error_model.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_incorrect_returned_error_model.py index 90ed0f3bc0f..ff743a23f73 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_incorrect_returned_error_model.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_incorrect_returned_error_model.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class IncorrectReturnedErrorModel(IncorrectReturnedErrorModelOperationsMixin): """Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. @@ -29,7 +28,12 @@ class IncorrectReturnedErrorModel(IncorrectReturnedErrorModelOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = IncorrectReturnedErrorModelConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,7 +41,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/__init__.py index 01c46246fde..f205fe2e7ed 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import IncorrectReturnedErrorModelOperationsMixin __all__ = [ - "IncorrectReturnedErrorModelOperationsMixin", + 'IncorrectReturnedErrorModelOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py index 5403edf38ad..941a5596959 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py @@ -8,27 +8,23 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ..._operations._operations import build_get_incorrect_error_from_server_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class IncorrectReturnedErrorModelOperationsMixin: + @distributed_trace_async - async def get_incorrect_error_from_server(self, **kwargs: Any) -> None: + async def get_incorrect_error_from_server( + self, + **kwargs: Any + ) -> None: """Get an error response from the server that is not as described in our Error object. Want to swallow the deserialization error and still return an HttpResponseError to the users. @@ -36,15 +32,21 @@ async def get_incorrect_error_from_server(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_incorrect_error_from_server_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_incorrect_error_from_server_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -54,3 +56,5 @@ async def get_incorrect_error_from_server(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py index 883660291b0..c15c8094059 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test to see when throwing an HttpResponseError whether we swallow error model deserialization errors. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/__init__.py index d92d78cce53..cf828cedf2d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MediaTypesClient"] +__all__ = ['MediaTypesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_configuration.py index 3628a4a853e..e16ea21bfda 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class MediaTypesClientConfiguration(Configuration): # pylint: disable=too-many- attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MediaTypesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mediatypesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mediatypesclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_media_types_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_media_types_client.py index 8b1405c2d42..0f1e56397ff 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_media_types_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_media_types_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MediaTypesClient(MediaTypesClientOperationsMixin): """Play with produces/consumes and media-types in general. @@ -28,8 +27,13 @@ class MediaTypesClient(MediaTypesClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = MediaTypesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/__init__.py index 2d732361559..7ecea138dcb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import MediaTypesClientOperationsMixin __all__ = [ - "MediaTypesClientOperationsMixin", + 'MediaTypesClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py index 62384f20b4f..fd75e2dcea6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py @@ -8,130 +8,190 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_analyze_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_analyze_body_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/mediatypes/analyze" + url = '/mediatypes/analyze' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_analyze_body_no_accept_header_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/mediatypes/analyzeNoAccept" + url = '/mediatypes/analyzeNoAccept' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_content_type_with_encoding_request(*, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_content_type_with_encoding_request( + *, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/mediatypes/contentTypeWithEncoding" + url = '/mediatypes/contentTypeWithEncoding' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_binary_body_with_two_content_types_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "text/plain" # Construct URL - url = "/mediatypes/binaryBodyTwoContentTypes" + url = '/mediatypes/binaryBodyTwoContentTypes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_binary_body_with_three_content_types_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "text/plain" # Construct URL - url = "/mediatypes/binaryBodyThreeContentTypes" + url = '/mediatypes/binaryBodyThreeContentTypes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_put_text_and_json_body_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_put_text_and_json_body_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "text/plain" # Construct URL - url = "/mediatypes/textAndJson" + url = '/mediatypes/textAndJson' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class MediaTypesClientOperationsMixin(object): + @distributed_trace - def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: Any) -> str: + def analyze_body( + self, + input: Optional[Union[IO, JSONType]] = None, + **kwargs: Any + ) -> str: """Analyze body, that could be different media types. :param input: Input parameter. @@ -151,18 +211,20 @@ def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: An "source": "str" # Optional. File source path. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: _json = input - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -178,7 +240,9 @@ def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -196,8 +260,14 @@ def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: An return deserialized + + @distributed_trace - def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: Any) -> None: + def analyze_body_no_accept_header( + self, + input: Optional[Union[IO, JSONType]] = None, + **kwargs: Any + ) -> None: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -218,18 +288,20 @@ def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType]] = N "source": "str" # Optional. File source path. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: _json = input - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -245,7 +317,9 @@ def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType]] = N request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -256,8 +330,14 @@ def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType]] = N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) -> str: + def content_type_with_encoding( + self, + input: Optional[str] = None, + **kwargs: Any + ) -> str: """Pass in contentType 'text/plain; charset=UTF-8' to pass test. Value for input does not matter. :param input: Input parameter. @@ -266,11 +346,13 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "text/plain; charset=UTF-8") # type: Optional[str] + content_type = kwargs.pop('content_type', "text/plain; charset=UTF-8") # type: Optional[str] _content = input @@ -281,7 +363,9 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -299,8 +383,14 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) return deserialized + + @distributed_trace - def binary_body_with_two_content_types(self, message: Union[IO, JSONType], **kwargs: Any) -> str: + def binary_body_with_two_content_types( + self, + message: Union[IO, JSONType], + **kwargs: Any + ) -> str: """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream. @@ -310,17 +400,19 @@ def binary_body_with_two_content_types(self, message: Union[IO, JSONType], **kwa :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["application/octet-stream"]: + elif content_type.split(";")[0] in ['application/octet-stream']: _content = message else: raise ValueError( @@ -336,7 +428,9 @@ def binary_body_with_two_content_types(self, message: Union[IO, JSONType], **kwa request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -354,8 +448,14 @@ def binary_body_with_two_content_types(self, message: Union[IO, JSONType], **kwa return deserialized + + @distributed_trace - def binary_body_with_three_content_types(self, message: Union[IO, str], **kwargs: Any) -> str: + def binary_body_with_three_content_types( + self, + message: Union[IO, str], + **kwargs: Any + ) -> str: """Binary body with three content types. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for 'application/octet-stream'. @@ -369,17 +469,19 @@ def binary_body_with_three_content_types(self, message: Union[IO, str], **kwargs :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: + elif content_type.split(";")[0] in ['application/octet-stream', 'text/plain']: _content = message else: raise ValueError( @@ -395,7 +497,9 @@ def binary_body_with_three_content_types(self, message: Union[IO, str], **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -413,8 +517,14 @@ def binary_body_with_three_content_types(self, message: Union[IO, str], **kwargs return deserialized + + @distributed_trace - def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str: + def put_text_and_json_body( + self, + message: Union[str, str], + **kwargs: Any + ) -> str: """Body that's either text/plain or application/json. :param message: The payload body. @@ -425,17 +535,19 @@ def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["text/plain"]: + elif content_type.split(";")[0] in ['text/plain']: _content = message else: raise ValueError( @@ -451,7 +563,9 @@ def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -468,3 +582,5 @@ def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/__init__.py index f0f38f71e24..647fe0041e3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._media_types_client import MediaTypesClient - -__all__ = ["MediaTypesClient"] +__all__ = ['MediaTypesClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_configuration.py index ac6169f2c7c..03eeae896ad 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class MediaTypesClientConfiguration(Configuration): # pylint: disable=too-many- attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MediaTypesClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mediatypesclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mediatypesclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_media_types_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_media_types_client.py index f3aff872010..2e9bb6372f4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_media_types_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_media_types_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MediaTypesClient(MediaTypesClientOperationsMixin): """Play with produces/consumes and media-types in general. @@ -28,7 +27,12 @@ class MediaTypesClient(MediaTypesClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MediaTypesClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/__init__.py index 2d732361559..7ecea138dcb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import MediaTypesClientOperationsMixin __all__ = [ - "MediaTypesClientOperationsMixin", + 'MediaTypesClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py index 9997f8664f6..8635ffdae2d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py @@ -8,35 +8,25 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ..._operations._operations import ( - build_analyze_body_no_accept_header_request, - build_analyze_body_request, - build_binary_body_with_three_content_types_request, - build_binary_body_with_two_content_types_request, - build_content_type_with_encoding_request, - build_put_text_and_json_body_request, -) - -T = TypeVar("T") +from ..._operations._operations import build_analyze_body_no_accept_header_request, build_analyze_body_request, build_binary_body_with_three_content_types_request, build_binary_body_with_two_content_types_request, build_content_type_with_encoding_request, build_put_text_and_json_body_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class MediaTypesClientOperationsMixin: + @distributed_trace_async - async def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: Any) -> str: + async def analyze_body( + self, + input: Optional[Union[IO, JSONType]] = None, + **kwargs: Any + ) -> str: """Analyze body, that could be different media types. :param input: Input parameter. @@ -56,18 +46,20 @@ async def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwar "source": "str" # Optional. File source path. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: _json = input - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -83,7 +75,9 @@ async def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -101,8 +95,14 @@ async def analyze_body(self, input: Optional[Union[IO, JSONType]] = None, **kwar return deserialized + + @distributed_trace_async - async def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType]] = None, **kwargs: Any) -> None: + async def analyze_body_no_accept_header( + self, + input: Optional[Union[IO, JSONType]] = None, + **kwargs: Any + ) -> None: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -123,18 +123,20 @@ async def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType "source": "str" # Optional. File source path. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: if input is not None: _json = input - elif content_type.split(";")[0] in ["application/pdf", "image/jpeg", "image/png", "image/tiff"]: + elif content_type.split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: _content = input else: raise ValueError( @@ -150,7 +152,9 @@ async def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -161,8 +165,14 @@ async def analyze_body_no_accept_header(self, input: Optional[Union[IO, JSONType if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) -> str: + async def content_type_with_encoding( + self, + input: Optional[str] = None, + **kwargs: Any + ) -> str: """Pass in contentType 'text/plain; charset=UTF-8' to pass test. Value for input does not matter. :param input: Input parameter. @@ -171,11 +181,13 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "text/plain; charset=UTF-8") # type: Optional[str] + content_type = kwargs.pop('content_type', "text/plain; charset=UTF-8") # type: Optional[str] _content = input @@ -186,7 +198,9 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -204,8 +218,14 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs return deserialized + + @distributed_trace_async - async def binary_body_with_two_content_types(self, message: Union[IO, JSONType], **kwargs: Any) -> str: + async def binary_body_with_two_content_types( + self, + message: Union[IO, JSONType], + **kwargs: Any + ) -> str: """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream. @@ -215,17 +235,19 @@ async def binary_body_with_two_content_types(self, message: Union[IO, JSONType], :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["application/octet-stream"]: + elif content_type.split(";")[0] in ['application/octet-stream']: _content = message else: raise ValueError( @@ -241,7 +263,9 @@ async def binary_body_with_two_content_types(self, message: Union[IO, JSONType], request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -259,8 +283,14 @@ async def binary_body_with_two_content_types(self, message: Union[IO, JSONType], return deserialized + + @distributed_trace_async - async def binary_body_with_three_content_types(self, message: Union[IO, str], **kwargs: Any) -> str: + async def binary_body_with_three_content_types( + self, + message: Union[IO, str], + **kwargs: Any + ) -> str: """Binary body with three content types. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for 'application/octet-stream'. @@ -274,17 +304,19 @@ async def binary_body_with_three_content_types(self, message: Union[IO, str], ** :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["application/octet-stream", "text/plain"]: + elif content_type.split(";")[0] in ['application/octet-stream', 'text/plain']: _content = message else: raise ValueError( @@ -300,7 +332,9 @@ async def binary_body_with_three_content_types(self, message: Union[IO, str], ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -318,8 +352,14 @@ async def binary_body_with_three_content_types(self, message: Union[IO, str], ** return deserialized + + @distributed_trace_async - async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) -> str: + async def put_text_and_json_body( + self, + message: Union[str, str], + **kwargs: Any + ) -> str: """Body that's either text/plain or application/json. :param message: The payload body. @@ -330,17 +370,19 @@ async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = None _content = None - if content_type.split(";")[0] in ["application/json"]: + if content_type.split(";")[0] in ['application/json']: _json = message - elif content_type.split(";")[0] in ["text/plain"]: + elif content_type.split(";")[0] in ['text/plain']: _content = message else: raise ValueError( @@ -356,7 +398,9 @@ async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -373,3 +417,5 @@ async def put_text_and_json_body(self, message: Union[str, str], **kwargs: Any) return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py index 5c8489e8153..ca942bf04fb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Play with produces/consumes and media-types in general. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/__init__.py index 3195481e948..abe8ddc2864 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MergePatchJsonClient"] +__all__ = ['MergePatchJsonClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_configuration.py index 561421f9619..03b1420e448 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class MergePatchJsonClientConfiguration(Configuration): # pylint: disable=too-m attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MergePatchJsonClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mergepatchjsonclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mergepatchjsonclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_merge_patch_json_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_merge_patch_json_client.py index 2267cffa681..989f5a05175 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_merge_patch_json_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_merge_patch_json_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): """Service client for testing merge patch json. @@ -28,8 +27,13 @@ class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = MergePatchJsonClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/__init__.py index 615967b37a3..dd355e2f0d6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import MergePatchJsonClientOperationsMixin __all__ = [ - "MergePatchJsonClientOperationsMixin", + 'MergePatchJsonClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py index 3af5b327d8f..054992b7e75 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py @@ -8,46 +8,54 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_patch_single_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_patch_single_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/mergePatchJson/single" + url = '/mergePatchJson/single' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class MergePatchJsonClientOperationsMixin(object): + @distributed_trace - def patch_single(self, body: Any, **kwargs: Any) -> None: + def patch_single( + self, + body: Any, + **kwargs: Any + ) -> None: """Basic patch with an object. :param body: Pass in {'foo': 'bar'} for a 200, anything else for an object error. @@ -56,11 +64,13 @@ def patch_single(self, body: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/merge-patch+json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/merge-patch+json") # type: Optional[str] _json = body @@ -71,7 +81,9 @@ def patch_single(self, body: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -81,3 +93,5 @@ def patch_single(self, body: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/__init__.py index 350a9ddb952..bd5eb1ce33d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._merge_patch_json_client import MergePatchJsonClient - -__all__ = ["MergePatchJsonClient"] +__all__ = ['MergePatchJsonClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_configuration.py index 2b49cb02c75..b163ea72dd7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class MergePatchJsonClientConfiguration(Configuration): # pylint: disable=too-m attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MergePatchJsonClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "mergepatchjsonclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'mergepatchjsonclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_merge_patch_json_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_merge_patch_json_client.py index 1bcf8da4594..60c1051ac81 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_merge_patch_json_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_merge_patch_json_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): """Service client for testing merge patch json. @@ -28,7 +27,12 @@ class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MergePatchJsonClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/__init__.py index 615967b37a3..dd355e2f0d6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import MergePatchJsonClientOperationsMixin __all__ = [ - "MergePatchJsonClientOperationsMixin", + 'MergePatchJsonClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py index 97b0947c51f..aec2775e74b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py @@ -8,28 +8,25 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ..._operations._operations import build_patch_single_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class MergePatchJsonClientOperationsMixin: + @distributed_trace_async - async def patch_single(self, body: Any, **kwargs: Any) -> None: + async def patch_single( + self, + body: Any, + **kwargs: Any + ) -> None: """Basic patch with an object. :param body: Pass in {'foo': 'bar'} for a 200, anything else for an object error. @@ -38,11 +35,13 @@ async def patch_single(self, body: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/merge-patch+json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/merge-patch+json") # type: Optional[str] _json = body @@ -53,7 +52,9 @@ async def patch_single(self, body: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -63,3 +64,5 @@ async def patch_single(self, body: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py index 4b34ab99a32..01a8c8d1749 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing merge patch json. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/__init__.py index 52cd05a592d..dd34ba75521 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestResourceFlatteningTestService"] +__all__ = ['AutoRestResourceFlatteningTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_auto_rest_resource_flattening_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_auto_rest_resource_flattening_test_service.py index dc84fc4612a..144634743ad 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_auto_rest_resource_flattening_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_auto_rest_resource_flattening_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestResourceFlatteningTestService(AutoRestResourceFlatteningTestServiceOperationsMixin): """Resource Flattening for AutoRest. @@ -28,8 +27,13 @@ class AutoRestResourceFlatteningTestService(AutoRestResourceFlatteningTestServic :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestResourceFlatteningTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_configuration.py index 7244a93c346..f8a79cfd7d8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): # pyli attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestResourceFlatteningTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestresourceflatteningtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestresourceflatteningtestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/__init__.py index 8497fd3a334..a71d05dcc99 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestResourceFlatteningTestServiceOperationsMixin __all__ = [ - "AutoRestResourceFlatteningTestServiceOperationsMixin", + 'AutoRestResourceFlatteningTestServiceOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py index 067f187c78c..7c98fd2e5f9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,171 +16,271 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_put_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_array_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/array" + url = '/model-flatten/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_array_request(**kwargs: Any) -> HttpRequest: +def build_get_array_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/array" + url = '/model-flatten/array' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_wrapped_array_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_wrapped_array_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/wrappedarray" + url = '/model-flatten/wrappedarray' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_wrapped_array_request(**kwargs: Any) -> HttpRequest: +def build_get_wrapped_array_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/wrappedarray" + url = '/model-flatten/wrappedarray' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_dictionary_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_dictionary_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/dictionary" + url = '/model-flatten/dictionary' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_dictionary_request(**kwargs: Any) -> HttpRequest: +def build_get_dictionary_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/dictionary" + url = '/model-flatten/dictionary' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_resource_collection_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_resource_collection_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/resourcecollection" + url = '/model-flatten/resourcecollection' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: +def build_get_resource_collection_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/model-flatten/resourcecollection" + url = '/model-flatten/resourcecollection' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_simple_product_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_simple_product_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/customFlattening" + url = '/model-flatten/customFlattening' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_post_flattened_simple_product_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/customFlattening" + url = '/model-flatten/customFlattening' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_put_simple_product_with_grouping_request( - name: str, *, json: JSONType = None, content: Any = None, **kwargs: Any + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/model-flatten/customFlattening/parametergrouping/{name}/" + url = '/model-flatten/customFlattening/parametergrouping/{name}/' path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), + "name": _SERIALIZER.url("name", name, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -194,15 +288,26 @@ def build_put_simple_product_with_grouping_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AutoRestResourceFlatteningTestServiceOperationsMixin(object): + @distributed_trace - def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: Any) -> None: + def put_array( + self, + resource_array: Optional[List[JSONType]] = None, + **kwargs: Any + ) -> None: """Put External Resource as an Array. :param resource_array: External Resource as an Array to put. @@ -228,11 +333,13 @@ def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: A } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: _json = resource_array @@ -246,7 +353,9 @@ def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: A request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -257,8 +366,13 @@ def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_array(self, **kwargs: Any) -> List[JSONType]: + def get_array( + self, + **kwargs: Any + ) -> List[JSONType]: """Get External Resource as an Array. :return: list of JSON object @@ -291,15 +405,21 @@ def get_array(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_array_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_array_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -317,8 +437,14 @@ def get_array(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: Any) -> None: + def put_wrapped_array( + self, + resource_array: Optional[List[JSONType]] = None, + **kwargs: Any + ) -> None: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -338,11 +464,13 @@ def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = None, **k } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: _json = resource_array @@ -356,7 +484,9 @@ def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = None, **k request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -367,8 +497,13 @@ def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = None, **k if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_wrapped_array(self, **kwargs: Any) -> List[JSONType]: + def get_wrapped_array( + self, + **kwargs: Any + ) -> List[JSONType]: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -388,15 +523,21 @@ def get_wrapped_array(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_wrapped_array_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_wrapped_array_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -414,8 +555,14 @@ def get_wrapped_array(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType]] = None, **kwargs: Any) -> None: + def put_dictionary( + self, + resource_dictionary: Optional[Dict[str, JSONType]] = None, + **kwargs: Any + ) -> None: """Put External Resource as a Dictionary. :param resource_dictionary: External Resource as a Dictionary to put. @@ -450,11 +597,13 @@ def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType]] = No } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_dictionary is not None: _json = resource_dictionary @@ -468,7 +617,9 @@ def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType]] = No request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -479,8 +630,13 @@ def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType]] = No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_dictionary(self, **kwargs: Any) -> Dict[str, JSONType]: + def get_dictionary( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get External Resource as a Dictionary. :return: dict mapping str to JSON object @@ -513,15 +669,21 @@ def get_dictionary(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_dictionary_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dictionary_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -539,8 +701,14 @@ def get_dictionary(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace - def put_resource_collection(self, resource_complex_object: JSONType = None, **kwargs: Any) -> None: + def put_resource_collection( + self, + resource_complex_object: JSONType = None, + **kwargs: Any + ) -> None: """Put External Resource as a ResourceCollection. :param resource_complex_object: External Resource as a ResourceCollection to put. @@ -620,11 +788,13 @@ def put_resource_collection(self, resource_complex_object: JSONType = None, **kw } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_complex_object is not None: _json = resource_complex_object @@ -638,7 +808,9 @@ def put_resource_collection(self, resource_complex_object: JSONType = None, **kw request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -649,8 +821,13 @@ def put_resource_collection(self, resource_complex_object: JSONType = None, **kw if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_resource_collection(self, **kwargs: Any) -> JSONType: + def get_resource_collection( + self, + **kwargs: Any + ) -> JSONType: """Get External Resource as a ResourceCollection. :return: JSON object @@ -728,15 +905,21 @@ def get_resource_collection(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_resource_collection_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_resource_collection_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -754,8 +937,14 @@ def get_resource_collection(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any) -> JSONType: + def put_simple_product( + self, + simple_body_product: JSONType = None, + **kwargs: Any + ) -> JSONType: """Put Simple Product with client flattening true on the model. :param simple_body_product: Simple body product to put. @@ -803,11 +992,13 @@ def put_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: _json = simple_body_product @@ -821,7 +1012,9 @@ def put_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -839,8 +1032,14 @@ def put_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any return deserialized + + @distributed_trace - def post_flattened_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any) -> JSONType: + def post_flattened_simple_product( + self, + simple_body_product: JSONType = None, + **kwargs: Any + ) -> JSONType: """Put Flattened Simple Product with client flattening true on the parameter. :param simple_body_product: Simple body product to post. @@ -888,11 +1087,13 @@ def post_flattened_simple_product(self, simple_body_product: JSONType = None, ** } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: _json = simple_body_product @@ -906,7 +1107,9 @@ def post_flattened_simple_product(self, simple_body_product: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -924,9 +1127,14 @@ def post_flattened_simple_product(self, simple_body_product: JSONType = None, ** return deserialized + + @distributed_trace def put_simple_product_with_grouping( - self, name: str, simple_body_product: JSONType = None, **kwargs: Any + self, + name: str, + simple_body_product: JSONType = None, + **kwargs: Any ) -> JSONType: """Put Simple Product with client flattening true on the model. @@ -977,11 +1185,13 @@ def put_simple_product_with_grouping( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: _json = simple_body_product @@ -996,7 +1206,9 @@ def put_simple_product_with_grouping( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1013,3 +1225,5 @@ def put_simple_product_with_grouping( return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/__init__.py index 0063e0ded58..86f206c8bec 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_resource_flattening_test_service import AutoRestResourceFlatteningTestService - -__all__ = ["AutoRestResourceFlatteningTestService"] +__all__ = ['AutoRestResourceFlatteningTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_auto_rest_resource_flattening_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_auto_rest_resource_flattening_test_service.py index a6934ca254c..a24e3f2486d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_auto_rest_resource_flattening_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_auto_rest_resource_flattening_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestResourceFlatteningTestService(AutoRestResourceFlatteningTestServiceOperationsMixin): """Resource Flattening for AutoRest. @@ -28,7 +27,12 @@ class AutoRestResourceFlatteningTestService(AutoRestResourceFlatteningTestServic :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestResourceFlatteningTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_configuration.py index 73c510afe25..dc0f961acfb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestResourceFlatteningTestServiceConfiguration(Configuration): # pyli attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestResourceFlatteningTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestresourceflatteningtestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestresourceflatteningtestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/__init__.py index 8497fd3a334..a71d05dcc99 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestResourceFlatteningTestServiceOperationsMixin __all__ = [ - "AutoRestResourceFlatteningTestServiceOperationsMixin", + 'AutoRestResourceFlatteningTestServiceOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py index 448059a85ff..9916b29d343 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py @@ -8,40 +8,25 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ..._operations._operations import ( - build_get_array_request, - build_get_dictionary_request, - build_get_resource_collection_request, - build_get_wrapped_array_request, - build_post_flattened_simple_product_request, - build_put_array_request, - build_put_dictionary_request, - build_put_resource_collection_request, - build_put_simple_product_request, - build_put_simple_product_with_grouping_request, - build_put_wrapped_array_request, -) - -T = TypeVar("T") +from ..._operations._operations import build_get_array_request, build_get_dictionary_request, build_get_resource_collection_request, build_get_wrapped_array_request, build_post_flattened_simple_product_request, build_put_array_request, build_put_dictionary_request, build_put_resource_collection_request, build_put_simple_product_request, build_put_simple_product_with_grouping_request, build_put_wrapped_array_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestResourceFlatteningTestServiceOperationsMixin: + @distributed_trace_async - async def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: Any) -> None: + async def put_array( + self, + resource_array: Optional[List[JSONType]] = None, + **kwargs: Any + ) -> None: """Put External Resource as an Array. :param resource_array: External Resource as an Array to put. @@ -67,11 +52,13 @@ async def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwa } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: _json = resource_array @@ -85,7 +72,9 @@ async def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwa request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -96,8 +85,13 @@ async def put_array(self, resource_array: Optional[List[JSONType]] = None, **kwa if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_array(self, **kwargs: Any) -> List[JSONType]: + async def get_array( + self, + **kwargs: Any + ) -> List[JSONType]: """Get External Resource as an Array. :return: list of JSON object @@ -130,15 +124,21 @@ async def get_array(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_array_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_array_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -156,8 +156,14 @@ async def get_array(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = None, **kwargs: Any) -> None: + async def put_wrapped_array( + self, + resource_array: Optional[List[JSONType]] = None, + **kwargs: Any + ) -> None: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -177,11 +183,13 @@ async def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = Non } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_array is not None: _json = resource_array @@ -195,7 +203,9 @@ async def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = Non request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -206,8 +216,13 @@ async def put_wrapped_array(self, resource_array: Optional[List[JSONType]] = Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_wrapped_array(self, **kwargs: Any) -> List[JSONType]: + async def get_wrapped_array( + self, + **kwargs: Any + ) -> List[JSONType]: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -227,15 +242,21 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_wrapped_array_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_wrapped_array_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -253,8 +274,14 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType]] = None, **kwargs: Any) -> None: + async def put_dictionary( + self, + resource_dictionary: Optional[Dict[str, JSONType]] = None, + **kwargs: Any + ) -> None: """Put External Resource as a Dictionary. :param resource_dictionary: External Resource as a Dictionary to put. @@ -289,11 +316,13 @@ async def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType] } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_dictionary is not None: _json = resource_dictionary @@ -307,7 +336,9 @@ async def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType] request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -318,8 +349,13 @@ async def put_dictionary(self, resource_dictionary: Optional[Dict[str, JSONType] if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_dictionary(self, **kwargs: Any) -> Dict[str, JSONType]: + async def get_dictionary( + self, + **kwargs: Any + ) -> Dict[str, JSONType]: """Get External Resource as a Dictionary. :return: dict mapping str to JSON object @@ -352,15 +388,21 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, JSONType]: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_dictionary_request() + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dictionary_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -378,8 +420,14 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, JSONType]: return deserialized + + @distributed_trace_async - async def put_resource_collection(self, resource_complex_object: JSONType = None, **kwargs: Any) -> None: + async def put_resource_collection( + self, + resource_complex_object: JSONType = None, + **kwargs: Any + ) -> None: """Put External Resource as a ResourceCollection. :param resource_complex_object: External Resource as a ResourceCollection to put. @@ -459,11 +507,13 @@ async def put_resource_collection(self, resource_complex_object: JSONType = None } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if resource_complex_object is not None: _json = resource_complex_object @@ -477,7 +527,9 @@ async def put_resource_collection(self, resource_complex_object: JSONType = None request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -488,8 +540,13 @@ async def put_resource_collection(self, resource_complex_object: JSONType = None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_resource_collection(self, **kwargs: Any) -> JSONType: + async def get_resource_collection( + self, + **kwargs: Any + ) -> JSONType: """Get External Resource as a ResourceCollection. :return: JSON object @@ -567,15 +624,21 @@ async def get_resource_collection(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_resource_collection_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_resource_collection_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -593,8 +656,14 @@ async def get_resource_collection(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any) -> JSONType: + async def put_simple_product( + self, + simple_body_product: JSONType = None, + **kwargs: Any + ) -> JSONType: """Put Simple Product with client flattening true on the model. :param simple_body_product: Simple body product to put. @@ -642,11 +711,13 @@ async def put_simple_product(self, simple_body_product: JSONType = None, **kwarg } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: _json = simple_body_product @@ -660,7 +731,9 @@ async def put_simple_product(self, simple_body_product: JSONType = None, **kwarg request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -678,8 +751,14 @@ async def put_simple_product(self, simple_body_product: JSONType = None, **kwarg return deserialized + + @distributed_trace_async - async def post_flattened_simple_product(self, simple_body_product: JSONType = None, **kwargs: Any) -> JSONType: + async def post_flattened_simple_product( + self, + simple_body_product: JSONType = None, + **kwargs: Any + ) -> JSONType: """Put Flattened Simple Product with client flattening true on the parameter. :param simple_body_product: Simple body product to post. @@ -727,11 +806,13 @@ async def post_flattened_simple_product(self, simple_body_product: JSONType = No } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: _json = simple_body_product @@ -745,7 +826,9 @@ async def post_flattened_simple_product(self, simple_body_product: JSONType = No request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -763,9 +846,14 @@ async def post_flattened_simple_product(self, simple_body_product: JSONType = No return deserialized + + @distributed_trace_async async def put_simple_product_with_grouping( - self, name: str, simple_body_product: JSONType = None, **kwargs: Any + self, + name: str, + simple_body_product: JSONType = None, + **kwargs: Any ) -> JSONType: """Put Simple Product with client flattening true on the model. @@ -816,11 +904,13 @@ async def put_simple_product_with_grouping( } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if simple_body_product is not None: _json = simple_body_product @@ -835,7 +925,9 @@ async def put_simple_product_with_grouping( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -852,3 +944,5 @@ async def put_simple_product_with_grouping( return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py index 8d1edff1db1..39383fce365 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Resource Flattening for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/__init__.py index 38868bb00ab..41f59902549 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["MultipleInheritanceServiceClient"] +__all__ = ['MultipleInheritanceServiceClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_configuration.py index 9cce3269685..3f7be9fee2d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class MultipleInheritanceServiceClientConfiguration(Configuration): # pylint: d attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "multipleinheritanceserviceclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_multiple_inheritance_service_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_multiple_inheritance_service_client.py index f174adffc1d..78c4667096a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_multiple_inheritance_service_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_multiple_inheritance_service_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperationsMixin): """Service client for multiinheritance client testing. @@ -28,8 +27,13 @@ class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperation :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/__init__.py index bc5f6b4436c..c1a91760edb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import MultipleInheritanceServiceClientOperationsMixin __all__ = [ - "MultipleInheritanceServiceClientOperationsMixin", + 'MultipleInheritanceServiceClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py index 3edfce91cf2..c8f148a57f0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py @@ -8,170 +8,260 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_horse_request(**kwargs: Any) -> HttpRequest: +def build_get_horse_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/horse" + url = '/multipleInheritance/horse' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_horse_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_horse_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/horse" + url = '/multipleInheritance/horse' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_pet_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_pet_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/pet" + url = '/multipleInheritance/pet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_pet_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_pet_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/pet" + url = '/multipleInheritance/pet' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_feline_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_feline_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/feline" + url = '/multipleInheritance/feline' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_feline_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_feline_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/feline" + url = '/multipleInheritance/feline' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_cat_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_cat_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/cat" + url = '/multipleInheritance/cat' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_cat_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_cat_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/cat" + url = '/multipleInheritance/cat' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_get_kitten_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_kitten_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/multipleInheritance/kitten" + url = '/multipleInheritance/kitten' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_kitten_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_kitten_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/multipleInheritance/kitten" + url = '/multipleInheritance/kitten' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class MultipleInheritanceServiceClientOperationsMixin(object): + @distributed_trace - def get_horse(self, **kwargs: Any) -> JSONType: + def get_horse( + self, + **kwargs: Any + ) -> JSONType: """Get a horse with name 'Fred' and isAShowHorse true. :return: JSON object @@ -187,15 +277,21 @@ def get_horse(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_horse_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_horse_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -213,8 +309,14 @@ def get_horse(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_horse(self, horse: JSONType, **kwargs: Any) -> str: + def put_horse( + self, + horse: JSONType, + **kwargs: Any + ) -> str: """Put a horse with name 'General' and isAShowHorse false. :param horse: Put a horse with name 'General' and isAShowHorse false. @@ -232,11 +334,13 @@ def put_horse(self, horse: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = horse @@ -247,7 +351,9 @@ def put_horse(self, horse: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -265,8 +371,13 @@ def put_horse(self, horse: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def get_pet(self, **kwargs: Any) -> JSONType: + def get_pet( + self, + **kwargs: Any + ) -> JSONType: """Get a pet with name 'Peanut'. :return: JSON object @@ -281,15 +392,21 @@ def get_pet(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_pet_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_pet_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -307,8 +424,14 @@ def get_pet(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_pet(self, pet: JSONType, **kwargs: Any) -> str: + def put_pet( + self, + pet: JSONType, + **kwargs: Any + ) -> str: """Put a pet with name 'Butter'. :param pet: Put a pet with name 'Butter'. @@ -325,11 +448,13 @@ def put_pet(self, pet: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = pet @@ -340,7 +465,9 @@ def put_pet(self, pet: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -358,8 +485,13 @@ def put_pet(self, pet: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def get_feline(self, **kwargs: Any) -> JSONType: + def get_feline( + self, + **kwargs: Any + ) -> JSONType: """Get a feline where meows and hisses are true. :return: JSON object @@ -375,15 +507,21 @@ def get_feline(self, **kwargs: Any) -> JSONType: "meows": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_feline_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_feline_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -401,8 +539,14 @@ def get_feline(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_feline(self, feline: JSONType, **kwargs: Any) -> str: + def put_feline( + self, + feline: JSONType, + **kwargs: Any + ) -> str: """Put a feline who hisses and doesn't meow. :param feline: Put a feline who hisses and doesn't meow. @@ -420,11 +564,13 @@ def put_feline(self, feline: JSONType, **kwargs: Any) -> str: "meows": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = feline @@ -435,7 +581,9 @@ def put_feline(self, feline: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -453,8 +601,13 @@ def put_feline(self, feline: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def get_cat(self, **kwargs: Any) -> JSONType: + def get_cat( + self, + **kwargs: Any + ) -> JSONType: """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. :return: JSON object @@ -472,15 +625,21 @@ def get_cat(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_cat_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_cat_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -498,8 +657,14 @@ def get_cat(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_cat(self, cat: JSONType, **kwargs: Any) -> str: + def put_cat( + self, + cat: JSONType, + **kwargs: Any + ) -> str: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. :param cat: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. @@ -519,11 +684,13 @@ def put_cat(self, cat: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = cat @@ -534,7 +701,9 @@ def put_cat(self, cat: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -552,8 +721,13 @@ def put_cat(self, cat: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def get_kitten(self, **kwargs: Any) -> JSONType: + def get_kitten( + self, + **kwargs: Any + ) -> JSONType: """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet is false. @@ -573,15 +747,21 @@ def get_kitten(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_kitten_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_kitten_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -599,8 +779,14 @@ def get_kitten(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: + def put_kitten( + self, + kitten: JSONType, + **kwargs: Any + ) -> str: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -623,11 +809,13 @@ def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = kitten @@ -638,7 +826,9 @@ def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -655,3 +845,5 @@ def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/__init__.py index c1cb6dab943..5f66ffeb27e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._multiple_inheritance_service_client import MultipleInheritanceServiceClient - -__all__ = ["MultipleInheritanceServiceClient"] +__all__ = ['MultipleInheritanceServiceClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_configuration.py index 8e8d260c441..1e4b897da2a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class MultipleInheritanceServiceClientConfiguration(Configuration): # pylint: d attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "multipleinheritanceserviceclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_multiple_inheritance_service_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_multiple_inheritance_service_client.py index e9a933ede89..b5fe9980e42 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_multiple_inheritance_service_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_multiple_inheritance_service_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperationsMixin): """Service client for multiinheritance client testing. @@ -28,7 +27,12 @@ class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperation :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/__init__.py index bc5f6b4436c..c1a91760edb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import MultipleInheritanceServiceClientOperationsMixin __all__ = [ - "MultipleInheritanceServiceClientOperationsMixin", + 'MultipleInheritanceServiceClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py index 7e919d88ecc..65dcec480c9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py @@ -8,39 +8,24 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ..._operations._operations import ( - build_get_cat_request, - build_get_feline_request, - build_get_horse_request, - build_get_kitten_request, - build_get_pet_request, - build_put_cat_request, - build_put_feline_request, - build_put_horse_request, - build_put_kitten_request, - build_put_pet_request, -) - -T = TypeVar("T") +from ..._operations._operations import build_get_cat_request, build_get_feline_request, build_get_horse_request, build_get_kitten_request, build_get_pet_request, build_put_cat_request, build_put_feline_request, build_put_horse_request, build_put_kitten_request, build_put_pet_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class MultipleInheritanceServiceClientOperationsMixin: + @distributed_trace_async - async def get_horse(self, **kwargs: Any) -> JSONType: + async def get_horse( + self, + **kwargs: Any + ) -> JSONType: """Get a horse with name 'Fred' and isAShowHorse true. :return: JSON object @@ -56,15 +41,21 @@ async def get_horse(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_horse_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_horse_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -82,8 +73,14 @@ async def get_horse(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_horse(self, horse: JSONType, **kwargs: Any) -> str: + async def put_horse( + self, + horse: JSONType, + **kwargs: Any + ) -> str: """Put a horse with name 'General' and isAShowHorse false. :param horse: Put a horse with name 'General' and isAShowHorse false. @@ -101,11 +98,13 @@ async def put_horse(self, horse: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = horse @@ -116,7 +115,9 @@ async def put_horse(self, horse: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -134,8 +135,13 @@ async def put_horse(self, horse: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def get_pet(self, **kwargs: Any) -> JSONType: + async def get_pet( + self, + **kwargs: Any + ) -> JSONType: """Get a pet with name 'Peanut'. :return: JSON object @@ -150,15 +156,21 @@ async def get_pet(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_pet_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_pet_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -176,8 +188,14 @@ async def get_pet(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_pet(self, pet: JSONType, **kwargs: Any) -> str: + async def put_pet( + self, + pet: JSONType, + **kwargs: Any + ) -> str: """Put a pet with name 'Butter'. :param pet: Put a pet with name 'Butter'. @@ -194,11 +212,13 @@ async def put_pet(self, pet: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = pet @@ -209,7 +229,9 @@ async def put_pet(self, pet: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -227,8 +249,13 @@ async def put_pet(self, pet: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def get_feline(self, **kwargs: Any) -> JSONType: + async def get_feline( + self, + **kwargs: Any + ) -> JSONType: """Get a feline where meows and hisses are true. :return: JSON object @@ -244,15 +271,21 @@ async def get_feline(self, **kwargs: Any) -> JSONType: "meows": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_feline_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_feline_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -270,8 +303,14 @@ async def get_feline(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_feline(self, feline: JSONType, **kwargs: Any) -> str: + async def put_feline( + self, + feline: JSONType, + **kwargs: Any + ) -> str: """Put a feline who hisses and doesn't meow. :param feline: Put a feline who hisses and doesn't meow. @@ -289,11 +328,13 @@ async def put_feline(self, feline: JSONType, **kwargs: Any) -> str: "meows": bool # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = feline @@ -304,7 +345,9 @@ async def put_feline(self, feline: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -322,8 +365,13 @@ async def put_feline(self, feline: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def get_cat(self, **kwargs: Any) -> JSONType: + async def get_cat( + self, + **kwargs: Any + ) -> JSONType: """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. :return: JSON object @@ -341,15 +389,21 @@ async def get_cat(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_cat_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_cat_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -367,8 +421,14 @@ async def get_cat(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_cat(self, cat: JSONType, **kwargs: Any) -> str: + async def put_cat( + self, + cat: JSONType, + **kwargs: Any + ) -> str: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. :param cat: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. @@ -388,11 +448,13 @@ async def put_cat(self, cat: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = cat @@ -403,7 +465,9 @@ async def put_cat(self, cat: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -421,8 +485,13 @@ async def put_cat(self, cat: JSONType, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def get_kitten(self, **kwargs: Any) -> JSONType: + async def get_kitten( + self, + **kwargs: Any + ) -> JSONType: """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet is false. @@ -442,15 +511,21 @@ async def get_kitten(self, **kwargs: Any) -> JSONType: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_kitten_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_kitten_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -468,8 +543,14 @@ async def get_kitten(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: + async def put_kitten( + self, + kitten: JSONType, + **kwargs: Any + ) -> str: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -492,11 +573,13 @@ async def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: "name": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = kitten @@ -507,7 +590,9 @@ async def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -524,3 +609,5 @@ async def put_kitten(self, kitten: JSONType, **kwargs: Any) -> str: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py index 5d90113dd65..cfdb6a2a981 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for multiinheritance client testing. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/__init__.py index d55ccad1f57..5960c353a89 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore \ No newline at end of file diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py index 66ffc7560f0..e89f95f6531 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client with no operations. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/__init__.py index 0d39634a248..339a2c819ef 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["NonStringEnumsClient"] +__all__ = ['NonStringEnumsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_configuration.py index ee742dc5863..e66fec6105e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class NonStringEnumsClientConfiguration(Configuration): # pylint: disable=too-m attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(NonStringEnumsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "nonstringenumsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'nonstringenumsclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_non_string_enums_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_non_string_enums_client.py index 2321e40334a..1c3d28c8183 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_non_string_enums_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_non_string_enums_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class NonStringEnumsClient: """Testing non-string enums. @@ -32,8 +31,13 @@ class NonStringEnumsClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = NonStringEnumsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -43,6 +47,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) self.float = FloatOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/__init__.py index affc03b809b..32ad006d576 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._non_string_enums_client import NonStringEnumsClient - -__all__ = ["NonStringEnumsClient"] +__all__ = ['NonStringEnumsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_configuration.py index 148880bd3ec..ce96ec5284b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class NonStringEnumsClientConfiguration(Configuration): # pylint: disable=too-m attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(NonStringEnumsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "nonstringenumsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'nonstringenumsclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_non_string_enums_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_non_string_enums_client.py index eb39325a27f..b38044e0d0c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_non_string_enums_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_non_string_enums_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class NonStringEnumsClient: """Testing non-string enums. @@ -32,7 +31,12 @@ class NonStringEnumsClient: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = NonStringEnumsClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -42,7 +46,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self.int = IntOperations(self._client, self._config, self._serialize, self._deserialize) self.float = FloatOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/__init__.py index b4845a86878..bec2ee589d7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import FloatOperations __all__ = [ - "IntOperations", - "FloatOperations", + 'IntOperations', + 'FloatOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py index 7dcd2d8315a..9b4e8a3e80c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py @@ -8,30 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_float_get_request, - build_float_put_request, - build_int_get_request, - build_int_put_request, -) - -T = TypeVar("T") +from ...operations._operations import build_float_get_request, build_float_put_request, build_int_get_request, build_int_put_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class IntOperations: """IntOperations async operations. @@ -51,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def put(self, input: Optional[int] = None, **kwargs: Any) -> str: + async def put( + self, + input: Optional[int] = None, + **kwargs: Any + ) -> str: """Put an int enum. :param input: Input int enum. Possible values are: 200, 403, 405, 406, and 429. @@ -60,11 +51,13 @@ async def put(self, input: Optional[int] = None, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: _json = input @@ -78,7 +71,9 @@ async def put(self, input: Optional[int] = None, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -96,8 +91,13 @@ async def put(self, input: Optional[int] = None, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def get(self, **kwargs: Any) -> int: + async def get( + self, + **kwargs: Any + ) -> int: """Get an int enum. :return: int. Possible values are: 200, 403, 405, 406, and 429. @@ -110,15 +110,21 @@ async def get(self, **kwargs: Any) -> int: # response body for status code(s): 200 response.json() == 0 # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -156,7 +162,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def put(self, input: Optional[float] = None, **kwargs: Any) -> str: + async def put( + self, + input: Optional[float] = None, + **kwargs: Any + ) -> str: """Put a float enum. :param input: Input float enum. Possible values are: 200.4, 403.4, 405.3, 406.2, and 429.1. @@ -165,11 +175,13 @@ async def put(self, input: Optional[float] = None, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: _json = input @@ -183,7 +195,9 @@ async def put(self, input: Optional[float] = None, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -201,8 +215,13 @@ async def put(self, input: Optional[float] = None, **kwargs: Any) -> str: return deserialized + + @distributed_trace_async - async def get(self, **kwargs: Any) -> float: + async def get( + self, + **kwargs: Any + ) -> float: """Get a float enum. :return: float. Possible values are: 200.4, 403.4, 405.3, 406.2, and 429.1. @@ -215,15 +234,21 @@ async def get(self, **kwargs: Any) -> float: # response body for status code(s): 200 response.json() == 0.0 # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_float_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_float_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -240,3 +265,5 @@ async def get(self, **kwargs: Any) -> float: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/__init__.py index b4845a86878..bec2ee589d7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import FloatOperations __all__ = [ - "IntOperations", - "FloatOperations", + 'IntOperations', + 'FloatOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py index efd1a5b578f..858184ed7b5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py @@ -8,82 +8,111 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_int_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_int_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/nonStringEnums/int/put" + url = '/nonStringEnums/int/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_int_get_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_int_get_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/nonStringEnums/int/get" + url = '/nonStringEnums/int/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_float_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_float_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/nonStringEnums/float/put" + url = '/nonStringEnums/float/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_float_get_request(**kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_float_get_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/nonStringEnums/float/get" + url = '/nonStringEnums/float/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) class IntOperations(object): """IntOperations operations. @@ -104,7 +133,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def put(self, input: Optional[int] = None, **kwargs: Any) -> str: + def put( + self, + input: Optional[int] = None, + **kwargs: Any + ) -> str: """Put an int enum. :param input: Input int enum. Possible values are: 200, 403, 405, 406, and 429. @@ -113,11 +146,13 @@ def put(self, input: Optional[int] = None, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: _json = input @@ -131,7 +166,9 @@ def put(self, input: Optional[int] = None, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -149,8 +186,13 @@ def put(self, input: Optional[int] = None, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def get(self, **kwargs: Any) -> int: + def get( + self, + **kwargs: Any + ) -> int: """Get an int enum. :return: int. Possible values are: 200, 403, 405, 406, and 429. @@ -163,15 +205,21 @@ def get(self, **kwargs: Any) -> int: # response body for status code(s): 200 response.json() == 0 # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[int] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_int_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[int] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_int_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -209,7 +257,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def put(self, input: Optional[float] = None, **kwargs: Any) -> str: + def put( + self, + input: Optional[float] = None, + **kwargs: Any + ) -> str: """Put a float enum. :param input: Input float enum. Possible values are: 200.4, 403.4, 405.3, 406.2, and 429.1. @@ -218,11 +270,13 @@ def put(self, input: Optional[float] = None, **kwargs: Any) -> str: :rtype: str :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[str] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if input is not None: _json = input @@ -236,7 +290,9 @@ def put(self, input: Optional[float] = None, **kwargs: Any) -> str: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -254,8 +310,13 @@ def put(self, input: Optional[float] = None, **kwargs: Any) -> str: return deserialized + + @distributed_trace - def get(self, **kwargs: Any) -> float: + def get( + self, + **kwargs: Any + ) -> float: """Get a float enum. :return: float. Possible values are: 200.4, 403.4, 405.3, 406.2, and 429.1. @@ -268,15 +329,21 @@ def get(self, **kwargs: Any) -> float: # response body for status code(s): 200 response.json() == 0.0 # Optional. """ - cls = kwargs.pop("cls", None) # type: ClsType[float] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_float_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[float] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_float_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -293,3 +360,5 @@ def get(self, **kwargs: Any) -> float: return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py index 67f8f2e27c2..d67d567521a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Testing non-string enums. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/__init__.py index 09dfe0c03cd..e56ee1488d0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ObjectTypeClient"] +__all__ = ['ObjectTypeClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_configuration.py index 5a4c1636f8b..5b8dc84693d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class ObjectTypeClientConfiguration(Configuration): # pylint: disable=too-many- attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ObjectTypeClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "objecttypeclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'objecttypeclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_object_type_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_object_type_client.py index ff168e35524..6212438ee7c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_object_type_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_object_type_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ObjectTypeClient(ObjectTypeClientOperationsMixin): """Service client for testing basic type: object swaggers. @@ -28,8 +27,13 @@ class ObjectTypeClient(ObjectTypeClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = ObjectTypeClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/__init__.py index a6b98640623..33484945f60 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ObjectTypeClientOperationsMixin __all__ = [ - "ObjectTypeClientOperationsMixin", + 'ObjectTypeClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py index df193ec2992..4f1c96094e8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py @@ -8,58 +8,72 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_request(**kwargs: Any) -> HttpRequest: +def build_get_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/objectType/get" + url = '/objectType/get' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_put_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_put_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/objectType/put" + url = '/objectType/put' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ObjectTypeClientOperationsMixin(object): + @distributed_trace - def get(self, **kwargs: Any) -> Any: + def get( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an object. Returns object { 'message': 'An object was successfully returned' }. @@ -67,15 +81,21 @@ def get(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -93,8 +113,14 @@ def get(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def put(self, put_object: Any, **kwargs: Any) -> None: + def put( + self, + put_object: Any, + **kwargs: Any + ) -> None: """Basic put that puts an object. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -104,11 +130,13 @@ def put(self, put_object: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = put_object @@ -119,7 +147,9 @@ def put(self, put_object: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -129,3 +159,5 @@ def put(self, put_object: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/__init__.py index c1ad6e24f4d..2ab3dbf0215 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._object_type_client import ObjectTypeClient - -__all__ = ["ObjectTypeClient"] +__all__ = ['ObjectTypeClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_configuration.py index 8e6db9a7d20..6780a0e6232 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class ObjectTypeClientConfiguration(Configuration): # pylint: disable=too-many- attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ObjectTypeClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "objecttypeclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'objecttypeclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_object_type_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_object_type_client.py index 92b79836058..a5b202a9256 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_object_type_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_object_type_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ObjectTypeClient(ObjectTypeClientOperationsMixin): """Service client for testing basic type: object swaggers. @@ -28,7 +27,12 @@ class ObjectTypeClient(ObjectTypeClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = ObjectTypeClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/__init__.py index a6b98640623..33484945f60 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ObjectTypeClientOperationsMixin __all__ = [ - "ObjectTypeClientOperationsMixin", + 'ObjectTypeClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py index c5a9aeb4b47..7a79a5d1e4b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py @@ -8,28 +8,24 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ..._operations._operations import build_get_request, build_put_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ObjectTypeClientOperationsMixin: + @distributed_trace_async - async def get(self, **kwargs: Any) -> Any: + async def get( + self, + **kwargs: Any + ) -> Any: """Basic get that returns an object. Returns object { 'message': 'An object was successfully returned' }. @@ -37,15 +33,21 @@ async def get(self, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_get_request() + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -63,8 +65,14 @@ async def get(self, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def put(self, put_object: Any, **kwargs: Any) -> None: + async def put( + self, + put_object: Any, + **kwargs: Any + ) -> None: """Basic put that puts an object. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -74,11 +82,13 @@ async def put(self, put_object: Any, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = put_object @@ -89,7 +99,9 @@ async def put(self, put_object: Any, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -99,3 +111,5 @@ async def put(self, put_object: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py index fae955ee4ad..8c6b57e7416 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing basic type: object swaggers. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/__init__.py index 89734cff0ef..e3a59770bd4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestParameterFlattening"] +__all__ = ['AutoRestParameterFlattening'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_auto_rest_parameter_flattening.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_auto_rest_parameter_flattening.py index 98460d546d0..29d49a86dd2 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_auto_rest_parameter_flattening.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_auto_rest_parameter_flattening.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterFlattening: """Resource Flattening for AutoRest. @@ -31,17 +30,21 @@ class AutoRestParameterFlattening: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestParameterFlatteningConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.availability_sets = AvailabilitySetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.availability_sets = AvailabilitySetsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_configuration.py index 3fe06c6bd8e..0727c744512 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestParameterFlatteningConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterFlatteningConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparameterflattening/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterflattening/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/__init__.py index afd7446dd4f..79225d2b2ed 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_parameter_flattening import AutoRestParameterFlattening - -__all__ = ["AutoRestParameterFlattening"] +__all__ = ['AutoRestParameterFlattening'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_auto_rest_parameter_flattening.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_auto_rest_parameter_flattening.py index c24fe7714ef..81795ecfe0d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_auto_rest_parameter_flattening.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_auto_rest_parameter_flattening.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestParameterFlattening: """Resource Flattening for AutoRest. @@ -31,18 +30,26 @@ class AutoRestParameterFlattening: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestParameterFlatteningConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.availability_sets = AvailabilitySetsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.availability_sets = AvailabilitySetsOperations(self._client, self._config, self._serialize, self._deserialize) + - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_configuration.py index 5bcb4b1198f..62d5d8180ef 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestParameterFlatteningConfiguration(Configuration): # pylint: disabl attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestParameterFlatteningConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestparameterflattening/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestparameterflattening/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/__init__.py index 2c5fe4689a5..33fdbb06005 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AvailabilitySetsOperations __all__ = [ - "AvailabilitySetsOperations", + 'AvailabilitySetsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py index ec6348e8ba6..2e51d4a57df 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py @@ -8,25 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ...operations._operations import build_availability_sets_update_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AvailabilitySetsOperations: """AvailabilitySetsOperations async operations. @@ -46,7 +38,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def update(self, resource_group_name: str, avset: str, tags: JSONType, **kwargs: Any) -> None: + async def update( + self, + resource_group_name: str, + avset: str, + tags: JSONType, + **kwargs: Any + ) -> None: """Updates the tags for an availability set. :param resource_group_name: The name of the resource group. @@ -70,11 +68,13 @@ async def update(self, resource_group_name: str, avset: str, tags: JSONType, **k } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = tags @@ -87,7 +87,9 @@ async def update(self, resource_group_name: str, avset: str, tags: JSONType, **k request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -97,3 +99,5 @@ async def update(self, resource_group_name: str, avset: str, tags: JSONType, **k if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/__init__.py index 2c5fe4689a5..33fdbb06005 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AvailabilitySetsOperations __all__ = [ - "AvailabilitySetsOperations", + 'AvailabilitySetsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py index e4952828f40..5801c827797 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,25 +16,28 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_availability_sets_update_request( - resource_group_name: str, avset: str, *, json: JSONType = None, content: Any = None, **kwargs: Any + resource_group_name: str, + avset: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/parameterFlattening/{resourceGroupName}/{availabilitySetName}" + url = '/parameterFlattening/{resourceGroupName}/{availabilitySetName}' path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "availabilitySetName": _SERIALIZER.url("avset", avset, "str", max_length=80, min_length=0), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "availabilitySetName": _SERIALIZER.url("avset", avset, 'str', max_length=80, min_length=0), } url = _format_url_section(url, **path_format_arguments) @@ -48,10 +45,16 @@ def build_availability_sets_update_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="PATCH", url=url, headers=header_parameters, json=json, content=content, **kwargs) + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + return HttpRequest( + method="PATCH", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AvailabilitySetsOperations(object): """AvailabilitySetsOperations operations. @@ -72,7 +75,13 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def update(self, resource_group_name: str, avset: str, tags: JSONType, **kwargs: Any) -> None: + def update( + self, + resource_group_name: str, + avset: str, + tags: JSONType, + **kwargs: Any + ) -> None: """Updates the tags for an availability set. :param resource_group_name: The name of the resource group. @@ -96,11 +105,13 @@ def update(self, resource_group_name: str, avset: str, tags: JSONType, **kwargs: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = tags @@ -113,7 +124,9 @@ def update(self, resource_group_name: str, avset: str, tags: JSONType, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -123,3 +136,5 @@ def update(self, resource_group_name: str, avset: str, tags: JSONType, **kwargs: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py index 5deb8606bc4..9da8a75fb55 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Resource Flattening for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/__init__.py index b8ba21b64e7..2668d267b05 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ParmaterizedEndpointClient"] +__all__ = ['ParmaterizedEndpointClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_configuration.py index d67331e9db2..30a6c8ce041 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_configuration.py @@ -24,25 +24,30 @@ class ParmaterizedEndpointClientConfiguration(Configuration): # pylint: disable :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: super(ParmaterizedEndpointClientConfiguration, self).__init__(**kwargs) if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "parmaterizedendpointclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'parmaterizedendpointclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/__init__.py index c64d70b4ad0..f459fcdbab3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParmaterizedEndpointClientOperationsMixin __all__ = [ - "ParmaterizedEndpointClientOperationsMixin", + 'ParmaterizedEndpointClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py index 78ebef09f77..3a5dd1aa308 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py @@ -8,54 +8,61 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_request(**kwargs: Any) -> HttpRequest: +def build_get_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/parameterizedEndpoint/get" - - return HttpRequest(method="GET", url=url, **kwargs) + url = '/parameterizedEndpoint/get' + return HttpRequest( + method="GET", + url=url, + **kwargs + ) class ParmaterizedEndpointClientOperationsMixin(object): + @distributed_trace - def get(self, **kwargs: Any) -> None: + def get( + self, + **kwargs: Any + ) -> None: """Basic get to make sure base url formatting of 'endpoint' works. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_get_request() + + request = build_get_request( + ) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -65,3 +72,5 @@ def get(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_parmaterized_endpoint_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_parmaterized_endpoint_client.py index d1c24f77581..da5e8e01f99 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_parmaterized_endpoint_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_parmaterized_endpoint_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ParmaterizedEndpointClient(ParmaterizedEndpointClientOperationsMixin): """Service client for testing parameterized hosts with the name 'endpoint'. @@ -28,8 +27,12 @@ class ParmaterizedEndpointClient(ParmaterizedEndpointClientOperationsMixin): :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: - _endpoint = "{endpoint}" + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: + _endpoint = '{endpoint}' self._config = ParmaterizedEndpointClientConfiguration(endpoint=endpoint, **kwargs) self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -37,6 +40,7 @@ def __init__(self, endpoint: str, **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest @@ -61,7 +65,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/__init__.py index cc7178494ae..59521cea44d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._parmaterized_endpoint_client import ParmaterizedEndpointClient - -__all__ = ["ParmaterizedEndpointClient"] +__all__ = ['ParmaterizedEndpointClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_configuration.py index 96ac0e13f69..cbdabb5aa79 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_configuration.py @@ -24,22 +24,29 @@ class ParmaterizedEndpointClientConfiguration(Configuration): # pylint: disable :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: super(ParmaterizedEndpointClientConfiguration, self).__init__(**kwargs) if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") self.endpoint = endpoint - kwargs.setdefault("sdk_moniker", "parmaterizedendpointclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'parmaterizedendpointclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/__init__.py index c64d70b4ad0..f459fcdbab3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import ParmaterizedEndpointClientOperationsMixin __all__ = [ - "ParmaterizedEndpointClientOperationsMixin", + 'ParmaterizedEndpointClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py index dbfa3048584..1513562052f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py @@ -8,45 +8,47 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ..._operations._operations import build_get_request - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ParmaterizedEndpointClientOperationsMixin: + @distributed_trace_async - async def get(self, **kwargs: Any) -> None: + async def get( + self, + **kwargs: Any + ) -> None: """Basic get to make sure base url formatting of 'endpoint' works. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - request = build_get_request() + + request = build_get_request( + ) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request.url = self._client.format_url(request.url, **path_format_arguments) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -56,3 +58,5 @@ async def get(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_parmaterized_endpoint_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_parmaterized_endpoint_client.py index 8d0e6938056..41238b93cb6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_parmaterized_endpoint_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_parmaterized_endpoint_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ParmaterizedEndpointClient(ParmaterizedEndpointClientOperationsMixin): """Service client for testing parameterized hosts with the name 'endpoint'. @@ -28,8 +27,12 @@ class ParmaterizedEndpointClient(ParmaterizedEndpointClientOperationsMixin): :type endpoint: str """ - def __init__(self, endpoint: str, **kwargs: Any) -> None: - _endpoint = "{endpoint}" + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: + _endpoint = '{endpoint}' self._config = ParmaterizedEndpointClientConfiguration(endpoint=endpoint, **kwargs) self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) @@ -37,7 +40,12 @@ def __init__(self, endpoint: str, **kwargs: Any) -> None: self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -57,7 +65,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt request_copy = deepcopy(request) path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py index b4cd6534537..64afd119cb9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Service client for testing parameterized hosts with the name 'endpoint'. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/__init__.py index 194a940b001..3c47c0e71b8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestReportService"] +__all__ = ['AutoRestReportService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_auto_rest_report_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_auto_rest_report_service.py index e67858f06cd..ac782753a5d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_auto_rest_report_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_auto_rest_report_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportService(AutoRestReportServiceOperationsMixin): """Test Infrastructure for AutoRest. @@ -28,8 +27,13 @@ class AutoRestReportService(AutoRestReportServiceOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestReportServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -37,6 +41,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_configuration.py index ffc083a4bc1..05acbc00632 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too- attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/__init__.py index 0cf703cd99d..adfa43faa2c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestReportServiceOperationsMixin __all__ = [ - "AutoRestReportServiceOperationsMixin", + 'AutoRestReportServiceOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py index 3991177cc15..b1d070c048a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py @@ -8,64 +8,81 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_get_report_request( + *, + qualifier: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/report" + url = '/report' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if qualifier is not None: - query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - - -def build_get_optional_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_optional_report_request( + *, + qualifier: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/report/optional" + url = '/report/optional' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if qualifier is not None: - query_parameters["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") + query_parameters['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AutoRestReportServiceOperationsMixin(object): + @distributed_trace - def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + def get_report( + self, + *, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get test coverage report. :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' @@ -84,17 +101,23 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_report_request( qualifier=qualifier, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -112,8 +135,15 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ return deserialized + + @distributed_trace - def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + def get_optional_report( + self, + *, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get optional test coverage report. :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' @@ -132,17 +162,23 @@ def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_optional_report_request( qualifier=qualifier, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -159,3 +195,5 @@ def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/__init__.py index 7db91454410..d2bc65f6452 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_report_service import AutoRestReportService - -__all__ = ["AutoRestReportService"] +__all__ = ['AutoRestReportService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_auto_rest_report_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_auto_rest_report_service.py index 5d395802acb..f6fbc8c8040 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_auto_rest_report_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_auto_rest_report_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestReportService(AutoRestReportServiceOperationsMixin): """Test Infrastructure for AutoRest. @@ -28,7 +27,12 @@ class AutoRestReportService(AutoRestReportServiceOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestReportServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -36,7 +40,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._deserialize = Deserializer() self._serialize.client_side_validation = False - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_configuration.py index deffe2972cc..07f1640ca40 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestReportServiceConfiguration(Configuration): # pylint: disable=too- attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestReportServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestreportservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestreportservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/__init__.py index 0cf703cd99d..adfa43faa2c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestReportServiceOperationsMixin __all__ = [ - "AutoRestReportServiceOperationsMixin", + 'AutoRestReportServiceOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py index 71a770790cb..1758c5a080b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py @@ -8,28 +8,26 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from ..._operations._operations import build_get_optional_report_request, build_get_report_request - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestReportServiceOperationsMixin: + @distributed_trace_async - async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + async def get_report( + self, + *, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get test coverage report. :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' @@ -48,17 +46,22 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_report_request( qualifier=qualifier, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -76,8 +79,15 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> return deserialized + + @distributed_trace_async - async def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str, int]: + async def get_optional_report( + self, + *, + qualifier: Optional[str] = None, + **kwargs: Any + ) -> Dict[str, int]: """Get optional test coverage report. :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' @@ -96,17 +106,22 @@ async def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs "str": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, int]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, int]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_get_optional_report_request( qualifier=qualifier, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -123,3 +138,5 @@ async def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py index 2f4459980ef..a1b05ebd53f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/__init__.py index c9a1faeed62..aeb3ff59763 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestRequiredOptionalTestService"] +__all__ = ['AutoRestRequiredOptionalTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_auto_rest_required_optional_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_auto_rest_required_optional_test_service.py index 5e336fc9034..26fbfd27faa 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_auto_rest_required_optional_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_auto_rest_required_optional_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRequiredOptionalTestService: """Test Infrastructure for AutoRest. @@ -47,13 +46,8 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = AutoRestRequiredOptionalTestServiceConfiguration( - required_global_path=required_global_path, - required_global_query=required_global_query, - optional_global_query=optional_global_query, - **kwargs - ) + + self._config = AutoRestRequiredOptionalTestServiceConfiguration(required_global_path=required_global_path, required_global_query=required_global_query, optional_global_query=optional_global_query, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -61,6 +55,7 @@ def __init__( self.implicit = ImplicitOperations(self._client, self._config, self._serialize, self._deserialize) self.explicit = ExplicitOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_configuration.py index ee771e1d313..3242034dd67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_configuration.py @@ -44,19 +44,20 @@ def __init__( self.required_global_path = required_global_path self.required_global_query = required_global_query self.optional_global_query = optional_global_query - kwargs.setdefault("sdk_moniker", "autorestrequiredoptionaltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrequiredoptionaltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/__init__.py index 0648b590400..455a4888284 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_required_optional_test_service import AutoRestRequiredOptionalTestService - -__all__ = ["AutoRestRequiredOptionalTestService"] +__all__ = ['AutoRestRequiredOptionalTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_auto_rest_required_optional_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_auto_rest_required_optional_test_service.py index b7f38ff808c..51f8d700c04 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_auto_rest_required_optional_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_auto_rest_required_optional_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestRequiredOptionalTestService: """Test Infrastructure for AutoRest. @@ -47,12 +46,7 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestRequiredOptionalTestServiceConfiguration( - required_global_path=required_global_path, - required_global_query=required_global_query, - optional_global_query=optional_global_query, - **kwargs - ) + self._config = AutoRestRequiredOptionalTestServiceConfiguration(required_global_path=required_global_path, required_global_query=required_global_query, optional_global_query=optional_global_query, **kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -60,7 +54,12 @@ def __init__( self.implicit = ImplicitOperations(self._client, self._config, self._serialize, self._deserialize) self.explicit = ExplicitOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_configuration.py index 7e8ed6d197f..1c395c72058 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_configuration.py @@ -44,16 +44,19 @@ def __init__( self.required_global_path = required_global_path self.required_global_query = required_global_query self.optional_global_query = optional_global_query - kwargs.setdefault("sdk_moniker", "autorestrequiredoptionaltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestrequiredoptionaltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/__init__.py index f89ba48221e..9ecadae655a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import ExplicitOperations __all__ = [ - "ImplicitOperations", - "ExplicitOperations", + 'ImplicitOperations', + 'ExplicitOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py index 4e0ea82af72..dcdde8d55f6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py @@ -8,58 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_explicit_post_optional_array_header_request, - build_explicit_post_optional_array_parameter_request, - build_explicit_post_optional_array_property_request, - build_explicit_post_optional_class_parameter_request, - build_explicit_post_optional_class_property_request, - build_explicit_post_optional_integer_header_request, - build_explicit_post_optional_integer_parameter_request, - build_explicit_post_optional_integer_property_request, - build_explicit_post_optional_string_header_request, - build_explicit_post_optional_string_parameter_request, - build_explicit_post_optional_string_property_request, - build_explicit_post_required_array_header_request, - build_explicit_post_required_array_parameter_request, - build_explicit_post_required_array_property_request, - build_explicit_post_required_class_parameter_request, - build_explicit_post_required_class_property_request, - build_explicit_post_required_integer_header_request, - build_explicit_post_required_integer_parameter_request, - build_explicit_post_required_integer_property_request, - build_explicit_post_required_string_header_request, - build_explicit_post_required_string_parameter_request, - build_explicit_post_required_string_property_request, - build_explicit_put_optional_binary_body_request, - build_explicit_put_required_binary_body_request, - build_implicit_get_optional_global_query_request, - build_implicit_get_required_global_path_request, - build_implicit_get_required_global_query_request, - build_implicit_get_required_path_request, - build_implicit_put_optional_binary_body_request, - build_implicit_put_optional_body_request, - build_implicit_put_optional_header_request, - build_implicit_put_optional_query_request, -) - -T = TypeVar("T") +from ...operations._operations import build_explicit_post_optional_array_header_request, build_explicit_post_optional_array_parameter_request, build_explicit_post_optional_array_property_request, build_explicit_post_optional_class_parameter_request, build_explicit_post_optional_class_property_request, build_explicit_post_optional_integer_header_request, build_explicit_post_optional_integer_parameter_request, build_explicit_post_optional_integer_property_request, build_explicit_post_optional_string_header_request, build_explicit_post_optional_string_parameter_request, build_explicit_post_optional_string_property_request, build_explicit_post_required_array_header_request, build_explicit_post_required_array_parameter_request, build_explicit_post_required_array_property_request, build_explicit_post_required_class_parameter_request, build_explicit_post_required_class_property_request, build_explicit_post_required_integer_header_request, build_explicit_post_required_integer_parameter_request, build_explicit_post_required_integer_property_request, build_explicit_post_required_string_header_request, build_explicit_post_required_string_parameter_request, build_explicit_post_required_string_property_request, build_explicit_put_optional_binary_body_request, build_explicit_put_required_binary_body_request, build_implicit_get_optional_global_query_request, build_implicit_get_required_global_path_request, build_implicit_get_required_global_query_request, build_implicit_get_required_path_request, build_implicit_put_optional_binary_body_request, build_implicit_put_optional_body_request, build_implicit_put_optional_header_request, build_implicit_put_optional_query_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ImplicitOperations: """ImplicitOperations async operations. @@ -79,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: + async def get_required_path( + self, + path_parameter: str, + **kwargs: Any + ) -> None: """Test implicitly required path parameter. :param path_parameter: @@ -88,17 +51,22 @@ async def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_required_path_request( path_parameter=path_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -109,8 +77,15 @@ async def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_optional_query(self, *, query_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def put_optional_query( + self, + *, + query_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional query parameter. :keyword query_parameter: @@ -119,17 +94,22 @@ async def put_optional_query(self, *, query_parameter: Optional[str] = None, **k :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_put_optional_query_request( query_parameter=query_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -140,8 +120,15 @@ async def put_optional_query(self, *, query_parameter: Optional[str] = None, **k if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_optional_header(self, *, query_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def put_optional_header( + self, + *, + query_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional header parameter. :keyword query_parameter: @@ -150,17 +137,22 @@ async def put_optional_header(self, *, query_parameter: Optional[str] = None, ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_put_optional_header_request( query_parameter=query_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -171,8 +163,14 @@ async def put_optional_header(self, *, query_parameter: Optional[str] = None, ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def put_optional_body( + self, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional body parameter. :param body_parameter: @@ -181,11 +179,13 @@ async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -199,7 +199,9 @@ async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -210,8 +212,14 @@ async def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs: Any) -> None: + async def put_optional_binary_body( + self, + body_parameter: Optional[IO] = None, + **kwargs: Any + ) -> None: """Test implicitly optional body parameter. :param body_parameter: @@ -220,11 +228,13 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter @@ -235,7 +245,9 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -246,25 +258,35 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_required_global_path(self, **kwargs: Any) -> None: + async def get_required_global_path( + self, + **kwargs: Any + ) -> None: """Test implicitly required path parameter. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_required_global_path_request( required_global_path=self._config.required_global_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -275,25 +297,35 @@ async def get_required_global_path(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_required_global_query(self, **kwargs: Any) -> None: + async def get_required_global_query( + self, + **kwargs: Any + ) -> None: """Test implicitly required query parameter. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_required_global_query_request( required_global_query=self._config.required_global_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -304,25 +336,35 @@ async def get_required_global_query(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_optional_global_query(self, **kwargs: Any) -> None: + async def get_optional_global_query( + self, + **kwargs: Any + ) -> None: """Test implicitly optional query parameter. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_optional_global_query_request( optional_global_query=self._config.optional_global_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -353,7 +395,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs: Any) -> None: + async def put_optional_binary_body( + self, + body_parameter: Optional[IO] = None, + **kwargs: Any + ) -> None: """Test explicitly optional body parameter. :param body_parameter: @@ -362,11 +408,13 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter @@ -377,7 +425,9 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -388,8 +438,14 @@ async def put_optional_binary_body(self, body_parameter: Optional[IO] = None, ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> None: + async def put_required_binary_body( + self, + body_parameter: IO, + **kwargs: Any + ) -> None: """Test explicitly required body parameter. :param body_parameter: @@ -398,11 +454,13 @@ async def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter @@ -413,7 +471,9 @@ async def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -424,8 +484,14 @@ async def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_integer_parameter(self, body_parameter: int, **kwargs: Any) -> None: + async def post_required_integer_parameter( + self, + body_parameter: int, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put null and the client library should throw before the request is sent. @@ -435,11 +501,13 @@ async def post_required_integer_parameter(self, body_parameter: int, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -450,7 +518,9 @@ async def post_required_integer_parameter(self, body_parameter: int, **kwargs: A request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -461,8 +531,14 @@ async def post_required_integer_parameter(self, body_parameter: int, **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_integer_parameter(self, body_parameter: Optional[int] = None, **kwargs: Any) -> None: + async def post_optional_integer_parameter( + self, + body_parameter: Optional[int] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put null. :param body_parameter: @@ -471,11 +547,13 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -489,7 +567,9 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -500,8 +580,14 @@ async def post_optional_integer_parameter(self, body_parameter: Optional[int] = if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_integer_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + async def post_required_integer_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -519,11 +605,13 @@ async def post_required_integer_property(self, body_parameter: JSONType, **kwarg "value": 0 # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -534,7 +622,9 @@ async def post_required_integer_property(self, body_parameter: JSONType, **kwarg request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -545,8 +635,14 @@ async def post_required_integer_property(self, body_parameter: JSONType, **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_integer_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + async def post_optional_integer_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. :param body_parameter: @@ -563,11 +659,13 @@ async def post_optional_integer_property(self, body_parameter: JSONType = None, "value": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -581,7 +679,9 @@ async def post_optional_integer_property(self, body_parameter: JSONType = None, request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -592,8 +692,15 @@ async def post_optional_integer_property(self, body_parameter: JSONType = None, if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_integer_header(self, *, header_parameter: int, **kwargs: Any) -> None: + async def post_required_integer_header( + self, + *, + header_parameter: int, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -603,17 +710,22 @@ async def post_required_integer_header(self, *, header_parameter: int, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_explicit_post_required_integer_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -624,8 +736,15 @@ async def post_required_integer_header(self, *, header_parameter: int, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_integer_header(self, *, header_parameter: Optional[int] = None, **kwargs: Any) -> None: + async def post_optional_integer_header( + self, + *, + header_parameter: Optional[int] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a header 'headerParameter' => null. :keyword header_parameter: @@ -634,17 +753,22 @@ async def post_optional_integer_header(self, *, header_parameter: Optional[int] :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_explicit_post_optional_integer_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -655,8 +779,14 @@ async def post_optional_integer_header(self, *, header_parameter: Optional[int] if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_string_parameter(self, body_parameter: str, **kwargs: Any) -> None: + async def post_required_string_parameter( + self, + body_parameter: str, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put null and the client library should throw before the request is sent. @@ -666,11 +796,13 @@ async def post_required_string_parameter(self, body_parameter: str, **kwargs: An :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -681,7 +813,9 @@ async def post_required_string_parameter(self, body_parameter: str, **kwargs: An request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -692,8 +826,14 @@ async def post_required_string_parameter(self, body_parameter: str, **kwargs: An if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_string_parameter(self, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def post_optional_string_parameter( + self, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test explicitly optional string. Please put null. :param body_parameter: @@ -702,11 +842,13 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -720,7 +862,9 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -731,8 +875,14 @@ async def post_optional_string_parameter(self, body_parameter: Optional[str] = N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_string_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + async def post_required_string_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -750,11 +900,13 @@ async def post_required_string_property(self, body_parameter: JSONType, **kwargs "value": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -765,7 +917,9 @@ async def post_required_string_property(self, body_parameter: JSONType, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -776,8 +930,14 @@ async def post_required_string_property(self, body_parameter: JSONType, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_string_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + async def post_optional_string_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. :param body_parameter: @@ -794,11 +954,13 @@ async def post_optional_string_property(self, body_parameter: JSONType = None, * "value": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -812,7 +974,9 @@ async def post_optional_string_property(self, body_parameter: JSONType = None, * request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -823,8 +987,15 @@ async def post_optional_string_property(self, body_parameter: JSONType = None, * if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_string_header(self, *, header_parameter: str, **kwargs: Any) -> None: + async def post_required_string_header( + self, + *, + header_parameter: str, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -834,17 +1005,22 @@ async def post_required_string_header(self, *, header_parameter: str, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_explicit_post_required_string_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -855,8 +1031,15 @@ async def post_required_string_header(self, *, header_parameter: str, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_string_header(self, *, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + async def post_optional_string_header( + self, + *, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test explicitly optional string. Please put a header 'headerParameter' => null. :keyword body_parameter: @@ -865,17 +1048,22 @@ async def post_optional_string_header(self, *, body_parameter: Optional[str] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_explicit_post_optional_string_header_request( body_parameter=body_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -886,8 +1074,14 @@ async def post_optional_string_header(self, *, body_parameter: Optional[str] = N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_class_parameter(self, body_parameter: JSONType, **kwargs: Any) -> None: + async def post_required_class_parameter( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -906,11 +1100,13 @@ async def post_required_class_parameter(self, body_parameter: JSONType, **kwargs "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -921,7 +1117,9 @@ async def post_required_class_parameter(self, body_parameter: JSONType, **kwargs request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -932,8 +1130,14 @@ async def post_required_class_parameter(self, body_parameter: JSONType, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_class_parameter(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + async def post_optional_class_parameter( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional complex object. Please put null. :param body_parameter: @@ -951,11 +1155,13 @@ async def post_optional_class_parameter(self, body_parameter: JSONType = None, * "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -969,7 +1175,9 @@ async def post_optional_class_parameter(self, body_parameter: JSONType = None, * request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -980,8 +1188,14 @@ async def post_optional_class_parameter(self, body_parameter: JSONType = None, * if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_class_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + async def post_required_class_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1002,11 +1216,13 @@ async def post_required_class_property(self, body_parameter: JSONType, **kwargs: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1017,7 +1233,9 @@ async def post_required_class_property(self, body_parameter: JSONType, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1028,8 +1246,14 @@ async def post_required_class_property(self, body_parameter: JSONType, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_class_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + async def post_optional_class_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. :param body_parameter: @@ -1049,11 +1273,13 @@ async def post_optional_class_property(self, body_parameter: JSONType = None, ** } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1067,7 +1293,9 @@ async def post_optional_class_property(self, body_parameter: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1078,8 +1306,14 @@ async def post_optional_class_property(self, body_parameter: JSONType = None, ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_array_parameter(self, body_parameter: List[str], **kwargs: Any) -> None: + async def post_required_array_parameter( + self, + body_parameter: List[str], + **kwargs: Any + ) -> None: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -1097,11 +1331,13 @@ async def post_required_array_parameter(self, body_parameter: List[str], **kwarg "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1112,7 +1348,9 @@ async def post_required_array_parameter(self, body_parameter: List[str], **kwarg request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1123,8 +1361,14 @@ async def post_required_array_parameter(self, body_parameter: List[str], **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_array_parameter(self, body_parameter: Optional[List[str]] = None, **kwargs: Any) -> None: + async def post_optional_array_parameter( + self, + body_parameter: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Test explicitly optional array. Please put null. :param body_parameter: @@ -1141,11 +1385,13 @@ async def post_optional_array_parameter(self, body_parameter: Optional[List[str] "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1159,7 +1405,9 @@ async def post_optional_array_parameter(self, body_parameter: Optional[List[str] request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1170,8 +1418,14 @@ async def post_optional_array_parameter(self, body_parameter: Optional[List[str] if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_array_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + async def post_required_array_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1191,11 +1445,13 @@ async def post_required_array_property(self, body_parameter: JSONType, **kwargs: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1206,7 +1462,9 @@ async def post_required_array_property(self, body_parameter: JSONType, **kwargs: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1217,8 +1475,14 @@ async def post_required_array_property(self, body_parameter: JSONType, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_array_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + async def post_optional_array_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. :param body_parameter: @@ -1237,11 +1501,13 @@ async def post_optional_array_property(self, body_parameter: JSONType = None, ** ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1255,7 +1521,9 @@ async def post_optional_array_property(self, body_parameter: JSONType = None, ** request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1266,8 +1534,15 @@ async def post_optional_array_property(self, body_parameter: JSONType = None, ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_required_array_header(self, *, header_parameter: List[str], **kwargs: Any) -> None: + async def post_required_array_header( + self, + *, + header_parameter: List[str], + **kwargs: Any + ) -> None: """Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -1277,17 +1552,22 @@ async def post_required_array_header(self, *, header_parameter: List[str], **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_explicit_post_required_array_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1298,8 +1578,15 @@ async def post_required_array_header(self, *, header_parameter: List[str], **kwa if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_optional_array_header(self, *, header_parameter: Optional[List[str]] = None, **kwargs: Any) -> None: + async def post_optional_array_header( + self, + *, + header_parameter: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a header 'headerParameter' => null. :keyword header_parameter: @@ -1308,17 +1595,22 @@ async def post_optional_array_header(self, *, header_parameter: Optional[List[st :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_explicit_post_optional_array_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1328,3 +1620,5 @@ async def post_optional_array_header(self, *, header_parameter: Optional[List[st if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/__init__.py index f89ba48221e..9ecadae655a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import ExplicitOperations __all__ = [ - "ImplicitOperations", - "ExplicitOperations", + 'ImplicitOperations', + 'ExplicitOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py index e63c32a1416..84e6da24d22 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,558 +16,852 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - -def build_implicit_get_required_path_request(path_parameter: str, **kwargs: Any) -> HttpRequest: +def build_implicit_get_required_path_request( + path_parameter: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/implicit/required/path/{pathParameter}" + url = '/reqopt/implicit/required/path/{pathParameter}' path_format_arguments = { - "pathParameter": _SERIALIZER.url("path_parameter", path_parameter, "str"), + "pathParameter": _SERIALIZER.url("path_parameter", path_parameter, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_implicit_put_optional_query_request(*, query_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_implicit_put_optional_query_request( + *, + query_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/query" + url = '/reqopt/implicit/optional/query' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if query_parameter is not None: - query_parameters["queryParameter"] = _SERIALIZER.query("query_parameter", query_parameter, "str") + query_parameters['queryParameter'] = _SERIALIZER.query("query_parameter", query_parameter, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_implicit_put_optional_header_request(*, query_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_implicit_put_optional_header_request( + *, + query_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/header" + url = '/reqopt/implicit/optional/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if query_parameter is not None: - header_parameters["queryParameter"] = _SERIALIZER.header("query_parameter", query_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['queryParameter'] = _SERIALIZER.header("query_parameter", query_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + **kwargs + ) def build_implicit_put_optional_body_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/body" + url = '/reqopt/implicit/optional/body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_implicit_put_optional_binary_body_request(*, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_implicit_put_optional_binary_body_request( + *, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/implicit/optional/binary-body" + url = '/reqopt/implicit/optional/binary-body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_implicit_get_required_global_path_request(required_global_path: str, **kwargs: Any) -> HttpRequest: +def build_implicit_get_required_global_path_request( + required_global_path: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/global/required/path/{required-global-path}" + url = '/reqopt/global/required/path/{required-global-path}' path_format_arguments = { - "required-global-path": _SERIALIZER.url("required_global_path", required_global_path, "str"), + "required-global-path": _SERIALIZER.url("required_global_path", required_global_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_implicit_get_required_global_query_request(*, required_global_query: str, **kwargs: Any) -> HttpRequest: +def build_implicit_get_required_global_query_request( + *, + required_global_query: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/global/required/query" + url = '/reqopt/global/required/query' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["required-global-query"] = _SERIALIZER.query("required_global_query", required_global_query, "str") + query_parameters['required-global-query'] = _SERIALIZER.query("required_global_query", required_global_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_implicit_get_optional_global_query_request( - *, optional_global_query: Optional[int] = None, **kwargs: Any + *, + optional_global_query: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/global/optional/query" + url = '/reqopt/global/optional/query' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if optional_global_query is not None: - query_parameters["optional-global-query"] = _SERIALIZER.query( - "optional_global_query", optional_global_query, "int" - ) + query_parameters['optional-global-query'] = _SERIALIZER.query("optional_global_query", optional_global_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_explicit_put_optional_binary_body_request(*, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_explicit_put_optional_binary_body_request( + *, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/explicit/optional/binary-body" + url = '/reqopt/explicit/optional/binary-body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) - - -def build_explicit_put_required_binary_body_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) + + +def build_explicit_put_required_binary_body_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/explicit/required/binary-body" + url = '/reqopt/explicit/required/binary-body' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_explicit_post_required_integer_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/integer/parameter" + url = '/reqopt/requied/integer/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_integer_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/integer/parameter" + url = '/reqopt/optional/integer/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_required_integer_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/integer/property" + url = '/reqopt/requied/integer/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_integer_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/integer/property" + url = '/reqopt/optional/integer/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_explicit_post_required_integer_header_request(*, header_parameter: int, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_explicit_post_required_integer_header_request( + *, + header_parameter: int, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/requied/integer/header" + url = '/reqopt/requied/integer/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_explicit_post_optional_integer_header_request( - *, header_parameter: Optional[int] = None, **kwargs: Any + *, + header_parameter: Optional[int] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/optional/integer/header" + url = '/reqopt/optional/integer/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_parameter is not None: - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "int") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_explicit_post_required_string_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/string/parameter" + url = '/reqopt/requied/string/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_string_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/string/parameter" + url = '/reqopt/optional/string/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_required_string_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/string/property" + url = '/reqopt/requied/string/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_string_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/string/property" + url = '/reqopt/optional/string/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_explicit_post_required_string_header_request(*, header_parameter: str, **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_explicit_post_required_string_header_request( + *, + header_parameter: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/requied/string/header" + url = '/reqopt/requied/string/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_explicit_post_optional_string_header_request( - *, body_parameter: Optional[str] = None, **kwargs: Any + *, + body_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/optional/string/header" + url = '/reqopt/optional/string/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if body_parameter is not None: - header_parameters["bodyParameter"] = _SERIALIZER.header("body_parameter", body_parameter, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['bodyParameter'] = _SERIALIZER.header("body_parameter", body_parameter, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_explicit_post_required_class_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/class/parameter" + url = '/reqopt/requied/class/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_class_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/class/parameter" + url = '/reqopt/optional/class/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_required_class_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/class/property" + url = '/reqopt/requied/class/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_class_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/class/property" + url = '/reqopt/optional/class/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_required_array_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/array/parameter" + url = '/reqopt/requied/array/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_array_parameter_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/array/parameter" + url = '/reqopt/optional/array/parameter' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_required_array_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/requied/array/property" + url = '/reqopt/requied/array/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_explicit_post_optional_array_property_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reqopt/optional/array/property" + url = '/reqopt/optional/array/property' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) - - -def build_explicit_post_required_array_header_request(*, header_parameter: List[str], **kwargs: Any) -> HttpRequest: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_explicit_post_required_array_header_request( + *, + header_parameter: List[str], + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/requied/array/header" + url = '/reqopt/requied/array/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "[str]", div=",") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) def build_explicit_post_optional_array_header_request( - *, header_parameter: Optional[List[str]] = None, **kwargs: Any + *, + header_parameter: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reqopt/optional/array/header" + url = '/reqopt/optional/array/header' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if header_parameter is not None: - header_parameters["headerParameter"] = _SERIALIZER.header( - "header_parameter", header_parameter, "[str]", div="," - ) - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + header_parameters['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) class ImplicitOperations(object): """ImplicitOperations operations. @@ -594,7 +882,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: + def get_required_path( + self, + path_parameter: str, + **kwargs: Any + ) -> None: """Test implicitly required path parameter. :param path_parameter: @@ -603,17 +895,22 @@ def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_required_path_request( path_parameter=path_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -624,8 +921,15 @@ def get_required_path(self, path_parameter: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_optional_query(self, *, query_parameter: Optional[str] = None, **kwargs: Any) -> None: + def put_optional_query( + self, + *, + query_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional query parameter. :keyword query_parameter: @@ -634,17 +938,23 @@ def put_optional_query(self, *, query_parameter: Optional[str] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_implicit_put_optional_query_request( query_parameter=query_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -655,8 +965,15 @@ def put_optional_query(self, *, query_parameter: Optional[str] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_optional_header(self, *, query_parameter: Optional[str] = None, **kwargs: Any) -> None: + def put_optional_header( + self, + *, + query_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional header parameter. :keyword query_parameter: @@ -665,17 +982,23 @@ def put_optional_header(self, *, query_parameter: Optional[str] = None, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_implicit_put_optional_header_request( query_parameter=query_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -686,8 +1009,14 @@ def put_optional_header(self, *, query_parameter: Optional[str] = None, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + def put_optional_body( + self, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test implicitly optional body parameter. :param body_parameter: @@ -696,11 +1025,13 @@ def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -714,7 +1045,9 @@ def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -725,8 +1058,14 @@ def put_optional_body(self, body_parameter: Optional[str] = None, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs: Any) -> None: + def put_optional_binary_body( + self, + body_parameter: Optional[IO] = None, + **kwargs: Any + ) -> None: """Test implicitly optional body parameter. :param body_parameter: @@ -735,11 +1074,13 @@ def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter @@ -750,7 +1091,9 @@ def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -761,25 +1104,35 @@ def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_required_global_path(self, **kwargs: Any) -> None: + def get_required_global_path( + self, + **kwargs: Any + ) -> None: """Test implicitly required path parameter. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_required_global_path_request( required_global_path=self._config.required_global_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -790,25 +1143,35 @@ def get_required_global_path(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_required_global_query(self, **kwargs: Any) -> None: + def get_required_global_query( + self, + **kwargs: Any + ) -> None: """Test implicitly required query parameter. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_required_global_query_request( required_global_query=self._config.required_global_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -819,25 +1182,35 @@ def get_required_global_query(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_optional_global_query(self, **kwargs: Any) -> None: + def get_optional_global_query( + self, + **kwargs: Any + ) -> None: """Test implicitly optional query parameter. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_implicit_get_optional_global_query_request( optional_global_query=self._config.optional_global_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -868,7 +1241,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs: Any) -> None: + def put_optional_binary_body( + self, + body_parameter: Optional[IO] = None, + **kwargs: Any + ) -> None: """Test explicitly optional body parameter. :param body_parameter: @@ -877,11 +1254,13 @@ def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter @@ -892,7 +1271,9 @@ def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -903,8 +1284,14 @@ def put_optional_binary_body(self, body_parameter: Optional[IO] = None, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> None: + def put_required_binary_body( + self, + body_parameter: IO, + **kwargs: Any + ) -> None: """Test explicitly required body parameter. :param body_parameter: @@ -913,11 +1300,13 @@ def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = body_parameter @@ -928,7 +1317,9 @@ def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -939,8 +1330,14 @@ def put_required_binary_body(self, body_parameter: IO, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_integer_parameter(self, body_parameter: int, **kwargs: Any) -> None: + def post_required_integer_parameter( + self, + body_parameter: int, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put null and the client library should throw before the request is sent. @@ -950,11 +1347,13 @@ def post_required_integer_parameter(self, body_parameter: int, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -965,7 +1364,9 @@ def post_required_integer_parameter(self, body_parameter: int, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -976,8 +1377,14 @@ def post_required_integer_parameter(self, body_parameter: int, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_integer_parameter(self, body_parameter: Optional[int] = None, **kwargs: Any) -> None: + def post_optional_integer_parameter( + self, + body_parameter: Optional[int] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put null. :param body_parameter: @@ -986,11 +1393,13 @@ def post_optional_integer_parameter(self, body_parameter: Optional[int] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1004,7 +1413,9 @@ def post_optional_integer_parameter(self, body_parameter: Optional[int] = None, request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1015,8 +1426,14 @@ def post_optional_integer_parameter(self, body_parameter: Optional[int] = None, if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_integer_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + def post_required_integer_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1034,11 +1451,13 @@ def post_required_integer_property(self, body_parameter: JSONType, **kwargs: Any "value": 0 # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1049,7 +1468,9 @@ def post_required_integer_property(self, body_parameter: JSONType, **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1060,8 +1481,14 @@ def post_required_integer_property(self, body_parameter: JSONType, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_integer_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + def post_optional_integer_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. :param body_parameter: @@ -1078,11 +1505,13 @@ def post_optional_integer_property(self, body_parameter: JSONType = None, **kwar "value": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1096,7 +1525,9 @@ def post_optional_integer_property(self, body_parameter: JSONType = None, **kwar request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1107,8 +1538,15 @@ def post_optional_integer_property(self, body_parameter: JSONType = None, **kwar if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_integer_header(self, *, header_parameter: int, **kwargs: Any) -> None: + def post_required_integer_header( + self, + *, + header_parameter: int, + **kwargs: Any + ) -> None: """Test explicitly required integer. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -1118,17 +1556,23 @@ def post_required_integer_header(self, *, header_parameter: int, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_explicit_post_required_integer_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1139,8 +1583,15 @@ def post_required_integer_header(self, *, header_parameter: int, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_integer_header(self, *, header_parameter: Optional[int] = None, **kwargs: Any) -> None: + def post_optional_integer_header( + self, + *, + header_parameter: Optional[int] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a header 'headerParameter' => null. :keyword header_parameter: @@ -1149,17 +1600,23 @@ def post_optional_integer_header(self, *, header_parameter: Optional[int] = None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_explicit_post_optional_integer_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1170,8 +1627,14 @@ def post_optional_integer_header(self, *, header_parameter: Optional[int] = None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_string_parameter(self, body_parameter: str, **kwargs: Any) -> None: + def post_required_string_parameter( + self, + body_parameter: str, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put null and the client library should throw before the request is sent. @@ -1181,11 +1644,13 @@ def post_required_string_parameter(self, body_parameter: str, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1196,7 +1661,9 @@ def post_required_string_parameter(self, body_parameter: str, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1207,8 +1674,14 @@ def post_required_string_parameter(self, body_parameter: str, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_string_parameter(self, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + def post_optional_string_parameter( + self, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test explicitly optional string. Please put null. :param body_parameter: @@ -1217,11 +1690,13 @@ def post_optional_string_parameter(self, body_parameter: Optional[str] = None, * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1235,7 +1710,9 @@ def post_optional_string_parameter(self, body_parameter: Optional[str] = None, * request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1246,8 +1723,14 @@ def post_optional_string_parameter(self, body_parameter: Optional[str] = None, * if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_string_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + def post_required_string_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1265,11 +1748,13 @@ def post_required_string_property(self, body_parameter: JSONType, **kwargs: Any) "value": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1280,7 +1765,9 @@ def post_required_string_property(self, body_parameter: JSONType, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1291,8 +1778,14 @@ def post_required_string_property(self, body_parameter: JSONType, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_string_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + def post_optional_string_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. :param body_parameter: @@ -1309,11 +1802,13 @@ def post_optional_string_property(self, body_parameter: JSONType = None, **kwarg "value": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1327,7 +1822,9 @@ def post_optional_string_property(self, body_parameter: JSONType = None, **kwarg request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1338,8 +1835,15 @@ def post_optional_string_property(self, body_parameter: JSONType = None, **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_string_header(self, *, header_parameter: str, **kwargs: Any) -> None: + def post_required_string_header( + self, + *, + header_parameter: str, + **kwargs: Any + ) -> None: """Test explicitly required string. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -1349,17 +1853,23 @@ def post_required_string_header(self, *, header_parameter: str, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_explicit_post_required_string_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1370,8 +1880,15 @@ def post_required_string_header(self, *, header_parameter: str, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_string_header(self, *, body_parameter: Optional[str] = None, **kwargs: Any) -> None: + def post_optional_string_header( + self, + *, + body_parameter: Optional[str] = None, + **kwargs: Any + ) -> None: """Test explicitly optional string. Please put a header 'headerParameter' => null. :keyword body_parameter: @@ -1380,17 +1897,23 @@ def post_optional_string_header(self, *, body_parameter: Optional[str] = None, * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_explicit_post_optional_string_header_request( body_parameter=body_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1401,8 +1924,14 @@ def post_optional_string_header(self, *, body_parameter: Optional[str] = None, * if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_class_parameter(self, body_parameter: JSONType, **kwargs: Any) -> None: + def post_required_class_parameter( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -1421,11 +1950,13 @@ def post_required_class_parameter(self, body_parameter: JSONType, **kwargs: Any) "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1436,7 +1967,9 @@ def post_required_class_parameter(self, body_parameter: JSONType, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1447,8 +1980,14 @@ def post_required_class_parameter(self, body_parameter: JSONType, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_class_parameter(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + def post_optional_class_parameter( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional complex object. Please put null. :param body_parameter: @@ -1466,11 +2005,13 @@ def post_optional_class_parameter(self, body_parameter: JSONType = None, **kwarg "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1484,7 +2025,9 @@ def post_optional_class_parameter(self, body_parameter: JSONType = None, **kwarg request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1495,8 +2038,14 @@ def post_optional_class_parameter(self, body_parameter: JSONType = None, **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_class_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + def post_required_class_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1517,11 +2066,13 @@ def post_required_class_property(self, body_parameter: JSONType, **kwargs: Any) } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1532,7 +2083,9 @@ def post_required_class_property(self, body_parameter: JSONType, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1543,8 +2096,14 @@ def post_required_class_property(self, body_parameter: JSONType, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_class_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + def post_optional_class_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. :param body_parameter: @@ -1564,11 +2123,13 @@ def post_optional_class_property(self, body_parameter: JSONType = None, **kwargs } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1582,7 +2143,9 @@ def post_optional_class_property(self, body_parameter: JSONType = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1593,8 +2156,14 @@ def post_optional_class_property(self, body_parameter: JSONType = None, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_array_parameter(self, body_parameter: List[str], **kwargs: Any) -> None: + def post_required_array_parameter( + self, + body_parameter: List[str], + **kwargs: Any + ) -> None: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -1612,11 +2181,13 @@ def post_required_array_parameter(self, body_parameter: List[str], **kwargs: Any "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1627,7 +2198,9 @@ def post_required_array_parameter(self, body_parameter: List[str], **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1638,8 +2211,14 @@ def post_required_array_parameter(self, body_parameter: List[str], **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_array_parameter(self, body_parameter: Optional[List[str]] = None, **kwargs: Any) -> None: + def post_optional_array_parameter( + self, + body_parameter: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Test explicitly optional array. Please put null. :param body_parameter: @@ -1656,11 +2235,13 @@ def post_optional_array_parameter(self, body_parameter: Optional[List[str]] = No "str" # Optional. ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1674,7 +2255,9 @@ def post_optional_array_parameter(self, body_parameter: Optional[List[str]] = No request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1685,8 +2268,14 @@ def post_optional_array_parameter(self, body_parameter: Optional[List[str]] = No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_array_property(self, body_parameter: JSONType, **kwargs: Any) -> None: + def post_required_array_property( + self, + body_parameter: JSONType, + **kwargs: Any + ) -> None: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1706,11 +2295,13 @@ def post_required_array_property(self, body_parameter: JSONType, **kwargs: Any) ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = body_parameter @@ -1721,7 +2312,9 @@ def post_required_array_property(self, body_parameter: JSONType, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1732,8 +2325,14 @@ def post_required_array_property(self, body_parameter: JSONType, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_array_property(self, body_parameter: JSONType = None, **kwargs: Any) -> None: + def post_optional_array_property( + self, + body_parameter: JSONType = None, + **kwargs: Any + ) -> None: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. :param body_parameter: @@ -1752,11 +2351,13 @@ def post_optional_array_property(self, body_parameter: JSONType = None, **kwargs ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body_parameter is not None: _json = body_parameter @@ -1770,7 +2371,9 @@ def post_optional_array_property(self, body_parameter: JSONType = None, **kwargs request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1781,8 +2384,15 @@ def post_optional_array_property(self, body_parameter: JSONType = None, **kwargs if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_required_array_header(self, *, header_parameter: List[str], **kwargs: Any) -> None: + def post_required_array_header( + self, + *, + header_parameter: List[str], + **kwargs: Any + ) -> None: """Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -1792,17 +2402,23 @@ def post_required_array_header(self, *, header_parameter: List[str], **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_explicit_post_required_array_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1813,8 +2429,15 @@ def post_required_array_header(self, *, header_parameter: List[str], **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_optional_array_header(self, *, header_parameter: Optional[List[str]] = None, **kwargs: Any) -> None: + def post_optional_array_header( + self, + *, + header_parameter: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Test explicitly optional integer. Please put a header 'headerParameter' => null. :keyword header_parameter: @@ -1823,17 +2446,23 @@ def post_optional_array_header(self, *, header_parameter: Optional[List[str]] = :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_explicit_post_optional_array_header_request( header_parameter=header_parameter, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1843,3 +2472,5 @@ def post_optional_array_header(self, *, header_parameter: Optional[List[str]] = if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py index b6d2db16006..835a295dbfa 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/__init__.py index eaeb1bc5c6d..db01ca1ca8b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["ReservedWordsClient"] +__all__ = ['ReservedWordsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_configuration.py index e6f40d7e00e..6d56a115447 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class ReservedWordsClientConfiguration(Configuration): # pylint: disable=too-ma attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ReservedWordsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "reservedwordsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'reservedwordsclient/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_reserved_words_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_reserved_words_client.py index 42fd1fa0db1..d3efb2dc1b3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_reserved_words_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_reserved_words_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ReservedWordsClient(ReservedWordsClientOperationsMixin): """Swagger that has operation groups etc. with reserved words. @@ -30,8 +29,13 @@ class ReservedWordsClient(ReservedWordsClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = ReservedWordsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.import_operations = ImportOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/__init__.py index fc28320f86d..b05173059c0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._reserved_words_client import ReservedWordsClient - -__all__ = ["ReservedWordsClient"] +__all__ = ['ReservedWordsClient'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_configuration.py index 14375a5d2f6..3219c3ec4f5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class ReservedWordsClientConfiguration(Configuration): # pylint: disable=too-ma attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(ReservedWordsClientConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "reservedwordsclient/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'reservedwordsclient/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_reserved_words_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_reserved_words_client.py index d7c48ad8817..d0d305055d9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_reserved_words_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_reserved_words_client.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class ReservedWordsClient(ReservedWordsClientOperationsMixin): """Swagger that has operation groups etc. with reserved words. @@ -30,7 +29,12 @@ class ReservedWordsClient(ReservedWordsClientOperationsMixin): :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = ReservedWordsClientConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.import_operations = ImportOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/__init__.py index dd92ae6521a..27dae880e1e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import ReservedWordsClientOperationsMixin __all__ = [ - "ImportOperations", - "ReservedWordsClientOperationsMixin", + 'ImportOperations', + 'ReservedWordsClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py index 211626ed4cc..2cb8c3eaac3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py @@ -8,31 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_import_builders_operation_one_request, - build_operation_with_content_param_request, - build_operation_with_data_param_request, - build_operation_with_files_param_request, - build_operation_with_json_param_request, -) - -T = TypeVar("T") +from ...operations._operations import build_import_builders_operation_one_request, build_operation_with_content_param_request, build_operation_with_data_param_request, build_operation_with_files_param_request, build_operation_with_json_param_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class ImportOperations: """ImportOperations async operations. @@ -52,7 +38,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def operation_one(self, *, parameter1: str, **kwargs: Any) -> Any: + async def operation_one( + self, + *, + parameter1: str, + **kwargs: Any + ) -> Any: """Operation in operation group import, a reserved word. :keyword parameter1: Pass in 'foo' to pass this test. @@ -61,17 +52,22 @@ async def operation_one(self, *, parameter1: str, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_import_builders_operation_one_request( parameter1=parameter1, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -91,8 +87,13 @@ async def operation_one(self, *, parameter1: str, **kwargs: Any) -> Any: class ReservedWordsClientOperationsMixin: + @distributed_trace_async - async def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: + async def operation_with_content_param( + self, + content: IO, + **kwargs: Any + ) -> Any: """Operation with body param called content. Pass in b'hello, world'. :param content: Pass in b'hello, world'. @@ -101,11 +102,13 @@ async def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = content @@ -116,7 +119,9 @@ async def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -134,8 +139,14 @@ async def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: + async def operation_with_json_param( + self, + json: Any, + **kwargs: Any + ) -> Any: """Operation with body param called 'json'. Pass in {'hello': 'world'}. :param json: Pass in {'hello': 'world'}. @@ -144,11 +155,13 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = json @@ -159,7 +172,9 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -177,8 +192,14 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: return deserialized + + @distributed_trace_async - async def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) -> Any: + async def operation_with_data_param( + self, + data: Dict[str, Any], + **kwargs: Any + ) -> Any: """Operation with urlencoded body param called 'data'. :param data: Form-encoded input for data. See the template in our example to find the input @@ -197,12 +218,15 @@ async def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) - "world": "str" # Pass in 'world'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + request = build_operation_with_data_param_request( content_type=content_type, data=data, @@ -210,7 +234,9 @@ async def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -228,8 +254,14 @@ async def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) - return deserialized + + @distributed_trace_async - async def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) -> Any: + async def operation_with_files_param( + self, + files: Dict[str, Any], + **kwargs: Any + ) -> Any: """Operation with multipart body param called 'files'. :param files: Multipart input for files. See the template in our example to find the input @@ -248,12 +280,15 @@ async def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) "files": b'bytes' # Files to upload. Pass in list of input streams. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] + request = build_operation_with_files_param_request( content_type=content_type, files=files, @@ -261,7 +296,9 @@ async def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -278,3 +315,5 @@ async def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/__init__.py index dd92ae6521a..27dae880e1e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/__init__.py @@ -10,6 +10,6 @@ from ._operations import ReservedWordsClientOperationsMixin __all__ = [ - "ImportOperations", - "ReservedWordsClientOperationsMixin", + 'ImportOperations', + 'ReservedWordsClientOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py index 3231e1cbda1..36b9c549732 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py @@ -8,112 +8,153 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, IO, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_import_builders_operation_one_request(*, parameter1: str, **kwargs: Any) -> HttpRequest: +def build_import_builders_operation_one_request( + *, + parameter1: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/reservedWords/operationGroup/import" + url = '/reservedWords/operationGroup/import' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["parameter1"] = _SERIALIZER.query("parameter1", parameter1, "str") + query_parameters['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_operation_with_content_param_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_operation_with_content_param_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/content" + url = '/reservedWords/operation/content' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) def build_operation_with_json_param_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/json" + url = '/reservedWords/operation/json' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) def build_operation_with_data_param_request( - *, data: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + data: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/data" + url = '/reservedWords/operation/data' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, data=data, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + data=data, + content=content, + **kwargs + ) def build_operation_with_files_param_request( - *, files: Optional[Dict[str, Any]] = None, content: Any = None, **kwargs: Any + *, + files: Optional[Dict[str, Any]] = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/reservedWords/operation/files" + url = '/reservedWords/operation/files' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, files=files, content=content, **kwargs) - + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + files=files, + content=content, + **kwargs + ) class ImportOperations(object): """ImportOperations operations. @@ -134,7 +175,12 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def operation_one(self, *, parameter1: str, **kwargs: Any) -> Any: + def operation_one( + self, + *, + parameter1: str, + **kwargs: Any + ) -> Any: """Operation in operation group import, a reserved word. :keyword parameter1: Pass in 'foo' to pass this test. @@ -143,17 +189,23 @@ def operation_one(self, *, parameter1: str, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_import_builders_operation_one_request( parameter1=parameter1, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -173,8 +225,13 @@ def operation_one(self, *, parameter1: str, **kwargs: Any) -> Any: class ReservedWordsClientOperationsMixin(object): + @distributed_trace - def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: + def operation_with_content_param( + self, + content: IO, + **kwargs: Any + ) -> Any: """Operation with body param called content. Pass in b'hello, world'. :param content: Pass in b'hello, world'. @@ -183,11 +240,13 @@ def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/octet-stream") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] _content = content @@ -198,7 +257,9 @@ def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -216,8 +277,14 @@ def operation_with_content_param(self, content: IO, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: + def operation_with_json_param( + self, + json: Any, + **kwargs: Any + ) -> Any: """Operation with body param called 'json'. Pass in {'hello': 'world'}. :param json: Pass in {'hello': 'world'}. @@ -226,11 +293,13 @@ def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = json @@ -241,7 +310,9 @@ def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -259,8 +330,14 @@ def operation_with_json_param(self, json: Any, **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) -> Any: + def operation_with_data_param( + self, + data: Dict[str, Any], + **kwargs: Any + ) -> Any: """Operation with urlencoded body param called 'data'. :param data: Form-encoded input for data. See the template in our example to find the input @@ -279,12 +356,15 @@ def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) -> Any: "world": "str" # Pass in 'world'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/x-www-form-urlencoded") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/x-www-form-urlencoded") # type: Optional[str] + request = build_operation_with_data_param_request( content_type=content_type, data=data, @@ -292,7 +372,9 @@ def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) -> Any: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -310,8 +392,14 @@ def operation_with_data_param(self, data: Dict[str, Any], **kwargs: Any) -> Any: return deserialized + + @distributed_trace - def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) -> Any: + def operation_with_files_param( + self, + files: Dict[str, Any], + **kwargs: Any + ) -> Any: """Operation with multipart body param called 'files'. :param files: Multipart input for files. See the template in our example to find the input @@ -330,12 +418,15 @@ def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) -> An "files": b'bytes' # Files to upload. Pass in list of input streams. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[Any] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", None) # type: Optional[str] + content_type = kwargs.pop('content_type', None) # type: Optional[str] + request = build_operation_with_files_param_request( content_type=content_type, files=files, @@ -343,7 +434,9 @@ def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) -> An request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -360,3 +453,5 @@ def operation_with_files_param(self, files: Dict[str, Any], **kwargs: Any) -> An return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py index 938b1069b30..f2973a2700c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Swagger that has operation groups etc. with reserved words. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py index 8c5a64d2402..1a1b2e567d4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/__init__.py index 4126273e3d8..4681c978cb1 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestUrlMutliCollectionFormatTestService"] +__all__ = ['AutoRestUrlMutliCollectionFormatTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_auto_rest_url_mutli_collection_format_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_auto_rest_url_mutli_collection_format_test_service.py index f605a2ddaf0..db902940104 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_auto_rest_url_mutli_collection_format_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_auto_rest_url_mutli_collection_format_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlMutliCollectionFormatTestService: """Test Infrastructure for AutoRest. @@ -30,8 +29,13 @@ class AutoRestUrlMutliCollectionFormatTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestUrlMutliCollectionFormatTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_configuration.py index 651fc8e1c1a..a1823a406ad 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_configuration.py @@ -14,31 +14,33 @@ from ._version import VERSION -class AutoRestUrlMutliCollectionFormatTestServiceConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlMutliCollectionFormatTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestUrlMutliCollectionFormatTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresturlmutlicollectionformattestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturlmutlicollectionformattestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/__init__.py index dc51912a904..2116fb21264 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_url_mutli_collection_format_test_service import AutoRestUrlMutliCollectionFormatTestService - -__all__ = ["AutoRestUrlMutliCollectionFormatTestService"] +__all__ = ['AutoRestUrlMutliCollectionFormatTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_auto_rest_url_mutli_collection_format_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_auto_rest_url_mutli_collection_format_test_service.py index 9476b20be5b..121a1fcca78 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_auto_rest_url_mutli_collection_format_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_auto_rest_url_mutli_collection_format_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlMutliCollectionFormatTestService: """Test Infrastructure for AutoRest. @@ -30,7 +29,12 @@ class AutoRestUrlMutliCollectionFormatTestService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestUrlMutliCollectionFormatTestServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_configuration.py index 51186d27106..2e326f2c85b 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_configuration.py @@ -14,28 +14,32 @@ from .._version import VERSION -class AutoRestUrlMutliCollectionFormatTestServiceConfiguration( - Configuration -): # pylint: disable=too-many-instance-attributes +class AutoRestUrlMutliCollectionFormatTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestUrlMutliCollectionFormatTestService. Note that all parameters used to create this instance are saved as instance attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestUrlMutliCollectionFormatTestServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autoresturlmutlicollectionformattestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturlmutlicollectionformattestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/__init__.py index ca8f6a87105..5ad41a63a64 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import QueriesOperations __all__ = [ - "QueriesOperations", + 'QueriesOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py index 758c2261079..9790ce63bf4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py @@ -8,28 +8,16 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_queries_array_string_multi_empty_request, - build_queries_array_string_multi_null_request, - build_queries_array_string_multi_valid_request, -) - -T = TypeVar("T") +from ...operations._operations import build_queries_array_string_multi_empty_request, build_queries_array_string_multi_null_request, build_queries_array_string_multi_valid_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class QueriesOperations: """QueriesOperations async operations. @@ -49,7 +37,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def array_string_multi_null(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_multi_null( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get a null array of string using the multi-array format. :keyword array_query: a null array of string using the multi-array format. @@ -58,17 +51,22 @@ async def array_string_multi_null(self, *, array_query: Optional[List[str]] = No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_multi_null_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -79,8 +77,15 @@ async def array_string_multi_null(self, *, array_query: Optional[List[str]] = No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_multi_empty(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_multi_empty( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an empty array [] of string using the multi-array format. :keyword array_query: an empty array [] of string using the multi-array format. @@ -89,17 +94,22 @@ async def array_string_multi_empty(self, *, array_query: Optional[List[str]] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_multi_empty_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -110,8 +120,15 @@ async def array_string_multi_empty(self, *, array_query: Optional[List[str]] = N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_multi_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_multi_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the mult-array format. @@ -122,17 +139,22 @@ async def array_string_multi_valid(self, *, array_query: Optional[List[str]] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_multi_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -142,3 +164,5 @@ async def array_string_multi_valid(self, *, array_query: Optional[List[str]] = N if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/__init__.py index ca8f6a87105..5ad41a63a64 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import QueriesOperations __all__ = [ - "QueriesOperations", + 'QueriesOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py index 2dcebcb7c17..b3752a1464e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py @@ -8,88 +8,97 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - def build_queries_array_string_multi_null_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/multi/string/null" + url = '/queries/array/multi/string/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = [ - _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query - ] + query_parameters['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_multi_empty_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/multi/string/empty" + url = '/queries/array/multi/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = [ - _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query - ] + query_parameters['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_multi_valid_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/multi/string/valid" + url = '/queries/array/multi/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = [ - _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query - ] + query_parameters['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class QueriesOperations(object): """QueriesOperations operations. @@ -110,7 +119,12 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def array_string_multi_null(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_multi_null( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get a null array of string using the multi-array format. :keyword array_query: a null array of string using the multi-array format. @@ -119,17 +133,23 @@ def array_string_multi_null(self, *, array_query: Optional[List[str]] = None, ** :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_multi_null_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -140,8 +160,15 @@ def array_string_multi_null(self, *, array_query: Optional[List[str]] = None, ** if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_multi_empty(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_multi_empty( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an empty array [] of string using the multi-array format. :keyword array_query: an empty array [] of string using the multi-array format. @@ -150,17 +177,23 @@ def array_string_multi_empty(self, *, array_query: Optional[List[str]] = None, * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_multi_empty_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -171,8 +204,15 @@ def array_string_multi_empty(self, *, array_query: Optional[List[str]] = None, * if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_multi_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_multi_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the mult-array format. @@ -183,17 +223,23 @@ def array_string_multi_valid(self, *, array_query: Optional[List[str]] = None, * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_multi_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -203,3 +249,5 @@ def array_string_multi_valid(self, *, array_query: Optional[List[str]] = None, * if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py index 3eeeb1be90b..7b354e37d86 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/__init__.py index 56522eab3d5..e9117c1dd2d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestUrlTestService"] +__all__ = ['AutoRestUrlTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_auto_rest_url_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_auto_rest_url_test_service.py index 07fc0a6eb6f..2d8b37cdffa 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_auto_rest_url_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_auto_rest_url_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlTestService: """Test Infrastructure for AutoRest. @@ -46,10 +45,8 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - - self._config = AutoRestUrlTestServiceConfiguration( - global_string_path=global_string_path, global_string_query=global_string_query, **kwargs - ) + + self._config = AutoRestUrlTestServiceConfiguration(global_string_path=global_string_path, global_string_query=global_string_query, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -58,6 +55,7 @@ def __init__( self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) self.path_items = PathItemsOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_configuration.py index d2b30d23315..a616d3b9c98 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_configuration.py @@ -26,26 +26,32 @@ class AutoRestUrlTestServiceConfiguration(Configuration): # pylint: disable=too :type global_string_query: str """ - def __init__(self, global_string_path: str, global_string_query: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + global_string_path: str, + global_string_query: Optional[str] = None, + **kwargs: Any + ) -> None: super(AutoRestUrlTestServiceConfiguration, self).__init__(**kwargs) if global_string_path is None: raise ValueError("Parameter 'global_string_path' must not be None.") self.global_string_path = global_string_path self.global_string_query = global_string_query - kwargs.setdefault("sdk_moniker", "autoresturltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturltestservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/__init__.py index 451dfcc7fc1..a9ed709fa25 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_url_test_service import AutoRestUrlTestService - -__all__ = ["AutoRestUrlTestService"] +__all__ = ['AutoRestUrlTestService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_auto_rest_url_test_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_auto_rest_url_test_service.py index 2cee5e2261e..3149d1caddb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_auto_rest_url_test_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_auto_rest_url_test_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestUrlTestService: """Test Infrastructure for AutoRest. @@ -46,9 +45,7 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestUrlTestServiceConfiguration( - global_string_path=global_string_path, global_string_query=global_string_query, **kwargs - ) + self._config = AutoRestUrlTestServiceConfiguration(global_string_path=global_string_path, global_string_query=global_string_query, **kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() @@ -57,7 +54,12 @@ def __init__( self.queries = QueriesOperations(self._client, self._config, self._serialize, self._deserialize) self.path_items = PathItemsOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_configuration.py index 48b8c2ec5b0..2fa1227f947 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_configuration.py @@ -26,23 +26,31 @@ class AutoRestUrlTestServiceConfiguration(Configuration): # pylint: disable=too :type global_string_query: str """ - def __init__(self, global_string_path: str, global_string_query: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + global_string_path: str, + global_string_query: Optional[str] = None, + **kwargs: Any + ) -> None: super(AutoRestUrlTestServiceConfiguration, self).__init__(**kwargs) if global_string_path is None: raise ValueError("Parameter 'global_string_path' must not be None.") self.global_string_path = global_string_path self.global_string_query = global_string_query - kwargs.setdefault("sdk_moniker", "autoresturltestservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autoresturltestservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/__init__.py index 8489b88debe..5e955f3433a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/__init__.py @@ -11,7 +11,7 @@ from ._operations import PathItemsOperations __all__ = [ - "PathsOperations", - "QueriesOperations", - "PathItemsOperations", + 'PathsOperations', + 'QueriesOperations', + 'PathItemsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py index ad6369a98a0..d5ed9303f55 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py @@ -9,91 +9,16 @@ import datetime from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_path_items_get_all_with_values_request, - build_path_items_get_global_and_local_query_null_request, - build_path_items_get_global_query_null_request, - build_path_items_get_local_path_item_query_null_request, - build_paths_array_csv_in_path_request, - build_paths_base64_url_request, - build_paths_byte_empty_request, - build_paths_byte_multi_byte_request, - build_paths_byte_null_request, - build_paths_date_null_request, - build_paths_date_time_null_request, - build_paths_date_time_valid_request, - build_paths_date_valid_request, - build_paths_double_decimal_negative_request, - build_paths_double_decimal_positive_request, - build_paths_enum_null_request, - build_paths_enum_valid_request, - build_paths_float_scientific_negative_request, - build_paths_float_scientific_positive_request, - build_paths_get_boolean_false_request, - build_paths_get_boolean_true_request, - build_paths_get_int_negative_one_million_request, - build_paths_get_int_one_million_request, - build_paths_get_negative_ten_billion_request, - build_paths_get_ten_billion_request, - build_paths_string_empty_request, - build_paths_string_null_request, - build_paths_string_unicode_request, - build_paths_string_url_encoded_request, - build_paths_string_url_non_encoded_request, - build_paths_unix_time_url_request, - build_queries_array_string_csv_empty_request, - build_queries_array_string_csv_null_request, - build_queries_array_string_csv_valid_request, - build_queries_array_string_no_collection_format_empty_request, - build_queries_array_string_pipes_valid_request, - build_queries_array_string_ssv_valid_request, - build_queries_array_string_tsv_valid_request, - build_queries_byte_empty_request, - build_queries_byte_multi_byte_request, - build_queries_byte_null_request, - build_queries_date_null_request, - build_queries_date_time_null_request, - build_queries_date_time_valid_request, - build_queries_date_valid_request, - build_queries_double_decimal_negative_request, - build_queries_double_decimal_positive_request, - build_queries_double_null_request, - build_queries_enum_null_request, - build_queries_enum_valid_request, - build_queries_float_null_request, - build_queries_float_scientific_negative_request, - build_queries_float_scientific_positive_request, - build_queries_get_boolean_false_request, - build_queries_get_boolean_null_request, - build_queries_get_boolean_true_request, - build_queries_get_int_negative_one_million_request, - build_queries_get_int_null_request, - build_queries_get_int_one_million_request, - build_queries_get_long_null_request, - build_queries_get_negative_ten_billion_request, - build_queries_get_ten_billion_request, - build_queries_string_empty_request, - build_queries_string_null_request, - build_queries_string_unicode_request, - build_queries_string_url_encoded_request, -) - -T = TypeVar("T") +from ...operations._operations import build_path_items_get_all_with_values_request, build_path_items_get_global_and_local_query_null_request, build_path_items_get_global_query_null_request, build_path_items_get_local_path_item_query_null_request, build_paths_array_csv_in_path_request, build_paths_base64_url_request, build_paths_byte_empty_request, build_paths_byte_multi_byte_request, build_paths_byte_null_request, build_paths_date_null_request, build_paths_date_time_null_request, build_paths_date_time_valid_request, build_paths_date_valid_request, build_paths_double_decimal_negative_request, build_paths_double_decimal_positive_request, build_paths_enum_null_request, build_paths_enum_valid_request, build_paths_float_scientific_negative_request, build_paths_float_scientific_positive_request, build_paths_get_boolean_false_request, build_paths_get_boolean_true_request, build_paths_get_int_negative_one_million_request, build_paths_get_int_one_million_request, build_paths_get_negative_ten_billion_request, build_paths_get_ten_billion_request, build_paths_string_empty_request, build_paths_string_null_request, build_paths_string_unicode_request, build_paths_string_url_encoded_request, build_paths_string_url_non_encoded_request, build_paths_unix_time_url_request, build_queries_array_string_csv_empty_request, build_queries_array_string_csv_null_request, build_queries_array_string_csv_valid_request, build_queries_array_string_no_collection_format_empty_request, build_queries_array_string_pipes_valid_request, build_queries_array_string_ssv_valid_request, build_queries_array_string_tsv_valid_request, build_queries_byte_empty_request, build_queries_byte_multi_byte_request, build_queries_byte_null_request, build_queries_date_null_request, build_queries_date_time_null_request, build_queries_date_time_valid_request, build_queries_date_valid_request, build_queries_double_decimal_negative_request, build_queries_double_decimal_positive_request, build_queries_double_null_request, build_queries_enum_null_request, build_queries_enum_valid_request, build_queries_float_null_request, build_queries_float_scientific_negative_request, build_queries_float_scientific_positive_request, build_queries_get_boolean_false_request, build_queries_get_boolean_null_request, build_queries_get_boolean_true_request, build_queries_get_int_negative_one_million_request, build_queries_get_int_null_request, build_queries_get_int_one_million_request, build_queries_get_long_null_request, build_queries_get_negative_ten_billion_request, build_queries_get_ten_billion_request, build_queries_string_empty_request, build_queries_string_null_request, build_queries_string_unicode_request, build_queries_string_url_encoded_request +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PathsOperations: # pylint: disable=too-many-public-methods """PathsOperations async operations. @@ -113,7 +38,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_boolean_true(self, **kwargs: Any) -> None: + async def get_boolean_true( + self, + **kwargs: Any + ) -> None: """Get true Boolean value on path. :keyword bool_path: true boolean value. The default value is True. Note that overriding this @@ -123,19 +51,24 @@ async def get_boolean_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", True) # type: bool + bool_path = kwargs.pop('bool_path', True) # type: bool + request = build_paths_get_boolean_true_request( bool_path=bool_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -146,8 +79,13 @@ async def get_boolean_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_boolean_false(self, **kwargs: Any) -> None: + async def get_boolean_false( + self, + **kwargs: Any + ) -> None: """Get false Boolean value on path. :keyword bool_path: false boolean value. The default value is False. Note that overriding this @@ -157,19 +95,24 @@ async def get_boolean_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", False) # type: bool + bool_path = kwargs.pop('bool_path', False) # type: bool + request = build_paths_get_boolean_false_request( bool_path=bool_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -180,8 +123,13 @@ async def get_boolean_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_int_one_million(self, **kwargs: Any) -> None: + async def get_int_one_million( + self, + **kwargs: Any + ) -> None: """Get '1000000' integer value. :keyword int_path: '1000000' integer value. The default value is 1000000. Note that overriding @@ -191,19 +139,24 @@ async def get_int_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", 1000000) # type: int + int_path = kwargs.pop('int_path', 1000000) # type: int + request = build_paths_get_int_one_million_request( int_path=int_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -214,8 +167,13 @@ async def get_int_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_int_negative_one_million(self, **kwargs: Any) -> None: + async def get_int_negative_one_million( + self, + **kwargs: Any + ) -> None: """Get '-1000000' integer value. :keyword int_path: '-1000000' integer value. The default value is -1000000. Note that @@ -225,19 +183,24 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", -1000000) # type: int + int_path = kwargs.pop('int_path', -1000000) # type: int + request = build_paths_get_int_negative_one_million_request( int_path=int_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -248,8 +211,13 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_ten_billion(self, **kwargs: Any) -> None: + async def get_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '10000000000' 64 bit integer value. :keyword long_path: '10000000000' 64 bit integer value. The default value is 10000000000. Note @@ -259,19 +227,24 @@ async def get_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", 10000000000) # type: int + long_path = kwargs.pop('long_path', 10000000000) # type: int + request = build_paths_get_ten_billion_request( long_path=long_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -282,8 +255,13 @@ async def get_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_negative_ten_billion(self, **kwargs: Any) -> None: + async def get_negative_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '-10000000000' 64 bit integer value. :keyword long_path: '-10000000000' 64 bit integer value. The default value is -10000000000. @@ -293,19 +271,24 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", -10000000000) # type: int + long_path = kwargs.pop('long_path', -10000000000) # type: int + request = build_paths_get_negative_ten_billion_request( long_path=long_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -316,8 +299,13 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def float_scientific_positive(self, **kwargs: Any) -> None: + async def float_scientific_positive( + self, + **kwargs: Any + ) -> None: """Get '1.034E+20' numeric value. :keyword float_path: '1.034E+20'numeric value. The default value is 103400000000000000000. Note @@ -327,19 +315,24 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", 103400000000000000000) # type: float + float_path = kwargs.pop('float_path', 103400000000000000000) # type: float + request = build_paths_float_scientific_positive_request( float_path=float_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -350,8 +343,13 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def float_scientific_negative(self, **kwargs: Any) -> None: + async def float_scientific_negative( + self, + **kwargs: Any + ) -> None: """Get '-1.034E-20' numeric value. :keyword float_path: '-1.034E-20'numeric value. The default value is -1.034e-20. Note that @@ -361,19 +359,24 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", -1.034e-20) # type: float + float_path = kwargs.pop('float_path', -1.034e-20) # type: float + request = build_paths_float_scientific_negative_request( float_path=float_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -384,8 +387,13 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def double_decimal_positive(self, **kwargs: Any) -> None: + async def double_decimal_positive( + self, + **kwargs: Any + ) -> None: """Get '9999999.999' numeric value. :keyword double_path: '9999999.999'numeric value. The default value is 9999999.999. Note that @@ -395,19 +403,24 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", 9999999.999) # type: float + double_path = kwargs.pop('double_path', 9999999.999) # type: float + request = build_paths_double_decimal_positive_request( double_path=double_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -418,8 +431,13 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def double_decimal_negative(self, **kwargs: Any) -> None: + async def double_decimal_negative( + self, + **kwargs: Any + ) -> None: """Get '-9999999.999' numeric value. :keyword double_path: '-9999999.999'numeric value. The default value is -9999999.999. Note that @@ -429,19 +447,24 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", -9999999.999) # type: float + double_path = kwargs.pop('double_path', -9999999.999) # type: float + request = build_paths_double_decimal_negative_request( double_path=double_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -452,8 +475,13 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_unicode(self, **kwargs: Any) -> None: + async def string_unicode( + self, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. :keyword string_path: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. The default value is "啊齄丂狛狜隣郎隣兀﨩". @@ -463,19 +491,24 @@ async def string_unicode(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_paths_string_unicode_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -486,8 +519,13 @@ async def string_unicode(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_url_encoded(self, **kwargs: Any) -> None: + async def string_url_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@ &=+$,/?#[]end. :keyword string_path: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. The default value @@ -498,19 +536,24 @@ async def string_url_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_paths_string_url_encoded_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -521,8 +564,13 @@ async def string_url_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_url_non_encoded(self, **kwargs: Any) -> None: + async def string_url_non_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@&=+$,end. https://tools.ietf.org/html/rfc3986#appendix-A 'path' accept any 'pchar' not encoded. @@ -535,19 +583,24 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@&=+$,end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str + request = build_paths_string_url_non_encoded_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -558,8 +611,13 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_empty(self, **kwargs: Any) -> None: + async def string_empty( + self, + **kwargs: Any + ) -> None: """Get ''. :keyword string_path: '' string value. The default value is "". Note that overriding this @@ -569,19 +627,24 @@ async def string_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "") # type: str + string_path = kwargs.pop('string_path', "") # type: str + request = build_paths_string_empty_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -592,8 +655,14 @@ async def string_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_null(self, string_path: str, **kwargs: Any) -> None: + async def string_null( + self, + string_path: str, + **kwargs: Any + ) -> None: """Get null (should throw). :param string_path: null string value. @@ -602,17 +671,22 @@ async def string_null(self, string_path: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_string_null_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -623,8 +697,14 @@ async def string_null(self, string_path: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def enum_valid(self, enum_path: str, **kwargs: Any) -> None: + async def enum_valid( + self, + enum_path: str, + **kwargs: Any + ) -> None: """Get using uri with 'green color' in path parameter. :param enum_path: send the value green. Possible values are: "red color", "green color", and @@ -634,17 +714,22 @@ async def enum_valid(self, enum_path: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_enum_valid_request( enum_path=enum_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -655,8 +740,14 @@ async def enum_valid(self, enum_path: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def enum_null(self, enum_path: str, **kwargs: Any) -> None: + async def enum_null( + self, + enum_path: str, + **kwargs: Any + ) -> None: """Get null (should throw on the client before the request is sent on wire). :param enum_path: send null should throw. Possible values are: "red color", "green color", and @@ -666,17 +757,22 @@ async def enum_null(self, enum_path: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_enum_null_request( enum_path=enum_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -687,8 +783,14 @@ async def enum_null(self, enum_path: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: + async def byte_multi_byte( + self, + byte_path: bytearray, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. :param byte_path: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. @@ -697,17 +799,22 @@ async def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_byte_multi_byte_request( byte_path=byte_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -718,8 +825,13 @@ async def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def byte_empty(self, **kwargs: Any) -> None: + async def byte_empty( + self, + **kwargs: Any + ) -> None: """Get '' as byte array. :keyword byte_path: '' as byte array. The default value is bytearray("", encoding="utf-8"). @@ -729,19 +841,24 @@ async def byte_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_path = kwargs.pop("byte_path", bytearray("", encoding="utf-8")) # type: bytearray + byte_path = kwargs.pop('byte_path', bytearray("", encoding="utf-8")) # type: bytearray + request = build_paths_byte_empty_request( byte_path=byte_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -752,8 +869,14 @@ async def byte_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: + async def byte_null( + self, + byte_path: bytearray, + **kwargs: Any + ) -> None: """Get null as byte array (should throw). :param byte_path: null as byte array (should throw). @@ -762,17 +885,22 @@ async def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_byte_null_request( byte_path=byte_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -783,8 +911,13 @@ async def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_valid(self, **kwargs: Any) -> None: + async def date_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01' as date. :keyword date_path: '2012-01-01' as date. The default value is "2012-01-01". Note that @@ -794,19 +927,24 @@ async def date_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_path = kwargs.pop("date_path", "2012-01-01") # type: datetime.date + date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date + request = build_paths_date_valid_request( date_path=date_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -817,8 +955,14 @@ async def date_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: + async def date_null( + self, + date_path: datetime.date, + **kwargs: Any + ) -> None: """Get null as date - this should throw or be unusable on the client side, depending on date representation. @@ -828,17 +972,22 @@ async def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_date_null_request( date_path=date_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -849,8 +998,13 @@ async def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_time_valid(self, **kwargs: Any) -> None: + async def date_time_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01T01:01:01Z' as date-time. :keyword date_time_path: '2012-01-01T01:01:01Z' as date-time. The default value is @@ -861,19 +1015,24 @@ async def date_time_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_path = kwargs.pop("date_time_path", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_paths_date_time_valid_request( date_time_path=date_time_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -884,8 +1043,14 @@ async def date_time_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) -> None: + async def date_time_null( + self, + date_time_path: datetime.datetime, + **kwargs: Any + ) -> None: """Get null as date-time, should be disallowed or throw depending on representation of date-time. :param date_time_path: null as date-time. @@ -894,17 +1059,22 @@ async def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_date_time_null_request( date_time_path=date_time_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -915,8 +1085,14 @@ async def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: + async def base64_url( + self, + base64_url_path: bytes, + **kwargs: Any + ) -> None: """Get 'lorem' encoded value as 'bG9yZW0' (base64url). :param base64_url_path: base64url encoded value. @@ -925,17 +1101,22 @@ async def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_base64_url_request( base64_url_path=base64_url_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -946,8 +1127,14 @@ async def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: + async def array_csv_in_path( + self, + array_path: List[str], + **kwargs: Any + ) -> None: """Get an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -958,17 +1145,22 @@ async def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_array_csv_in_path_request( array_path=array_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -979,8 +1171,14 @@ async def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def unix_time_url(self, unix_time_url_path: datetime.datetime, **kwargs: Any) -> None: + async def unix_time_url( + self, + unix_time_url_path: datetime.datetime, + **kwargs: Any + ) -> None: """Get the date 2016-04-13 encoded value as '1460505600' (Unix time). :param unix_time_url_path: Unix time encoded value. @@ -989,17 +1187,22 @@ async def unix_time_url(self, unix_time_url_path: datetime.datetime, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_unix_time_url_request( unix_time_url_path=unix_time_url_path, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1030,7 +1233,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_boolean_true(self, **kwargs: Any) -> None: + async def get_boolean_true( + self, + **kwargs: Any + ) -> None: """Get true Boolean value on path. :keyword bool_query: true boolean value. The default value is True. Note that overriding this @@ -1040,19 +1246,24 @@ async def get_boolean_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", True) # type: bool + bool_query = kwargs.pop('bool_query', True) # type: bool + request = build_queries_get_boolean_true_request( bool_query=bool_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1063,8 +1274,13 @@ async def get_boolean_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_boolean_false(self, **kwargs: Any) -> None: + async def get_boolean_false( + self, + **kwargs: Any + ) -> None: """Get false Boolean value on path. :keyword bool_query: false boolean value. The default value is False. Note that overriding this @@ -1074,19 +1290,24 @@ async def get_boolean_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", False) # type: bool + bool_query = kwargs.pop('bool_query', False) # type: bool + request = build_queries_get_boolean_false_request( bool_query=bool_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1097,8 +1318,15 @@ async def get_boolean_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_boolean_null(self, *, bool_query: Optional[bool] = None, **kwargs: Any) -> None: + async def get_boolean_null( + self, + *, + bool_query: Optional[bool] = None, + **kwargs: Any + ) -> None: """Get null Boolean value on query (query string should be absent). :keyword bool_query: null boolean value. @@ -1107,17 +1335,22 @@ async def get_boolean_null(self, *, bool_query: Optional[bool] = None, **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_get_boolean_null_request( bool_query=bool_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1128,8 +1361,13 @@ async def get_boolean_null(self, *, bool_query: Optional[bool] = None, **kwargs: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_int_one_million(self, **kwargs: Any) -> None: + async def get_int_one_million( + self, + **kwargs: Any + ) -> None: """Get '1000000' integer value. :keyword int_query: '1000000' integer value. The default value is 1000000. Note that overriding @@ -1139,19 +1377,24 @@ async def get_int_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", 1000000) # type: int + int_query = kwargs.pop('int_query', 1000000) # type: int + request = build_queries_get_int_one_million_request( int_query=int_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1162,8 +1405,13 @@ async def get_int_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_int_negative_one_million(self, **kwargs: Any) -> None: + async def get_int_negative_one_million( + self, + **kwargs: Any + ) -> None: """Get '-1000000' integer value. :keyword int_query: '-1000000' integer value. The default value is -1000000. Note that @@ -1173,19 +1421,24 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", -1000000) # type: int + int_query = kwargs.pop('int_query', -1000000) # type: int + request = build_queries_get_int_negative_one_million_request( int_query=int_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1196,8 +1449,15 @@ async def get_int_negative_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_int_null(self, *, int_query: Optional[int] = None, **kwargs: Any) -> None: + async def get_int_null( + self, + *, + int_query: Optional[int] = None, + **kwargs: Any + ) -> None: """Get null integer value (no query parameter). :keyword int_query: null integer value. @@ -1206,17 +1466,22 @@ async def get_int_null(self, *, int_query: Optional[int] = None, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_get_int_null_request( int_query=int_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1227,8 +1492,13 @@ async def get_int_null(self, *, int_query: Optional[int] = None, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_ten_billion(self, **kwargs: Any) -> None: + async def get_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '10000000000' 64 bit integer value. :keyword long_query: '10000000000' 64 bit integer value. The default value is 10000000000. Note @@ -1238,19 +1508,24 @@ async def get_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", 10000000000) # type: int + long_query = kwargs.pop('long_query', 10000000000) # type: int + request = build_queries_get_ten_billion_request( long_query=long_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1261,8 +1536,13 @@ async def get_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_negative_ten_billion(self, **kwargs: Any) -> None: + async def get_negative_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '-10000000000' 64 bit integer value. :keyword long_query: '-10000000000' 64 bit integer value. The default value is -10000000000. @@ -1272,19 +1552,24 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", -10000000000) # type: int + long_query = kwargs.pop('long_query', -10000000000) # type: int + request = build_queries_get_negative_ten_billion_request( long_query=long_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1295,8 +1580,15 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_long_null(self, *, long_query: Optional[int] = None, **kwargs: Any) -> None: + async def get_long_null( + self, + *, + long_query: Optional[int] = None, + **kwargs: Any + ) -> None: """Get 'null 64 bit integer value (no query param in uri). :keyword long_query: null 64 bit integer value. @@ -1305,17 +1597,22 @@ async def get_long_null(self, *, long_query: Optional[int] = None, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_get_long_null_request( long_query=long_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1326,8 +1623,13 @@ async def get_long_null(self, *, long_query: Optional[int] = None, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def float_scientific_positive(self, **kwargs: Any) -> None: + async def float_scientific_positive( + self, + **kwargs: Any + ) -> None: """Get '1.034E+20' numeric value. :keyword float_query: '1.034E+20'numeric value. The default value is 103400000000000000000. @@ -1337,19 +1639,24 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", 103400000000000000000) # type: float + float_query = kwargs.pop('float_query', 103400000000000000000) # type: float + request = build_queries_float_scientific_positive_request( float_query=float_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1360,8 +1667,13 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def float_scientific_negative(self, **kwargs: Any) -> None: + async def float_scientific_negative( + self, + **kwargs: Any + ) -> None: """Get '-1.034E-20' numeric value. :keyword float_query: '-1.034E-20'numeric value. The default value is -1.034e-20. Note that @@ -1371,19 +1683,24 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", -1.034e-20) # type: float + float_query = kwargs.pop('float_query', -1.034e-20) # type: float + request = build_queries_float_scientific_negative_request( float_query=float_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1394,8 +1711,15 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def float_null(self, *, float_query: Optional[float] = None, **kwargs: Any) -> None: + async def float_null( + self, + *, + float_query: Optional[float] = None, + **kwargs: Any + ) -> None: """Get null numeric value (no query parameter). :keyword float_query: null numeric value. @@ -1404,17 +1728,22 @@ async def float_null(self, *, float_query: Optional[float] = None, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_float_null_request( float_query=float_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1425,8 +1754,13 @@ async def float_null(self, *, float_query: Optional[float] = None, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def double_decimal_positive(self, **kwargs: Any) -> None: + async def double_decimal_positive( + self, + **kwargs: Any + ) -> None: """Get '9999999.999' numeric value. :keyword double_query: '9999999.999'numeric value. The default value is 9999999.999. Note that @@ -1436,19 +1770,24 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", 9999999.999) # type: float + double_query = kwargs.pop('double_query', 9999999.999) # type: float + request = build_queries_double_decimal_positive_request( double_query=double_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1459,8 +1798,13 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def double_decimal_negative(self, **kwargs: Any) -> None: + async def double_decimal_negative( + self, + **kwargs: Any + ) -> None: """Get '-9999999.999' numeric value. :keyword double_query: '-9999999.999'numeric value. The default value is -9999999.999. Note @@ -1470,19 +1814,24 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", -9999999.999) # type: float + double_query = kwargs.pop('double_query', -9999999.999) # type: float + request = build_queries_double_decimal_negative_request( double_query=double_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1493,8 +1842,15 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def double_null(self, *, double_query: Optional[float] = None, **kwargs: Any) -> None: + async def double_null( + self, + *, + double_query: Optional[float] = None, + **kwargs: Any + ) -> None: """Get null numeric value (no query parameter). :keyword double_query: null numeric value. @@ -1503,17 +1859,22 @@ async def double_null(self, *, double_query: Optional[float] = None, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_double_null_request( double_query=double_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1524,8 +1885,13 @@ async def double_null(self, *, double_query: Optional[float] = None, **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_unicode(self, **kwargs: Any) -> None: + async def string_unicode( + self, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. :keyword string_query: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. The default value is "啊齄丂狛狜隣郎隣兀﨩". @@ -1535,19 +1901,24 @@ async def string_unicode(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_query = kwargs.pop('string_query', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_queries_string_unicode_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1558,8 +1929,13 @@ async def string_unicode(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_url_encoded(self, **kwargs: Any) -> None: + async def string_url_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@ &=+$,/?#[]end. :keyword string_query: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. The default @@ -1570,19 +1946,24 @@ async def string_url_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_query = kwargs.pop('string_query', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_queries_string_url_encoded_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1593,8 +1974,13 @@ async def string_url_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_empty(self, **kwargs: Any) -> None: + async def string_empty( + self, + **kwargs: Any + ) -> None: """Get ''. :keyword string_query: '' string value. The default value is "". Note that overriding this @@ -1604,19 +1990,24 @@ async def string_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "") # type: str + string_query = kwargs.pop('string_query', "") # type: str + request = build_queries_string_empty_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1627,8 +2018,15 @@ async def string_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def string_null(self, *, string_query: Optional[str] = None, **kwargs: Any) -> None: + async def string_null( + self, + *, + string_query: Optional[str] = None, + **kwargs: Any + ) -> None: """Get null (no query parameter in url). :keyword string_query: null string value. @@ -1637,17 +2035,22 @@ async def string_null(self, *, string_query: Optional[str] = None, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_string_null_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1658,8 +2061,15 @@ async def string_null(self, *, string_query: Optional[str] = None, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def enum_valid(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None: + async def enum_valid( + self, + *, + enum_query: Optional[str] = None, + **kwargs: Any + ) -> None: """Get using uri with query parameter 'green color'. :keyword enum_query: 'green color' enum value. Possible values are: "red color", "green color", @@ -1669,17 +2079,22 @@ async def enum_valid(self, *, enum_query: Optional[str] = None, **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_enum_valid_request( enum_query=enum_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1690,8 +2105,15 @@ async def enum_valid(self, *, enum_query: Optional[str] = None, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def enum_null(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None: + async def enum_null( + self, + *, + enum_query: Optional[str] = None, + **kwargs: Any + ) -> None: """Get null (no query parameter in url). :keyword enum_query: null string value. Possible values are: "red color", "green color", and @@ -1701,17 +2123,22 @@ async def enum_null(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_enum_null_request( enum_query=enum_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1722,8 +2149,15 @@ async def enum_null(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def byte_multi_byte(self, *, byte_query: Optional[bytearray] = None, **kwargs: Any) -> None: + async def byte_multi_byte( + self, + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. :keyword byte_query: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. @@ -1732,17 +2166,22 @@ async def byte_multi_byte(self, *, byte_query: Optional[bytearray] = None, **kwa :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_byte_multi_byte_request( byte_query=byte_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1753,8 +2192,13 @@ async def byte_multi_byte(self, *, byte_query: Optional[bytearray] = None, **kwa if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def byte_empty(self, **kwargs: Any) -> None: + async def byte_empty( + self, + **kwargs: Any + ) -> None: """Get '' as byte array. :keyword byte_query: '' as byte array. The default value is bytearray("", encoding="utf-8"). @@ -1764,19 +2208,24 @@ async def byte_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_query = kwargs.pop("byte_query", bytearray("", encoding="utf-8")) # type: bytearray + byte_query = kwargs.pop('byte_query', bytearray("", encoding="utf-8")) # type: bytearray + request = build_queries_byte_empty_request( byte_query=byte_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1787,8 +2236,15 @@ async def byte_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def byte_null(self, *, byte_query: Optional[bytearray] = None, **kwargs: Any) -> None: + async def byte_null( + self, + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Get null as byte array (no query parameters in uri). :keyword byte_query: null as byte array (no query parameters in uri). @@ -1797,17 +2253,22 @@ async def byte_null(self, *, byte_query: Optional[bytearray] = None, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_byte_null_request( byte_query=byte_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1818,8 +2279,13 @@ async def byte_null(self, *, byte_query: Optional[bytearray] = None, **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_valid(self, **kwargs: Any) -> None: + async def date_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01' as date. :keyword date_query: '2012-01-01' as date. The default value is "2012-01-01". Note that @@ -1829,19 +2295,24 @@ async def date_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_query = kwargs.pop("date_query", "2012-01-01") # type: datetime.date + date_query = kwargs.pop('date_query', "2012-01-01") # type: datetime.date + request = build_queries_date_valid_request( date_query=date_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1852,8 +2323,15 @@ async def date_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_null(self, *, date_query: Optional[datetime.date] = None, **kwargs: Any) -> None: + async def date_null( + self, + *, + date_query: Optional[datetime.date] = None, + **kwargs: Any + ) -> None: """Get null as date - this should result in no query parameters in uri. :keyword date_query: null as date (no query parameters in uri). @@ -1862,17 +2340,22 @@ async def date_null(self, *, date_query: Optional[datetime.date] = None, **kwarg :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_date_null_request( date_query=date_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1883,8 +2366,13 @@ async def date_null(self, *, date_query: Optional[datetime.date] = None, **kwarg if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_time_valid(self, **kwargs: Any) -> None: + async def date_time_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01T01:01:01Z' as date-time. :keyword date_time_query: '2012-01-01T01:01:01Z' as date-time. The default value is @@ -1895,19 +2383,24 @@ async def date_time_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_query = kwargs.pop("date_time_query", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_query = kwargs.pop('date_time_query', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_queries_date_time_valid_request( date_time_query=date_time_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1918,8 +2411,15 @@ async def date_time_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def date_time_null(self, *, date_time_query: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + async def date_time_null( + self, + *, + date_time_query: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """Get null as date-time, should result in no query parameters in uri. :keyword date_time_query: null as date-time (no query parameters). @@ -1928,17 +2428,22 @@ async def date_time_null(self, *, date_time_query: Optional[datetime.datetime] = :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_date_time_null_request( date_time_query=date_time_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1949,8 +2454,15 @@ async def date_time_null(self, *, date_time_query: Optional[datetime.datetime] = if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_csv_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_csv_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -1961,17 +2473,22 @@ async def array_string_csv_valid(self, *, array_query: Optional[List[str]] = Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_csv_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1982,8 +2499,15 @@ async def array_string_csv_valid(self, *, array_query: Optional[List[str]] = Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_csv_null(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_csv_null( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get a null array of string using the csv-array format. :keyword array_query: a null array of string using the csv-array format. @@ -1992,17 +2516,22 @@ async def array_string_csv_null(self, *, array_query: Optional[List[str]] = None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_csv_null_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2013,8 +2542,15 @@ async def array_string_csv_null(self, *, array_query: Optional[List[str]] = None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_csv_empty(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_csv_empty( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an empty array [] of string using the csv-array format. :keyword array_query: an empty array [] of string using the csv-array format. @@ -2023,17 +2559,22 @@ async def array_string_csv_empty(self, *, array_query: Optional[List[str]] = Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_csv_empty_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2044,9 +2585,14 @@ async def array_string_csv_empty(self, *, array_query: Optional[List[str]] = Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def array_string_no_collection_format_empty( - self, *, array_query: Optional[List[str]] = None, **kwargs: Any + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> None: """Array query has no defined collection format, should default to csv. Pass in ['hello', 'nihao', 'bonjour'] for the 'arrayQuery' parameter to the service. @@ -2057,17 +2603,22 @@ async def array_string_no_collection_format_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_no_collection_format_empty_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2078,8 +2629,15 @@ async def array_string_no_collection_format_empty( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_ssv_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_ssv_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format. @@ -2090,17 +2648,22 @@ async def array_string_ssv_valid(self, *, array_query: Optional[List[str]] = Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_ssv_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2111,8 +2674,15 @@ async def array_string_ssv_valid(self, *, array_query: Optional[List[str]] = Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_tsv_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_tsv_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format. @@ -2123,17 +2693,22 @@ async def array_string_tsv_valid(self, *, array_query: Optional[List[str]] = Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_tsv_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2144,8 +2719,15 @@ async def array_string_tsv_valid(self, *, array_query: Optional[List[str]] = Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def array_string_pipes_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + async def array_string_pipes_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format. @@ -2156,17 +2738,22 @@ async def array_string_pipes_valid(self, *, array_query: Optional[List[str]] = N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_queries_array_string_pipes_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2223,10 +2810,13 @@ async def get_all_with_values( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_path_items_get_all_with_values_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -2238,7 +2828,9 @@ async def get_all_with_values( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2249,6 +2841,8 @@ async def get_all_with_values( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def get_global_query_null( self, @@ -2276,10 +2870,13 @@ async def get_global_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_path_items_get_global_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -2291,7 +2888,9 @@ async def get_global_query_null( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2302,6 +2901,8 @@ async def get_global_query_null( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def get_global_and_local_query_null( self, @@ -2329,10 +2930,13 @@ async def get_global_and_local_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_path_items_get_global_and_local_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -2344,7 +2948,9 @@ async def get_global_and_local_query_null( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2355,6 +2961,8 @@ async def get_global_and_local_query_null( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async async def get_local_path_item_query_null( self, @@ -2381,10 +2989,13 @@ async def get_local_path_item_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_path_items_get_local_path_item_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -2396,7 +3007,9 @@ async def get_local_path_item_query_null( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2406,3 +3019,5 @@ async def get_local_path_item_query_null( if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/__init__.py index 8489b88debe..5e955f3433a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/__init__.py @@ -11,7 +11,7 @@ from ._operations import PathItemsOperations __all__ = [ - "PathsOperations", - "QueriesOperations", - "PathItemsOperations", + 'PathsOperations', + 'QueriesOperations', + 'PathItemsOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py index 6d80dc3a691..0b75fec9b39 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py @@ -9,13 +9,7 @@ import datetime from typing import Any, Callable, Dict, List, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -23,1133 +17,1630 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - -def build_paths_get_boolean_true_request(**kwargs: Any) -> HttpRequest: - bool_path = kwargs.pop("bool_path", True) # type: bool +def build_paths_get_boolean_true_request( + **kwargs: Any +) -> HttpRequest: + bool_path = kwargs.pop('bool_path', True) # type: bool accept = "application/json" # Construct URL - url = "/paths/bool/true/{boolPath}" + url = '/paths/bool/true/{boolPath}' path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, "bool"), + "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_get_boolean_false_request(**kwargs: Any) -> HttpRequest: - bool_path = kwargs.pop("bool_path", False) # type: bool +def build_paths_get_boolean_false_request( + **kwargs: Any +) -> HttpRequest: + bool_path = kwargs.pop('bool_path', False) # type: bool accept = "application/json" # Construct URL - url = "/paths/bool/false/{boolPath}" + url = '/paths/bool/false/{boolPath}' path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, "bool"), + "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_get_int_one_million_request(**kwargs: Any) -> HttpRequest: - int_path = kwargs.pop("int_path", 1000000) # type: int +def build_paths_get_int_one_million_request( + **kwargs: Any +) -> HttpRequest: + int_path = kwargs.pop('int_path', 1000000) # type: int accept = "application/json" # Construct URL - url = "/paths/int/1000000/{intPath}" + url = '/paths/int/1000000/{intPath}' path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, "int"), + "intPath": _SERIALIZER.url("int_path", int_path, 'int'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: - int_path = kwargs.pop("int_path", -1000000) # type: int +def build_paths_get_int_negative_one_million_request( + **kwargs: Any +) -> HttpRequest: + int_path = kwargs.pop('int_path', -1000000) # type: int accept = "application/json" # Construct URL - url = "/paths/int/-1000000/{intPath}" + url = '/paths/int/-1000000/{intPath}' path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, "int"), + "intPath": _SERIALIZER.url("int_path", int_path, 'int'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_get_ten_billion_request(**kwargs: Any) -> HttpRequest: - long_path = kwargs.pop("long_path", 10000000000) # type: int +def build_paths_get_ten_billion_request( + **kwargs: Any +) -> HttpRequest: + long_path = kwargs.pop('long_path', 10000000000) # type: int accept = "application/json" # Construct URL - url = "/paths/long/10000000000/{longPath}" + url = '/paths/long/10000000000/{longPath}' path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, "long"), + "longPath": _SERIALIZER.url("long_path", long_path, 'long'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: - long_path = kwargs.pop("long_path", -10000000000) # type: int +def build_paths_get_negative_ten_billion_request( + **kwargs: Any +) -> HttpRequest: + long_path = kwargs.pop('long_path', -10000000000) # type: int accept = "application/json" # Construct URL - url = "/paths/long/-10000000000/{longPath}" + url = '/paths/long/-10000000000/{longPath}' path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, "long"), + "longPath": _SERIALIZER.url("long_path", long_path, 'long'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: - float_path = kwargs.pop("float_path", 103400000000000000000) # type: float +def build_paths_float_scientific_positive_request( + **kwargs: Any +) -> HttpRequest: + float_path = kwargs.pop('float_path', 103400000000000000000) # type: float accept = "application/json" # Construct URL - url = "/paths/float/1.034E+20/{floatPath}" + url = '/paths/float/1.034E+20/{floatPath}' path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, "float"), + "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: - float_path = kwargs.pop("float_path", -1.034e-20) # type: float +def build_paths_float_scientific_negative_request( + **kwargs: Any +) -> HttpRequest: + float_path = kwargs.pop('float_path', -1.034e-20) # type: float accept = "application/json" # Construct URL - url = "/paths/float/-1.034E-20/{floatPath}" + url = '/paths/float/-1.034E-20/{floatPath}' path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, "float"), + "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: - double_path = kwargs.pop("double_path", 9999999.999) # type: float +def build_paths_double_decimal_positive_request( + **kwargs: Any +) -> HttpRequest: + double_path = kwargs.pop('double_path', 9999999.999) # type: float accept = "application/json" # Construct URL - url = "/paths/double/9999999.999/{doublePath}" + url = '/paths/double/9999999.999/{doublePath}' path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, "float"), + "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: - double_path = kwargs.pop("double_path", -9999999.999) # type: float +def build_paths_double_decimal_negative_request( + **kwargs: Any +) -> HttpRequest: + double_path = kwargs.pop('double_path', -9999999.999) # type: float accept = "application/json" # Construct URL - url = "/paths/double/-9999999.999/{doublePath}" + url = '/paths/double/-9999999.999/{doublePath}' path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, "float"), + "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_string_unicode_request(**kwargs: Any) -> HttpRequest: - string_path = kwargs.pop("string_path", "啊齄丂狛狜隣郎隣兀﨩") # type: str +def build_paths_string_unicode_request( + **kwargs: Any +) -> HttpRequest: + string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str accept = "application/json" # Construct URL - url = "/paths/string/unicode/{stringPath}" + url = '/paths/string/unicode/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_string_url_encoded_request(**kwargs: Any) -> HttpRequest: - string_path = kwargs.pop("string_path", "begin!*'();:@ &=+$,/?#[]end") # type: str +def build_paths_string_url_encoded_request( + **kwargs: Any +) -> HttpRequest: + string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str accept = "application/json" # Construct URL - url = "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}" + url = '/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_string_url_non_encoded_request(**kwargs: Any) -> HttpRequest: - string_path = kwargs.pop("string_path", "begin!*'();:@&=+$,end") # type: str +def build_paths_string_url_non_encoded_request( + **kwargs: Any +) -> HttpRequest: + string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str accept = "application/json" # Construct URL - url = "/paths/string/begin!*'();:@&=+$,end/{stringPath}" + url = '/paths/string/begin!*\'();:@&=+$,end/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str", skip_quote=True), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str', skip_quote=True), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_string_empty_request(**kwargs: Any) -> HttpRequest: - string_path = kwargs.pop("string_path", "") # type: str +def build_paths_string_empty_request( + **kwargs: Any +) -> HttpRequest: + string_path = kwargs.pop('string_path', "") # type: str accept = "application/json" # Construct URL - url = "/paths/string/empty/{stringPath}" + url = '/paths/string/empty/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_string_null_request(string_path: str, **kwargs: Any) -> HttpRequest: +def build_paths_string_null_request( + string_path: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/string/null/{stringPath}" + url = '/paths/string/null/{stringPath}' path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, "str"), + "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_enum_valid_request(enum_path: str, **kwargs: Any) -> HttpRequest: +def build_paths_enum_valid_request( + enum_path: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/enum/green%20color/{enumPath}" + url = '/paths/enum/green%20color/{enumPath}' path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, "str"), + "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_enum_null_request(enum_path: str, **kwargs: Any) -> HttpRequest: +def build_paths_enum_null_request( + enum_path: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/string/null/{enumPath}" + url = '/paths/string/null/{enumPath}' path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, "str"), + "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_byte_multi_byte_request(byte_path: bytearray, **kwargs: Any) -> HttpRequest: +def build_paths_byte_multi_byte_request( + byte_path: bytearray, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/byte/multibyte/{bytePath}" + url = '/paths/byte/multibyte/{bytePath}' path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), + "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_byte_empty_request(**kwargs: Any) -> HttpRequest: - byte_path = kwargs.pop("byte_path", bytearray("", encoding="utf-8")) # type: bytearray +def build_paths_byte_empty_request( + **kwargs: Any +) -> HttpRequest: + byte_path = kwargs.pop('byte_path', bytearray("", encoding="utf-8")) # type: bytearray accept = "application/json" # Construct URL - url = "/paths/byte/empty/{bytePath}" + url = '/paths/byte/empty/{bytePath}' path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), + "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_byte_null_request(byte_path: bytearray, **kwargs: Any) -> HttpRequest: +def build_paths_byte_null_request( + byte_path: bytearray, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/byte/null/{bytePath}" + url = '/paths/byte/null/{bytePath}' path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), + "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_date_valid_request(**kwargs: Any) -> HttpRequest: - date_path = kwargs.pop("date_path", "2012-01-01") # type: datetime.date +def build_paths_date_valid_request( + **kwargs: Any +) -> HttpRequest: + date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date accept = "application/json" # Construct URL - url = "/paths/date/2012-01-01/{datePath}" + url = '/paths/date/2012-01-01/{datePath}' path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, "date"), + "datePath": _SERIALIZER.url("date_path", date_path, 'date'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_date_null_request(date_path: datetime.date, **kwargs: Any) -> HttpRequest: +def build_paths_date_null_request( + date_path: datetime.date, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/date/null/{datePath}" + url = '/paths/date/null/{datePath}' path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, "date"), + "datePath": _SERIALIZER.url("date_path", date_path, 'date'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_date_time_valid_request(**kwargs: Any) -> HttpRequest: - date_time_path = kwargs.pop("date_time_path", "2012-01-01T01:01:01Z") # type: datetime.datetime +def build_paths_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: + date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime accept = "application/json" # Construct URL - url = "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}" + url = '/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}' path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, "iso-8601"), + "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_date_time_null_request(date_time_path: datetime.datetime, **kwargs: Any) -> HttpRequest: +def build_paths_date_time_null_request( + date_time_path: datetime.datetime, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/datetime/null/{dateTimePath}" + url = '/paths/datetime/null/{dateTimePath}' path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, "iso-8601"), + "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_base64_url_request(base64_url_path: bytes, **kwargs: Any) -> HttpRequest: +def build_paths_base64_url_request( + base64_url_path: bytes, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/string/bG9yZW0/{base64UrlPath}" + url = '/paths/string/bG9yZW0/{base64UrlPath}' path_format_arguments = { - "base64UrlPath": _SERIALIZER.url("base64_url_path", base64_url_path, "base64"), + "base64UrlPath": _SERIALIZER.url("base64_url_path", base64_url_path, 'base64'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_array_csv_in_path_request(array_path: List[str], **kwargs: Any) -> HttpRequest: +def build_paths_array_csv_in_path_request( + array_path: List[str], + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = ( - "/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}" - ) + url = '/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}' path_format_arguments = { - "arrayPath": _SERIALIZER.url("array_path", array_path, "[str]", div=","), + "arrayPath": _SERIALIZER.url("array_path", array_path, '[str]', div=','), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_paths_unix_time_url_request(unix_time_url_path: datetime.datetime, **kwargs: Any) -> HttpRequest: +def build_paths_unix_time_url_request( + unix_time_url_path: datetime.datetime, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/paths/int/1460505600/{unixTimeUrlPath}" + url = '/paths/int/1460505600/{unixTimeUrlPath}' path_format_arguments = { - "unixTimeUrlPath": _SERIALIZER.url("unix_time_url_path", unix_time_url_path, "unix-time"), + "unixTimeUrlPath": _SERIALIZER.url("unix_time_url_path", unix_time_url_path, 'unix-time'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_queries_get_boolean_true_request(**kwargs: Any) -> HttpRequest: - bool_query = kwargs.pop("bool_query", True) # type: bool +def build_queries_get_boolean_true_request( + **kwargs: Any +) -> HttpRequest: + bool_query = kwargs.pop('bool_query', True) # type: bool accept = "application/json" # Construct URL - url = "/queries/bool/true" + url = '/queries/bool/true' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") + query_parameters['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_boolean_false_request(**kwargs: Any) -> HttpRequest: - bool_query = kwargs.pop("bool_query", False) # type: bool +def build_queries_get_boolean_false_request( + **kwargs: Any +) -> HttpRequest: + bool_query = kwargs.pop('bool_query', False) # type: bool accept = "application/json" # Construct URL - url = "/queries/bool/false" + url = '/queries/bool/false' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") + query_parameters['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_boolean_null_request(*, bool_query: Optional[bool] = None, **kwargs: Any) -> HttpRequest: +def build_queries_get_boolean_null_request( + *, + bool_query: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/bool/null" + url = '/queries/bool/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if bool_query is not None: - query_parameters["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") + query_parameters['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_int_one_million_request(**kwargs: Any) -> HttpRequest: - int_query = kwargs.pop("int_query", 1000000) # type: int +def build_queries_get_int_one_million_request( + **kwargs: Any +) -> HttpRequest: + int_query = kwargs.pop('int_query', 1000000) # type: int accept = "application/json" # Construct URL - url = "/queries/int/1000000" + url = '/queries/int/1000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") + query_parameters['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: - int_query = kwargs.pop("int_query", -1000000) # type: int +def build_queries_get_int_negative_one_million_request( + **kwargs: Any +) -> HttpRequest: + int_query = kwargs.pop('int_query', -1000000) # type: int accept = "application/json" # Construct URL - url = "/queries/int/-1000000" + url = '/queries/int/-1000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") + query_parameters['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_int_null_request(*, int_query: Optional[int] = None, **kwargs: Any) -> HttpRequest: +def build_queries_get_int_null_request( + *, + int_query: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/int/null" + url = '/queries/int/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if int_query is not None: - query_parameters["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") + query_parameters['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_ten_billion_request(**kwargs: Any) -> HttpRequest: - long_query = kwargs.pop("long_query", 10000000000) # type: int +def build_queries_get_ten_billion_request( + **kwargs: Any +) -> HttpRequest: + long_query = kwargs.pop('long_query', 10000000000) # type: int accept = "application/json" # Construct URL - url = "/queries/long/10000000000" + url = '/queries/long/10000000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["longQuery"] = _SERIALIZER.query("long_query", long_query, "long") + query_parameters['longQuery'] = _SERIALIZER.query("long_query", long_query, 'long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: - long_query = kwargs.pop("long_query", -10000000000) # type: int +def build_queries_get_negative_ten_billion_request( + **kwargs: Any +) -> HttpRequest: + long_query = kwargs.pop('long_query', -10000000000) # type: int accept = "application/json" # Construct URL - url = "/queries/long/-10000000000" + url = '/queries/long/-10000000000' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["longQuery"] = _SERIALIZER.query("long_query", long_query, "long") + query_parameters['longQuery'] = _SERIALIZER.query("long_query", long_query, 'long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_get_long_null_request(*, long_query: Optional[int] = None, **kwargs: Any) -> HttpRequest: +def build_queries_get_long_null_request( + *, + long_query: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/long/null" + url = '/queries/long/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if long_query is not None: - query_parameters["longQuery"] = _SERIALIZER.query("long_query", long_query, "long") + query_parameters['longQuery'] = _SERIALIZER.query("long_query", long_query, 'long') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: - float_query = kwargs.pop("float_query", 103400000000000000000) # type: float +def build_queries_float_scientific_positive_request( + **kwargs: Any +) -> HttpRequest: + float_query = kwargs.pop('float_query', 103400000000000000000) # type: float accept = "application/json" # Construct URL - url = "/queries/float/1.034E+20" + url = '/queries/float/1.034E+20' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") + query_parameters['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: - float_query = kwargs.pop("float_query", -1.034e-20) # type: float +def build_queries_float_scientific_negative_request( + **kwargs: Any +) -> HttpRequest: + float_query = kwargs.pop('float_query', -1.034e-20) # type: float accept = "application/json" # Construct URL - url = "/queries/float/-1.034E-20" + url = '/queries/float/-1.034E-20' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") + query_parameters['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_float_null_request(*, float_query: Optional[float] = None, **kwargs: Any) -> HttpRequest: +def build_queries_float_null_request( + *, + float_query: Optional[float] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/float/null" + url = '/queries/float/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if float_query is not None: - query_parameters["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") + query_parameters['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: - double_query = kwargs.pop("double_query", 9999999.999) # type: float +def build_queries_double_decimal_positive_request( + **kwargs: Any +) -> HttpRequest: + double_query = kwargs.pop('double_query', 9999999.999) # type: float accept = "application/json" # Construct URL - url = "/queries/double/9999999.999" + url = '/queries/double/9999999.999' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") + query_parameters['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: - double_query = kwargs.pop("double_query", -9999999.999) # type: float +def build_queries_double_decimal_negative_request( + **kwargs: Any +) -> HttpRequest: + double_query = kwargs.pop('double_query', -9999999.999) # type: float accept = "application/json" # Construct URL - url = "/queries/double/-9999999.999" + url = '/queries/double/-9999999.999' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") + query_parameters['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_double_null_request(*, double_query: Optional[float] = None, **kwargs: Any) -> HttpRequest: +def build_queries_double_null_request( + *, + double_query: Optional[float] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/double/null" + url = '/queries/double/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if double_query is not None: - query_parameters["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") + query_parameters['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_string_unicode_request(**kwargs: Any) -> HttpRequest: - string_query = kwargs.pop("string_query", "啊齄丂狛狜隣郎隣兀﨩") # type: str +def build_queries_string_unicode_request( + **kwargs: Any +) -> HttpRequest: + string_query = kwargs.pop('string_query', "啊齄丂狛狜隣郎隣兀﨩") # type: str accept = "application/json" # Construct URL - url = "/queries/string/unicode/" + url = '/queries/string/unicode/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_string_url_encoded_request(**kwargs: Any) -> HttpRequest: - string_query = kwargs.pop("string_query", "begin!*'();:@ &=+$,/?#[]end") # type: str +def build_queries_string_url_encoded_request( + **kwargs: Any +) -> HttpRequest: + string_query = kwargs.pop('string_query', "begin!*'();:@ &=+$,/?#[]end") # type: str accept = "application/json" # Construct URL - url = "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend" + url = '/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_string_empty_request(**kwargs: Any) -> HttpRequest: - string_query = kwargs.pop("string_query", "") # type: str +def build_queries_string_empty_request( + **kwargs: Any +) -> HttpRequest: + string_query = kwargs.pop('string_query', "") # type: str accept = "application/json" # Construct URL - url = "/queries/string/empty" + url = '/queries/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_string_null_request(*, string_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_queries_string_null_request( + *, + string_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/string/null" + url = '/queries/string/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if string_query is not None: - query_parameters["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") + query_parameters['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_enum_valid_request(*, enum_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_queries_enum_valid_request( + *, + enum_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/enum/green%20color" + url = '/queries/enum/green%20color' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if enum_query is not None: - query_parameters["enumQuery"] = _SERIALIZER.query("enum_query", enum_query, "str") + query_parameters['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_enum_null_request(*, enum_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_queries_enum_null_request( + *, + enum_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/enum/null" + url = '/queries/enum/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if enum_query is not None: - query_parameters["enumQuery"] = _SERIALIZER.query("enum_query", enum_query, "str") + query_parameters['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_byte_multi_byte_request(*, byte_query: Optional[bytearray] = None, **kwargs: Any) -> HttpRequest: +def build_queries_byte_multi_byte_request( + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/byte/multibyte" + url = '/queries/byte/multibyte' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if byte_query is not None: - query_parameters["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") + query_parameters['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_byte_empty_request(**kwargs: Any) -> HttpRequest: - byte_query = kwargs.pop("byte_query", bytearray("", encoding="utf-8")) # type: bytearray +def build_queries_byte_empty_request( + **kwargs: Any +) -> HttpRequest: + byte_query = kwargs.pop('byte_query', bytearray("", encoding="utf-8")) # type: bytearray accept = "application/json" # Construct URL - url = "/queries/byte/empty" + url = '/queries/byte/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") + query_parameters['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_byte_null_request(*, byte_query: Optional[bytearray] = None, **kwargs: Any) -> HttpRequest: +def build_queries_byte_null_request( + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/byte/null" + url = '/queries/byte/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if byte_query is not None: - query_parameters["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") + query_parameters['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_date_valid_request(**kwargs: Any) -> HttpRequest: - date_query = kwargs.pop("date_query", "2012-01-01") # type: datetime.date +def build_queries_date_valid_request( + **kwargs: Any +) -> HttpRequest: + date_query = kwargs.pop('date_query', "2012-01-01") # type: datetime.date accept = "application/json" # Construct URL - url = "/queries/date/2012-01-01" + url = '/queries/date/2012-01-01' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["dateQuery"] = _SERIALIZER.query("date_query", date_query, "date") + query_parameters['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_date_null_request(*, date_query: Optional[datetime.date] = None, **kwargs: Any) -> HttpRequest: +def build_queries_date_null_request( + *, + date_query: Optional[datetime.date] = None, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/date/null" + url = '/queries/date/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if date_query is not None: - query_parameters["dateQuery"] = _SERIALIZER.query("date_query", date_query, "date") + query_parameters['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_queries_date_time_valid_request(**kwargs: Any) -> HttpRequest: - date_time_query = kwargs.pop("date_time_query", "2012-01-01T01:01:01Z") # type: datetime.datetime +def build_queries_date_time_valid_request( + **kwargs: Any +) -> HttpRequest: + date_time_query = kwargs.pop('date_time_query', "2012-01-01T01:01:01Z") # type: datetime.datetime accept = "application/json" # Construct URL - url = "/queries/datetime/2012-01-01T01%3A01%3A01Z" + url = '/queries/datetime/2012-01-01T01%3A01%3A01Z' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["dateTimeQuery"] = _SERIALIZER.query("date_time_query", date_time_query, "iso-8601") + query_parameters['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_date_time_null_request( - *, date_time_query: Optional[datetime.datetime] = None, **kwargs: Any + *, + date_time_query: Optional[datetime.datetime] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/datetime/null" + url = '/queries/datetime/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if date_time_query is not None: - query_parameters["dateTimeQuery"] = _SERIALIZER.query("date_time_query", date_time_query, "iso-8601") + query_parameters['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_csv_valid_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/csv/string/valid" + url = '/queries/array/csv/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_csv_null_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/csv/string/null" + url = '/queries/array/csv/string/null' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_csv_empty_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/csv/string/empty" + url = '/queries/array/csv/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_no_collection_format_empty_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/none/string/empty" + url = '/queries/array/none/string/empty' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_ssv_valid_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/ssv/string/valid" + url = '/queries/array/ssv/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=" ") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_tsv_valid_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/tsv/string/valid" + url = '/queries/array/tsv/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=" ") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_queries_array_string_pipes_valid_request( - *, array_query: Optional[List[str]] = None, **kwargs: Any + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/queries/array/pipes/string/valid" + url = '/queries/array/pipes/string/valid' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if array_query is not None: - query_parameters["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div="|") + query_parameters['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div='|') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_path_items_get_all_with_values_request( @@ -1164,11 +1655,11 @@ def build_path_items_get_all_with_values_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery" # pylint: disable=line-too-long + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -1176,19 +1667,23 @@ def build_path_items_get_all_with_values_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_path_items_get_global_query_null_request( @@ -1203,11 +1698,11 @@ def build_path_items_get_global_query_null_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery" # pylint: disable=line-too-long + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -1215,19 +1710,23 @@ def build_path_items_get_global_query_null_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_path_items_get_global_and_local_query_null_request( @@ -1242,11 +1741,11 @@ def build_path_items_get_global_and_local_query_null_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null" # pylint: disable=line-too-long + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -1254,19 +1753,23 @@ def build_path_items_get_global_and_local_query_null_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_path_items_get_local_path_item_query_null_request( @@ -1281,11 +1784,11 @@ def build_path_items_get_local_path_item_query_null_request( ) -> HttpRequest: accept = "application/json" # Construct URL - url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null" # pylint: disable=line-too-long + url = '/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null' # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -1293,20 +1796,23 @@ def build_path_items_get_local_path_item_query_null_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if path_item_string_query is not None: - query_parameters["pathItemStringQuery"] = _SERIALIZER.query( - "path_item_string_query", path_item_string_query, "str" - ) + query_parameters['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') if global_string_query is not None: - query_parameters["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") + query_parameters['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') if local_string_query is not None: - query_parameters["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") + query_parameters['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) - + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PathsOperations(object): # pylint: disable=too-many-public-methods """PathsOperations operations. @@ -1327,7 +1833,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_boolean_true(self, **kwargs: Any) -> None: + def get_boolean_true( + self, + **kwargs: Any + ) -> None: """Get true Boolean value on path. :keyword bool_path: true boolean value. The default value is True. Note that overriding this @@ -1337,19 +1846,24 @@ def get_boolean_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", True) # type: bool + bool_path = kwargs.pop('bool_path', True) # type: bool + request = build_paths_get_boolean_true_request( bool_path=bool_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1360,8 +1874,13 @@ def get_boolean_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_boolean_false(self, **kwargs: Any) -> None: + def get_boolean_false( + self, + **kwargs: Any + ) -> None: """Get false Boolean value on path. :keyword bool_path: false boolean value. The default value is False. Note that overriding this @@ -1371,19 +1890,24 @@ def get_boolean_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_path = kwargs.pop("bool_path", False) # type: bool + bool_path = kwargs.pop('bool_path', False) # type: bool + request = build_paths_get_boolean_false_request( bool_path=bool_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1394,8 +1918,13 @@ def get_boolean_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_int_one_million(self, **kwargs: Any) -> None: + def get_int_one_million( + self, + **kwargs: Any + ) -> None: """Get '1000000' integer value. :keyword int_path: '1000000' integer value. The default value is 1000000. Note that overriding @@ -1405,19 +1934,24 @@ def get_int_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", 1000000) # type: int + int_path = kwargs.pop('int_path', 1000000) # type: int + request = build_paths_get_int_one_million_request( int_path=int_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1428,8 +1962,13 @@ def get_int_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_int_negative_one_million(self, **kwargs: Any) -> None: + def get_int_negative_one_million( + self, + **kwargs: Any + ) -> None: """Get '-1000000' integer value. :keyword int_path: '-1000000' integer value. The default value is -1000000. Note that @@ -1439,19 +1978,24 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_path = kwargs.pop("int_path", -1000000) # type: int + int_path = kwargs.pop('int_path', -1000000) # type: int + request = build_paths_get_int_negative_one_million_request( int_path=int_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1462,8 +2006,13 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_ten_billion(self, **kwargs: Any) -> None: + def get_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '10000000000' 64 bit integer value. :keyword long_path: '10000000000' 64 bit integer value. The default value is 10000000000. Note @@ -1473,19 +2022,24 @@ def get_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", 10000000000) # type: int + long_path = kwargs.pop('long_path', 10000000000) # type: int + request = build_paths_get_ten_billion_request( long_path=long_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1496,8 +2050,13 @@ def get_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_negative_ten_billion(self, **kwargs: Any) -> None: + def get_negative_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '-10000000000' 64 bit integer value. :keyword long_path: '-10000000000' 64 bit integer value. The default value is -10000000000. @@ -1507,19 +2066,24 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_path = kwargs.pop("long_path", -10000000000) # type: int + long_path = kwargs.pop('long_path', -10000000000) # type: int + request = build_paths_get_negative_ten_billion_request( long_path=long_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1530,8 +2094,13 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def float_scientific_positive(self, **kwargs: Any) -> None: + def float_scientific_positive( + self, + **kwargs: Any + ) -> None: """Get '1.034E+20' numeric value. :keyword float_path: '1.034E+20'numeric value. The default value is 103400000000000000000. Note @@ -1541,19 +2110,24 @@ def float_scientific_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", 103400000000000000000) # type: float + float_path = kwargs.pop('float_path', 103400000000000000000) # type: float + request = build_paths_float_scientific_positive_request( float_path=float_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1564,8 +2138,13 @@ def float_scientific_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def float_scientific_negative(self, **kwargs: Any) -> None: + def float_scientific_negative( + self, + **kwargs: Any + ) -> None: """Get '-1.034E-20' numeric value. :keyword float_path: '-1.034E-20'numeric value. The default value is -1.034e-20. Note that @@ -1575,19 +2154,24 @@ def float_scientific_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_path = kwargs.pop("float_path", -1.034e-20) # type: float + float_path = kwargs.pop('float_path', -1.034e-20) # type: float + request = build_paths_float_scientific_negative_request( float_path=float_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1598,8 +2182,13 @@ def float_scientific_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def double_decimal_positive(self, **kwargs: Any) -> None: + def double_decimal_positive( + self, + **kwargs: Any + ) -> None: """Get '9999999.999' numeric value. :keyword double_path: '9999999.999'numeric value. The default value is 9999999.999. Note that @@ -1609,19 +2198,24 @@ def double_decimal_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", 9999999.999) # type: float + double_path = kwargs.pop('double_path', 9999999.999) # type: float + request = build_paths_double_decimal_positive_request( double_path=double_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1632,8 +2226,13 @@ def double_decimal_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def double_decimal_negative(self, **kwargs: Any) -> None: + def double_decimal_negative( + self, + **kwargs: Any + ) -> None: """Get '-9999999.999' numeric value. :keyword double_path: '-9999999.999'numeric value. The default value is -9999999.999. Note that @@ -1643,19 +2242,24 @@ def double_decimal_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_path = kwargs.pop("double_path", -9999999.999) # type: float + double_path = kwargs.pop('double_path', -9999999.999) # type: float + request = build_paths_double_decimal_negative_request( double_path=double_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1666,8 +2270,13 @@ def double_decimal_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_unicode(self, **kwargs: Any) -> None: + def string_unicode( + self, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. :keyword string_path: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. The default value is "啊齄丂狛狜隣郎隣兀﨩". @@ -1677,19 +2286,24 @@ def string_unicode(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_paths_string_unicode_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1700,8 +2314,13 @@ def string_unicode(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_url_encoded(self, **kwargs: Any) -> None: + def string_url_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@ &=+$,/?#[]end. :keyword string_path: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. The default value @@ -1712,19 +2331,24 @@ def string_url_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_paths_string_url_encoded_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1735,8 +2359,13 @@ def string_url_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_url_non_encoded(self, **kwargs: Any) -> None: + def string_url_non_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@&=+$,end. https://tools.ietf.org/html/rfc3986#appendix-A 'path' accept any 'pchar' not encoded. @@ -1749,19 +2378,24 @@ def string_url_non_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "begin!*'();:@&=+$,end") # type: str + string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str + request = build_paths_string_url_non_encoded_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1772,8 +2406,13 @@ def string_url_non_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_empty(self, **kwargs: Any) -> None: + def string_empty( + self, + **kwargs: Any + ) -> None: """Get ''. :keyword string_path: '' string value. The default value is "". Note that overriding this @@ -1783,19 +2422,24 @@ def string_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_path = kwargs.pop("string_path", "") # type: str + string_path = kwargs.pop('string_path', "") # type: str + request = build_paths_string_empty_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1806,8 +2450,14 @@ def string_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_null(self, string_path: str, **kwargs: Any) -> None: + def string_null( + self, + string_path: str, + **kwargs: Any + ) -> None: """Get null (should throw). :param string_path: null string value. @@ -1816,17 +2466,22 @@ def string_null(self, string_path: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_string_null_request( string_path=string_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1837,8 +2492,14 @@ def string_null(self, string_path: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def enum_valid(self, enum_path: str, **kwargs: Any) -> None: + def enum_valid( + self, + enum_path: str, + **kwargs: Any + ) -> None: """Get using uri with 'green color' in path parameter. :param enum_path: send the value green. Possible values are: "red color", "green color", and @@ -1848,17 +2509,22 @@ def enum_valid(self, enum_path: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_enum_valid_request( enum_path=enum_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1869,8 +2535,14 @@ def enum_valid(self, enum_path: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def enum_null(self, enum_path: str, **kwargs: Any) -> None: + def enum_null( + self, + enum_path: str, + **kwargs: Any + ) -> None: """Get null (should throw on the client before the request is sent on wire). :param enum_path: send null should throw. Possible values are: "red color", "green color", and @@ -1880,17 +2552,22 @@ def enum_null(self, enum_path: str, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_enum_null_request( enum_path=enum_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1901,8 +2578,14 @@ def enum_null(self, enum_path: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: + def byte_multi_byte( + self, + byte_path: bytearray, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. :param byte_path: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. @@ -1911,17 +2594,22 @@ def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_byte_multi_byte_request( byte_path=byte_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1932,8 +2620,13 @@ def byte_multi_byte(self, byte_path: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def byte_empty(self, **kwargs: Any) -> None: + def byte_empty( + self, + **kwargs: Any + ) -> None: """Get '' as byte array. :keyword byte_path: '' as byte array. The default value is bytearray("", encoding="utf-8"). @@ -1943,19 +2636,24 @@ def byte_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_path = kwargs.pop("byte_path", bytearray("", encoding="utf-8")) # type: bytearray + byte_path = kwargs.pop('byte_path', bytearray("", encoding="utf-8")) # type: bytearray + request = build_paths_byte_empty_request( byte_path=byte_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1966,8 +2664,14 @@ def byte_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: + def byte_null( + self, + byte_path: bytearray, + **kwargs: Any + ) -> None: """Get null as byte array (should throw). :param byte_path: null as byte array (should throw). @@ -1976,17 +2680,22 @@ def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_byte_null_request( byte_path=byte_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1997,8 +2706,13 @@ def byte_null(self, byte_path: bytearray, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_valid(self, **kwargs: Any) -> None: + def date_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01' as date. :keyword date_path: '2012-01-01' as date. The default value is "2012-01-01". Note that @@ -2008,19 +2722,24 @@ def date_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_path = kwargs.pop("date_path", "2012-01-01") # type: datetime.date + date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date + request = build_paths_date_valid_request( date_path=date_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2031,8 +2750,14 @@ def date_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: + def date_null( + self, + date_path: datetime.date, + **kwargs: Any + ) -> None: """Get null as date - this should throw or be unusable on the client side, depending on date representation. @@ -2042,17 +2767,22 @@ def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_date_null_request( date_path=date_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2063,8 +2793,13 @@ def date_null(self, date_path: datetime.date, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_time_valid(self, **kwargs: Any) -> None: + def date_time_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01T01:01:01Z' as date-time. :keyword date_time_path: '2012-01-01T01:01:01Z' as date-time. The default value is @@ -2075,19 +2810,24 @@ def date_time_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_path = kwargs.pop("date_time_path", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_paths_date_time_valid_request( date_time_path=date_time_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2098,8 +2838,14 @@ def date_time_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) -> None: + def date_time_null( + self, + date_time_path: datetime.datetime, + **kwargs: Any + ) -> None: """Get null as date-time, should be disallowed or throw depending on representation of date-time. :param date_time_path: null as date-time. @@ -2108,17 +2854,22 @@ def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) -> No :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_date_time_null_request( date_time_path=date_time_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2129,8 +2880,14 @@ def date_time_null(self, date_time_path: datetime.datetime, **kwargs: Any) -> No if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: + def base64_url( + self, + base64_url_path: bytes, + **kwargs: Any + ) -> None: """Get 'lorem' encoded value as 'bG9yZW0' (base64url). :param base64_url_path: base64url encoded value. @@ -2139,17 +2896,22 @@ def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_base64_url_request( base64_url_path=base64_url_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2160,8 +2922,14 @@ def base64_url(self, base64_url_path: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: + def array_csv_in_path( + self, + array_path: List[str], + **kwargs: Any + ) -> None: """Get an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -2172,17 +2940,22 @@ def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_array_csv_in_path_request( array_path=array_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2193,8 +2966,14 @@ def array_csv_in_path(self, array_path: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def unix_time_url(self, unix_time_url_path: datetime.datetime, **kwargs: Any) -> None: + def unix_time_url( + self, + unix_time_url_path: datetime.datetime, + **kwargs: Any + ) -> None: """Get the date 2016-04-13 encoded value as '1460505600' (Unix time). :param unix_time_url_path: Unix time encoded value. @@ -2203,17 +2982,22 @@ def unix_time_url(self, unix_time_url_path: datetime.datetime, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + request = build_paths_unix_time_url_request( unix_time_url_path=unix_time_url_path, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2244,7 +3028,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_boolean_true(self, **kwargs: Any) -> None: + def get_boolean_true( + self, + **kwargs: Any + ) -> None: """Get true Boolean value on path. :keyword bool_query: true boolean value. The default value is True. Note that overriding this @@ -2254,19 +3041,24 @@ def get_boolean_true(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", True) # type: bool + bool_query = kwargs.pop('bool_query', True) # type: bool + request = build_queries_get_boolean_true_request( bool_query=bool_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2277,8 +3069,13 @@ def get_boolean_true(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_boolean_false(self, **kwargs: Any) -> None: + def get_boolean_false( + self, + **kwargs: Any + ) -> None: """Get false Boolean value on path. :keyword bool_query: false boolean value. The default value is False. Note that overriding this @@ -2288,19 +3085,24 @@ def get_boolean_false(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - bool_query = kwargs.pop("bool_query", False) # type: bool + bool_query = kwargs.pop('bool_query', False) # type: bool + request = build_queries_get_boolean_false_request( bool_query=bool_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2311,8 +3113,15 @@ def get_boolean_false(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_boolean_null(self, *, bool_query: Optional[bool] = None, **kwargs: Any) -> None: + def get_boolean_null( + self, + *, + bool_query: Optional[bool] = None, + **kwargs: Any + ) -> None: """Get null Boolean value on query (query string should be absent). :keyword bool_query: null boolean value. @@ -2321,17 +3130,23 @@ def get_boolean_null(self, *, bool_query: Optional[bool] = None, **kwargs: Any) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_get_boolean_null_request( bool_query=bool_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2342,8 +3157,13 @@ def get_boolean_null(self, *, bool_query: Optional[bool] = None, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_int_one_million(self, **kwargs: Any) -> None: + def get_int_one_million( + self, + **kwargs: Any + ) -> None: """Get '1000000' integer value. :keyword int_query: '1000000' integer value. The default value is 1000000. Note that overriding @@ -2353,19 +3173,24 @@ def get_int_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", 1000000) # type: int + int_query = kwargs.pop('int_query', 1000000) # type: int + request = build_queries_get_int_one_million_request( int_query=int_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2376,8 +3201,13 @@ def get_int_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_int_negative_one_million(self, **kwargs: Any) -> None: + def get_int_negative_one_million( + self, + **kwargs: Any + ) -> None: """Get '-1000000' integer value. :keyword int_query: '-1000000' integer value. The default value is -1000000. Note that @@ -2387,19 +3217,24 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - int_query = kwargs.pop("int_query", -1000000) # type: int + int_query = kwargs.pop('int_query', -1000000) # type: int + request = build_queries_get_int_negative_one_million_request( int_query=int_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2410,8 +3245,15 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_int_null(self, *, int_query: Optional[int] = None, **kwargs: Any) -> None: + def get_int_null( + self, + *, + int_query: Optional[int] = None, + **kwargs: Any + ) -> None: """Get null integer value (no query parameter). :keyword int_query: null integer value. @@ -2420,17 +3262,23 @@ def get_int_null(self, *, int_query: Optional[int] = None, **kwargs: Any) -> Non :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_get_int_null_request( int_query=int_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2441,8 +3289,13 @@ def get_int_null(self, *, int_query: Optional[int] = None, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_ten_billion(self, **kwargs: Any) -> None: + def get_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '10000000000' 64 bit integer value. :keyword long_query: '10000000000' 64 bit integer value. The default value is 10000000000. Note @@ -2452,19 +3305,24 @@ def get_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", 10000000000) # type: int + long_query = kwargs.pop('long_query', 10000000000) # type: int + request = build_queries_get_ten_billion_request( long_query=long_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2475,8 +3333,13 @@ def get_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_negative_ten_billion(self, **kwargs: Any) -> None: + def get_negative_ten_billion( + self, + **kwargs: Any + ) -> None: """Get '-10000000000' 64 bit integer value. :keyword long_query: '-10000000000' 64 bit integer value. The default value is -10000000000. @@ -2486,19 +3349,24 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - long_query = kwargs.pop("long_query", -10000000000) # type: int + long_query = kwargs.pop('long_query', -10000000000) # type: int + request = build_queries_get_negative_ten_billion_request( long_query=long_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2509,8 +3377,15 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_long_null(self, *, long_query: Optional[int] = None, **kwargs: Any) -> None: + def get_long_null( + self, + *, + long_query: Optional[int] = None, + **kwargs: Any + ) -> None: """Get 'null 64 bit integer value (no query param in uri). :keyword long_query: null 64 bit integer value. @@ -2519,17 +3394,23 @@ def get_long_null(self, *, long_query: Optional[int] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_get_long_null_request( long_query=long_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2540,8 +3421,13 @@ def get_long_null(self, *, long_query: Optional[int] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def float_scientific_positive(self, **kwargs: Any) -> None: + def float_scientific_positive( + self, + **kwargs: Any + ) -> None: """Get '1.034E+20' numeric value. :keyword float_query: '1.034E+20'numeric value. The default value is 103400000000000000000. @@ -2551,19 +3437,24 @@ def float_scientific_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", 103400000000000000000) # type: float + float_query = kwargs.pop('float_query', 103400000000000000000) # type: float + request = build_queries_float_scientific_positive_request( float_query=float_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2574,8 +3465,13 @@ def float_scientific_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def float_scientific_negative(self, **kwargs: Any) -> None: + def float_scientific_negative( + self, + **kwargs: Any + ) -> None: """Get '-1.034E-20' numeric value. :keyword float_query: '-1.034E-20'numeric value. The default value is -1.034e-20. Note that @@ -2585,19 +3481,24 @@ def float_scientific_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - float_query = kwargs.pop("float_query", -1.034e-20) # type: float + float_query = kwargs.pop('float_query', -1.034e-20) # type: float + request = build_queries_float_scientific_negative_request( float_query=float_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2608,8 +3509,15 @@ def float_scientific_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def float_null(self, *, float_query: Optional[float] = None, **kwargs: Any) -> None: + def float_null( + self, + *, + float_query: Optional[float] = None, + **kwargs: Any + ) -> None: """Get null numeric value (no query parameter). :keyword float_query: null numeric value. @@ -2618,17 +3526,23 @@ def float_null(self, *, float_query: Optional[float] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_float_null_request( float_query=float_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2639,8 +3553,13 @@ def float_null(self, *, float_query: Optional[float] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def double_decimal_positive(self, **kwargs: Any) -> None: + def double_decimal_positive( + self, + **kwargs: Any + ) -> None: """Get '9999999.999' numeric value. :keyword double_query: '9999999.999'numeric value. The default value is 9999999.999. Note that @@ -2650,19 +3569,24 @@ def double_decimal_positive(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", 9999999.999) # type: float + double_query = kwargs.pop('double_query', 9999999.999) # type: float + request = build_queries_double_decimal_positive_request( double_query=double_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2673,8 +3597,13 @@ def double_decimal_positive(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def double_decimal_negative(self, **kwargs: Any) -> None: + def double_decimal_negative( + self, + **kwargs: Any + ) -> None: """Get '-9999999.999' numeric value. :keyword double_query: '-9999999.999'numeric value. The default value is -9999999.999. Note @@ -2684,19 +3613,24 @@ def double_decimal_negative(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - double_query = kwargs.pop("double_query", -9999999.999) # type: float + double_query = kwargs.pop('double_query', -9999999.999) # type: float + request = build_queries_double_decimal_negative_request( double_query=double_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2707,8 +3641,15 @@ def double_decimal_negative(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def double_null(self, *, double_query: Optional[float] = None, **kwargs: Any) -> None: + def double_null( + self, + *, + double_query: Optional[float] = None, + **kwargs: Any + ) -> None: """Get null numeric value (no query parameter). :keyword double_query: null numeric value. @@ -2717,17 +3658,23 @@ def double_null(self, *, double_query: Optional[float] = None, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_double_null_request( double_query=double_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2738,8 +3685,13 @@ def double_null(self, *, double_query: Optional[float] = None, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_unicode(self, **kwargs: Any) -> None: + def string_unicode( + self, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. :keyword string_query: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. The default value is "啊齄丂狛狜隣郎隣兀﨩". @@ -2749,19 +3701,24 @@ def string_unicode(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "啊齄丂狛狜隣郎隣兀﨩") # type: str + string_query = kwargs.pop('string_query', "啊齄丂狛狜隣郎隣兀﨩") # type: str + request = build_queries_string_unicode_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2772,8 +3729,13 @@ def string_unicode(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_url_encoded(self, **kwargs: Any) -> None: + def string_url_encoded( + self, + **kwargs: Any + ) -> None: """Get 'begin!*'();:@ &=+$,/?#[]end. :keyword string_query: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. The default @@ -2784,19 +3746,24 @@ def string_url_encoded(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "begin!*'();:@ &=+$,/?#[]end") # type: str + string_query = kwargs.pop('string_query', "begin!*'();:@ &=+$,/?#[]end") # type: str + request = build_queries_string_url_encoded_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2807,8 +3774,13 @@ def string_url_encoded(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_empty(self, **kwargs: Any) -> None: + def string_empty( + self, + **kwargs: Any + ) -> None: """Get ''. :keyword string_query: '' string value. The default value is "". Note that overriding this @@ -2818,19 +3790,24 @@ def string_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - string_query = kwargs.pop("string_query", "") # type: str + string_query = kwargs.pop('string_query', "") # type: str + request = build_queries_string_empty_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2841,8 +3818,15 @@ def string_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def string_null(self, *, string_query: Optional[str] = None, **kwargs: Any) -> None: + def string_null( + self, + *, + string_query: Optional[str] = None, + **kwargs: Any + ) -> None: """Get null (no query parameter in url). :keyword string_query: null string value. @@ -2851,17 +3835,23 @@ def string_null(self, *, string_query: Optional[str] = None, **kwargs: Any) -> N :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_string_null_request( string_query=string_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2872,8 +3862,15 @@ def string_null(self, *, string_query: Optional[str] = None, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def enum_valid(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None: + def enum_valid( + self, + *, + enum_query: Optional[str] = None, + **kwargs: Any + ) -> None: """Get using uri with query parameter 'green color'. :keyword enum_query: 'green color' enum value. Possible values are: "red color", "green color", @@ -2883,17 +3880,23 @@ def enum_valid(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_enum_valid_request( enum_query=enum_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2904,8 +3907,15 @@ def enum_valid(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def enum_null(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None: + def enum_null( + self, + *, + enum_query: Optional[str] = None, + **kwargs: Any + ) -> None: """Get null (no query parameter in url). :keyword enum_query: null string value. Possible values are: "red color", "green color", and @@ -2915,17 +3925,23 @@ def enum_null(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_enum_null_request( enum_query=enum_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2936,8 +3952,15 @@ def enum_null(self, *, enum_query: Optional[str] = None, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def byte_multi_byte(self, *, byte_query: Optional[bytearray] = None, **kwargs: Any) -> None: + def byte_multi_byte( + self, + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. :keyword byte_query: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. @@ -2946,17 +3969,23 @@ def byte_multi_byte(self, *, byte_query: Optional[bytearray] = None, **kwargs: A :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_byte_multi_byte_request( byte_query=byte_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2967,8 +3996,13 @@ def byte_multi_byte(self, *, byte_query: Optional[bytearray] = None, **kwargs: A if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def byte_empty(self, **kwargs: Any) -> None: + def byte_empty( + self, + **kwargs: Any + ) -> None: """Get '' as byte array. :keyword byte_query: '' as byte array. The default value is bytearray("", encoding="utf-8"). @@ -2978,19 +4012,24 @@ def byte_empty(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - byte_query = kwargs.pop("byte_query", bytearray("", encoding="utf-8")) # type: bytearray + byte_query = kwargs.pop('byte_query', bytearray("", encoding="utf-8")) # type: bytearray + request = build_queries_byte_empty_request( byte_query=byte_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3001,8 +4040,15 @@ def byte_empty(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def byte_null(self, *, byte_query: Optional[bytearray] = None, **kwargs: Any) -> None: + def byte_null( + self, + *, + byte_query: Optional[bytearray] = None, + **kwargs: Any + ) -> None: """Get null as byte array (no query parameters in uri). :keyword byte_query: null as byte array (no query parameters in uri). @@ -3011,17 +4057,23 @@ def byte_null(self, *, byte_query: Optional[bytearray] = None, **kwargs: Any) -> :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_byte_null_request( byte_query=byte_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3032,8 +4084,13 @@ def byte_null(self, *, byte_query: Optional[bytearray] = None, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_valid(self, **kwargs: Any) -> None: + def date_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01' as date. :keyword date_query: '2012-01-01' as date. The default value is "2012-01-01". Note that @@ -3043,19 +4100,24 @@ def date_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_query = kwargs.pop("date_query", "2012-01-01") # type: datetime.date + date_query = kwargs.pop('date_query', "2012-01-01") # type: datetime.date + request = build_queries_date_valid_request( date_query=date_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3066,8 +4128,15 @@ def date_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_null(self, *, date_query: Optional[datetime.date] = None, **kwargs: Any) -> None: + def date_null( + self, + *, + date_query: Optional[datetime.date] = None, + **kwargs: Any + ) -> None: """Get null as date - this should result in no query parameters in uri. :keyword date_query: null as date (no query parameters in uri). @@ -3076,17 +4145,23 @@ def date_null(self, *, date_query: Optional[datetime.date] = None, **kwargs: Any :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_date_null_request( date_query=date_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3097,8 +4172,13 @@ def date_null(self, *, date_query: Optional[datetime.date] = None, **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_time_valid(self, **kwargs: Any) -> None: + def date_time_valid( + self, + **kwargs: Any + ) -> None: """Get '2012-01-01T01:01:01Z' as date-time. :keyword date_time_query: '2012-01-01T01:01:01Z' as date-time. The default value is @@ -3109,19 +4189,24 @@ def date_time_valid(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - date_time_query = kwargs.pop("date_time_query", "2012-01-01T01:01:01Z") # type: datetime.datetime + date_time_query = kwargs.pop('date_time_query', "2012-01-01T01:01:01Z") # type: datetime.datetime + request = build_queries_date_time_valid_request( date_time_query=date_time_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3132,8 +4217,15 @@ def date_time_valid(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def date_time_null(self, *, date_time_query: Optional[datetime.datetime] = None, **kwargs: Any) -> None: + def date_time_null( + self, + *, + date_time_query: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: """Get null as date-time, should result in no query parameters in uri. :keyword date_time_query: null as date-time (no query parameters). @@ -3142,17 +4234,23 @@ def date_time_null(self, *, date_time_query: Optional[datetime.datetime] = None, :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_date_time_null_request( date_time_query=date_time_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3163,8 +4261,15 @@ def date_time_null(self, *, date_time_query: Optional[datetime.datetime] = None, if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_csv_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_csv_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -3175,17 +4280,23 @@ def array_string_csv_valid(self, *, array_query: Optional[List[str]] = None, **k :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_csv_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3196,8 +4307,15 @@ def array_string_csv_valid(self, *, array_query: Optional[List[str]] = None, **k if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_csv_null(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_csv_null( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get a null array of string using the csv-array format. :keyword array_query: a null array of string using the csv-array format. @@ -3206,17 +4324,23 @@ def array_string_csv_null(self, *, array_query: Optional[List[str]] = None, **kw :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_csv_null_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3227,8 +4351,15 @@ def array_string_csv_null(self, *, array_query: Optional[List[str]] = None, **kw if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_csv_empty(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_csv_empty( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an empty array [] of string using the csv-array format. :keyword array_query: an empty array [] of string using the csv-array format. @@ -3237,17 +4368,23 @@ def array_string_csv_empty(self, *, array_query: Optional[List[str]] = None, **k :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_csv_empty_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3258,9 +4395,14 @@ def array_string_csv_empty(self, *, array_query: Optional[List[str]] = None, **k if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def array_string_no_collection_format_empty( - self, *, array_query: Optional[List[str]] = None, **kwargs: Any + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any ) -> None: """Array query has no defined collection format, should default to csv. Pass in ['hello', 'nihao', 'bonjour'] for the 'arrayQuery' parameter to the service. @@ -3271,17 +4413,23 @@ def array_string_no_collection_format_empty( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_no_collection_format_empty_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3292,8 +4440,15 @@ def array_string_no_collection_format_empty( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_ssv_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_ssv_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format. @@ -3304,17 +4459,23 @@ def array_string_ssv_valid(self, *, array_query: Optional[List[str]] = None, **k :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_ssv_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3325,8 +4486,15 @@ def array_string_ssv_valid(self, *, array_query: Optional[List[str]] = None, **k if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_tsv_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_tsv_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format. @@ -3337,17 +4505,23 @@ def array_string_tsv_valid(self, *, array_query: Optional[List[str]] = None, **k :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_tsv_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3358,8 +4532,15 @@ def array_string_tsv_valid(self, *, array_query: Optional[List[str]] = None, **k if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def array_string_pipes_valid(self, *, array_query: Optional[List[str]] = None, **kwargs: Any) -> None: + def array_string_pipes_valid( + self, + *, + array_query: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format. @@ -3370,17 +4551,23 @@ def array_string_pipes_valid(self, *, array_query: Optional[List[str]] = None, * :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_queries_array_string_pipes_valid_request( array_query=array_query, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3437,10 +4624,14 @@ def get_all_with_values( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_path_items_get_all_with_values_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -3452,7 +4643,9 @@ def get_all_with_values( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3463,6 +4656,8 @@ def get_all_with_values( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def get_global_query_null( self, @@ -3490,10 +4685,14 @@ def get_global_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_path_items_get_global_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -3505,7 +4704,9 @@ def get_global_query_null( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3516,6 +4717,8 @@ def get_global_query_null( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def get_global_and_local_query_null( self, @@ -3543,10 +4746,14 @@ def get_global_and_local_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_path_items_get_global_and_local_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -3558,7 +4765,9 @@ def get_global_and_local_query_null( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3569,6 +4778,8 @@ def get_global_and_local_query_null( if cls: return cls(pipeline_response, None, {}) + + @distributed_trace def get_local_path_item_query_null( self, @@ -3595,10 +4806,14 @@ def get_local_path_item_query_null( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_path_items_get_local_path_item_query_null_request( path_item_string_path=path_item_string_path, global_string_path=self._config.global_string_path, @@ -3610,7 +4825,9 @@ def get_local_path_item_query_null( request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -3620,3 +4837,5 @@ def get_local_path_item_query_null( if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py index 1ec830f56e0..05d986a5b18 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest. No server backend exists for these tests. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/__init__.py index c8dbba243f7..a7fe6d7f4b4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestValidationTest"] +__all__ = ['AutoRestValidationTest'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_auto_rest_validation_test.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_auto_rest_validation_test.py index 94855d52e8a..4fd845bbd40 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_auto_rest_validation_test.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_auto_rest_validation_test.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestValidationTest(AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. @@ -33,14 +32,21 @@ class AutoRestValidationTest(AutoRestValidationTestOperationsMixin): :paramtype api_version: str """ - def __init__(self, subscription_id: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + subscription_id: str, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestValidationTestConfiguration(subscription_id=subscription_id, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_configuration.py index a9856ab1ed8..4ae96310066 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_configuration.py @@ -27,28 +27,33 @@ class AutoRestValidationTestConfiguration(Configuration): # pylint: disable=too :paramtype api_version: str """ - def __init__(self, subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + **kwargs: Any + ) -> None: super(AutoRestValidationTestConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.subscription_id = subscription_id self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestvalidationtest/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestvalidationtest/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/__init__.py index adb8f49fa29..9ee947471bb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestValidationTestOperationsMixin __all__ = [ - "AutoRestValidationTestOperationsMixin", + 'AutoRestValidationTestOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py index 67ce5f9e12e..01b194f5f67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,41 +16,46 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() - def build_validation_of_method_parameters_request( - subscription_id: str, resource_group_name: str, id: int, **kwargs: Any + subscription_id: str, + resource_group_name: str, + id: int, + **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str accept = "application/json" # Construct URL - url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" + url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=10, min_length=3, pattern=r"[a-zA-Z0-9\']+" - ), - "id": _SERIALIZER.url("id", id, "int", maximum=1000, minimum=100, multiple=10), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9\']+'), + "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["apiVersion"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) def build_validation_of_body_request( @@ -68,62 +67,75 @@ def build_validation_of_body_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop("api_version", "1.0.0") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + api_version = kwargs.pop('api_version', "1.0.0") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" + url = '/fakepath/{subscriptionId}/{resourceGroupName}/{id}' path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=10, min_length=3, pattern=r"[a-zA-Z0-9]+" - ), - "id": _SERIALIZER.url("id", id, "int", maximum=1000, minimum=100, multiple=10), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'), + "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), } url = _format_url_section(url, **path_format_arguments) # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["apiVersion"] = _SERIALIZER.query("api_version", api_version, "str") + query_parameters['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs ) -def build_get_with_constant_in_path_request(**kwargs: Any) -> HttpRequest: - constant_param = kwargs.pop("constant_param", "constant") # type: str +def build_get_with_constant_in_path_request( + **kwargs: Any +) -> HttpRequest: + constant_param = kwargs.pop('constant_param', "constant") # type: str # Construct URL - url = "/validation/constantsInPath/{constantParam}/value" + url = '/validation/constantsInPath/{constantParam}/value' path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, "str"), + "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), } url = _format_url_section(url, **path_format_arguments) - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) def build_post_with_constant_in_body_request( - *, json: JSONType = None, content: Any = None, **kwargs: Any + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any ) -> HttpRequest: - constant_param = kwargs.pop("constant_param", "constant") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] + constant_param = kwargs.pop('constant_param', "constant") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/json" # Construct URL - url = "/validation/constantsInPath/{constantParam}/value" + url = '/validation/constantsInPath/{constantParam}/value' path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, "str"), + "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), } url = _format_url_section(url, **path_format_arguments) @@ -131,15 +143,27 @@ def build_post_with_constant_in_body_request( # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, headers=header_parameters, json=json, content=content, **kwargs) + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AutoRestValidationTestOperationsMixin(object): + @distributed_trace - def validation_of_method_parameters(self, resource_group_name: str, id: int, **kwargs: Any) -> JSONType: + def validation_of_method_parameters( + self, + resource_group_name: str, + id: int, + **kwargs: Any + ) -> JSONType: """Validates input parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. @@ -180,12 +204,15 @@ def validation_of_method_parameters(self, resource_group_name: str, id: int, **k "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str + request = build_validation_of_method_parameters_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, @@ -195,7 +222,9 @@ def validation_of_method_parameters(self, resource_group_name: str, id: int, **k request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -213,8 +242,16 @@ def validation_of_method_parameters(self, resource_group_name: str, id: int, **k return deserialized + + @distributed_trace - def validation_of_body(self, resource_group_name: str, id: int, body: JSONType = None, **kwargs: Any) -> JSONType: + def validation_of_body( + self, + resource_group_name: str, + id: int, + body: JSONType = None, + **kwargs: Any + ) -> JSONType: """Validates body parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. @@ -284,12 +321,14 @@ def validation_of_body(self, resource_group_name: str, id: int, body: JSONType = "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "1.0.0") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: _json = body @@ -307,7 +346,9 @@ def validation_of_body(self, resource_group_name: str, id: int, body: JSONType = request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -325,8 +366,13 @@ def validation_of_body(self, resource_group_name: str, id: int, body: JSONType = return deserialized + + @distributed_trace - def get_with_constant_in_path(self, **kwargs: Any) -> None: + def get_with_constant_in_path( + self, + **kwargs: Any + ) -> None: """get_with_constant_in_path. :keyword constant_param: The default value is "constant". Note that overriding this default @@ -336,19 +382,24 @@ def get_with_constant_in_path(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str + constant_param = kwargs.pop('constant_param', "constant") # type: str + request = build_get_with_constant_in_path_request( constant_param=constant_param, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -359,8 +410,14 @@ def get_with_constant_in_path(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) -> JSONType: + def post_with_constant_in_body( + self, + body: JSONType = None, + **kwargs: Any + ) -> JSONType: """post_with_constant_in_body. :param body: @@ -429,12 +486,14 @@ def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) -> JS "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + constant_param = kwargs.pop('constant_param', "constant") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: _json = body @@ -449,7 +508,9 @@ def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) -> JS request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -466,3 +527,5 @@ def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) -> JS return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/__init__.py index e0ac5945ea6..ca3a949b63f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_validation_test import AutoRestValidationTest - -__all__ = ["AutoRestValidationTest"] +__all__ = ['AutoRestValidationTest'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_auto_rest_validation_test.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_auto_rest_validation_test.py index 499f68ab1f6..268842f0184 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_auto_rest_validation_test.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_auto_rest_validation_test.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestValidationTest(AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. @@ -33,14 +32,25 @@ class AutoRestValidationTest(AutoRestValidationTestOperationsMixin): :paramtype api_version: str """ - def __init__(self, subscription_id: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestValidationTestConfiguration(subscription_id=subscription_id, **kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_configuration.py index c5cf575016b..745dd7740e0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_configuration.py @@ -27,25 +27,32 @@ class AutoRestValidationTestConfiguration(Configuration): # pylint: disable=too :paramtype api_version: str """ - def __init__(self, subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + subscription_id: str, + **kwargs: Any + ) -> None: super(AutoRestValidationTestConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") self.subscription_id = subscription_id self.api_version = api_version - kwargs.setdefault("sdk_moniker", "autorestvalidationtest/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestvalidationtest/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/__init__.py index adb8f49fa29..9ee947471bb 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import AutoRestValidationTestOperationsMixin __all__ = [ - "AutoRestValidationTestOperationsMixin", + 'AutoRestValidationTestOperationsMixin', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py index 5cad37b08e1..6624cb584f6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py @@ -8,33 +8,26 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ..._operations._operations import ( - build_get_with_constant_in_path_request, - build_post_with_constant_in_body_request, - build_validation_of_body_request, - build_validation_of_method_parameters_request, -) - -T = TypeVar("T") +from ..._operations._operations import build_get_with_constant_in_path_request, build_post_with_constant_in_body_request, build_validation_of_body_request, build_validation_of_method_parameters_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class AutoRestValidationTestOperationsMixin: + @distributed_trace_async - async def validation_of_method_parameters(self, resource_group_name: str, id: int, **kwargs: Any) -> JSONType: + async def validation_of_method_parameters( + self, + resource_group_name: str, + id: int, + **kwargs: Any + ) -> JSONType: """Validates input parameters on the method. See swagger for details. :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. @@ -75,12 +68,15 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str + api_version = kwargs.pop('api_version', "1.0.0") # type: str + request = build_validation_of_method_parameters_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, @@ -90,7 +86,9 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -108,9 +106,15 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in return deserialized + + @distributed_trace_async async def validation_of_body( - self, resource_group_name: str, id: int, body: JSONType = None, **kwargs: Any + self, + resource_group_name: str, + id: int, + body: JSONType = None, + **kwargs: Any ) -> JSONType: """Validates body parameters on the method. See swagger for details. @@ -181,12 +185,14 @@ async def validation_of_body( "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop("api_version", "1.0.0") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "1.0.0") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: _json = body @@ -204,7 +210,9 @@ async def validation_of_body( request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -222,8 +230,13 @@ async def validation_of_body( return deserialized + + @distributed_trace_async - async def get_with_constant_in_path(self, **kwargs: Any) -> None: + async def get_with_constant_in_path( + self, + **kwargs: Any + ) -> None: """get_with_constant_in_path. :keyword constant_param: The default value is "constant". Note that overriding this default @@ -233,19 +246,24 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str + constant_param = kwargs.pop('constant_param', "constant") # type: str + request = build_get_with_constant_in_path_request( constant_param=constant_param, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -256,8 +274,14 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) -> JSONType: + async def post_with_constant_in_body( + self, + body: JSONType = None, + **kwargs: Any + ) -> JSONType: """post_with_constant_in_body. :param body: @@ -326,12 +350,14 @@ async def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) "image": "str" # Optional. Image URL representing the product. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - constant_param = kwargs.pop("constant_param", "constant") # type: str - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + constant_param = kwargs.pop('constant_param', "constant") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if body is not None: _json = body @@ -346,7 +372,9 @@ async def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -363,3 +391,5 @@ async def post_with_constant_in_body(self, body: JSONType = None, **kwargs: Any) return cls(pipeline_response, deserialized, {}) return deserialized + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py index 08f2e587366..0336771b01f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ Test Infrastructure for AutoRest Swagger BAT. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/__init__.py index 314965dfed4..947d93c2fb2 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["AutoRestSwaggerBATXMLService"] +__all__ = ['AutoRestSwaggerBATXMLService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_auto_rest_swagger_batxml_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_auto_rest_swagger_batxml_service.py index 90769bc1140..76c835420e7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_auto_rest_swagger_batxml_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_auto_rest_swagger_batxml_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATXMLService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,8 +29,13 @@ class AutoRestSwaggerBATXMLService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = AutoRestSwaggerBATXMLServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.xml = XmlOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_configuration.py index ff5722e2a21..8042eb9a355 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): # pylint: disab attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATXMLServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatxmlservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatxmlservice/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/__init__.py index 135889b0d43..6625d429aa0 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._auto_rest_swagger_batxml_service import AutoRestSwaggerBATXMLService - -__all__ = ["AutoRestSwaggerBATXMLService"] +__all__ = ['AutoRestSwaggerBATXMLService'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_auto_rest_swagger_batxml_service.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_auto_rest_swagger_batxml_service.py index 066ba3395ba..9ba45de2075 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_auto_rest_swagger_batxml_service.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_auto_rest_swagger_batxml_service.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class AutoRestSwaggerBATXMLService: """Test Infrastructure for AutoRest Swagger BAT. @@ -30,7 +29,12 @@ class AutoRestSwaggerBATXMLService: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestSwaggerBATXMLServiceConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.xml = XmlOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_configuration.py index c6d89c576de..0284a42a242 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class AutoRestSwaggerBATXMLServiceConfiguration(Configuration): # pylint: disab attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(AutoRestSwaggerBATXMLServiceConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "autorestswaggerbatxmlservice/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'autorestswaggerbatxmlservice/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/__init__.py index 9096fef93cd..783684b7f5e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import XmlOperations __all__ = [ - "XmlOperations", + 'XmlOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py index b802d2a8d27..5dfdb5f0727 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py @@ -9,60 +9,17 @@ from typing import Any, Callable, Dict, List, Optional, TypeVar from xml.etree import ElementTree as ET -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_xml_get_acls_request, - build_xml_get_bytes_request, - build_xml_get_complex_type_ref_no_meta_request, - build_xml_get_complex_type_ref_with_meta_request, - build_xml_get_empty_child_element_request, - build_xml_get_empty_list_request, - build_xml_get_empty_root_list_request, - build_xml_get_empty_wrapped_lists_request, - build_xml_get_headers_request, - build_xml_get_root_list_request, - build_xml_get_root_list_single_item_request, - build_xml_get_service_properties_request, - build_xml_get_simple_request, - build_xml_get_uri_request, - build_xml_get_wrapped_lists_request, - build_xml_get_xms_text_request, - build_xml_json_input_request, - build_xml_json_output_request, - build_xml_list_blobs_request, - build_xml_list_containers_request, - build_xml_put_acls_request, - build_xml_put_binary_request, - build_xml_put_complex_type_ref_no_meta_request, - build_xml_put_complex_type_ref_with_meta_request, - build_xml_put_empty_child_element_request, - build_xml_put_empty_list_request, - build_xml_put_empty_root_list_request, - build_xml_put_empty_wrapped_lists_request, - build_xml_put_root_list_request, - build_xml_put_root_list_single_item_request, - build_xml_put_service_properties_request, - build_xml_put_simple_request, - build_xml_put_uri_request, - build_xml_put_wrapped_lists_request, -) - -T = TypeVar("T") +from ...operations._operations import build_xml_get_acls_request, build_xml_get_bytes_request, build_xml_get_complex_type_ref_no_meta_request, build_xml_get_complex_type_ref_with_meta_request, build_xml_get_empty_child_element_request, build_xml_get_empty_list_request, build_xml_get_empty_root_list_request, build_xml_get_empty_wrapped_lists_request, build_xml_get_headers_request, build_xml_get_root_list_request, build_xml_get_root_list_single_item_request, build_xml_get_service_properties_request, build_xml_get_simple_request, build_xml_get_uri_request, build_xml_get_wrapped_lists_request, build_xml_get_xms_text_request, build_xml_json_input_request, build_xml_json_output_request, build_xml_list_blobs_request, build_xml_list_containers_request, build_xml_put_acls_request, build_xml_put_binary_request, build_xml_put_complex_type_ref_no_meta_request, build_xml_put_complex_type_ref_with_meta_request, build_xml_put_empty_child_element_request, build_xml_put_empty_list_request, build_xml_put_empty_root_list_request, build_xml_put_empty_wrapped_lists_request, build_xml_put_root_list_request, build_xml_put_root_list_single_item_request, build_xml_put_service_properties_request, build_xml_put_simple_request, build_xml_put_uri_request, build_xml_put_wrapped_lists_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class XmlOperations: # pylint: disable=too-many-public-methods """XmlOperations async operations. @@ -82,7 +39,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> JSONType: + async def get_complex_type_ref_no_meta( + self, + **kwargs: Any + ) -> JSONType: """Get a complex type that has a ref to a complex type with no XML node. :return: JSON object @@ -100,15 +60,21 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> JSONType: "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_complex_type_ref_no_meta_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_complex_type_ref_no_meta_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -126,8 +92,14 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> None: + async def put_complex_type_ref_no_meta( + self, + model: JSONType, + **kwargs: Any + ) -> None: """Puts a complex type that has a ref to a complex type with no XML node. :param model: @@ -147,11 +119,13 @@ async def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = model @@ -162,7 +136,9 @@ async def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -173,8 +149,13 @@ async def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> JSONType: + async def get_complex_type_ref_with_meta( + self, + **kwargs: Any + ) -> JSONType: """Get a complex type that has a ref to a complex type with XML node. :return: JSON object @@ -192,15 +173,21 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> JSONType: "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_complex_type_ref_with_meta_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_complex_type_ref_with_meta_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -218,8 +205,14 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) -> None: + async def put_complex_type_ref_with_meta( + self, + model: JSONType, + **kwargs: Any + ) -> None: """Puts a complex type that has a ref to a complex type with XML node. :param model: @@ -239,11 +232,13 @@ async def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) - "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = model @@ -254,7 +249,9 @@ async def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -265,8 +262,13 @@ async def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_simple(self, **kwargs: Any) -> JSONType: + async def get_simple( + self, + **kwargs: Any + ) -> JSONType: """Get a simple XML document. :return: JSON object @@ -292,15 +294,21 @@ async def get_simple(self, **kwargs: Any) -> JSONType: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_simple_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_simple_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -318,8 +326,14 @@ async def get_simple(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: + async def put_simple( + self, + slideshow: JSONType, + **kwargs: Any + ) -> None: """Put a simple XML document. :param slideshow: @@ -347,11 +361,13 @@ async def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = slideshow @@ -362,7 +378,9 @@ async def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -373,8 +391,13 @@ async def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_wrapped_lists(self, **kwargs: Any) -> JSONType: + async def get_wrapped_lists( + self, + **kwargs: Any + ) -> JSONType: """Get an XML document with multiple wrapped lists. :return: JSON object @@ -394,15 +417,21 @@ async def get_wrapped_lists(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_wrapped_lists_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_wrapped_lists_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -420,8 +449,14 @@ async def get_wrapped_lists(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> None: + async def put_wrapped_lists( + self, + wrapped_lists: JSONType, + **kwargs: Any + ) -> None: """Put an XML document with multiple wrapped lists. :param wrapped_lists: @@ -443,11 +478,13 @@ async def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> Non ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = wrapped_lists @@ -458,7 +495,9 @@ async def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> Non request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -469,23 +508,34 @@ async def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> Non if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_headers(self, **kwargs: Any) -> None: + async def get_headers( + self, + **kwargs: Any + ) -> None: """Get strongly-typed response headers. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_headers_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_headers_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -494,13 +544,19 @@ async def get_headers(self, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["Custom-Header"] = self._deserialize("str", response.headers.get("Custom-Header")) + response_headers['Custom-Header']=self._deserialize('str', response.headers.get('Custom-Header')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace_async - async def get_empty_list(self, **kwargs: Any) -> JSONType: + async def get_empty_list( + self, + **kwargs: Any + ) -> JSONType: """Get an empty list. :return: JSON object @@ -526,15 +582,21 @@ async def get_empty_list(self, **kwargs: Any) -> JSONType: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_list_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_list_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -552,8 +614,14 @@ async def get_empty_list(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: + async def put_empty_list( + self, + slideshow: JSONType, + **kwargs: Any + ) -> None: """Puts an empty list. :param slideshow: @@ -581,11 +649,13 @@ async def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = slideshow @@ -596,7 +666,9 @@ async def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -607,8 +679,13 @@ async def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty_wrapped_lists(self, **kwargs: Any) -> JSONType: + async def get_empty_wrapped_lists( + self, + **kwargs: Any + ) -> JSONType: """Gets some empty wrapped lists. :return: JSON object @@ -628,15 +705,21 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_wrapped_lists_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_wrapped_lists_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -654,8 +737,14 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) -> None: + async def put_empty_wrapped_lists( + self, + apple_barrel: JSONType, + **kwargs: Any + ) -> None: """Puts some empty wrapped lists. :param apple_barrel: @@ -677,11 +766,13 @@ async def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) - ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = apple_barrel @@ -692,7 +783,9 @@ async def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) - request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -703,8 +796,13 @@ async def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_root_list(self, **kwargs: Any) -> List[JSONType]: + async def get_root_list( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets a list as the root element. :return: list of JSON object @@ -724,15 +822,21 @@ async def get_root_list(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_root_list_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_root_list_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -750,8 +854,14 @@ async def get_root_list(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: + async def put_root_list( + self, + bananas: List[JSONType], + **kwargs: Any + ) -> None: """Puts a list as the root element. :param bananas: @@ -773,11 +883,13 @@ async def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = bananas @@ -788,7 +900,9 @@ async def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -799,8 +913,13 @@ async def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_root_list_single_item(self, **kwargs: Any) -> List[JSONType]: + async def get_root_list_single_item( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets a list with a single item. :return: list of JSON object @@ -820,15 +939,21 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_root_list_single_item_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_root_list_single_item_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -846,8 +971,14 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any) -> None: + async def put_root_list_single_item( + self, + bananas: List[JSONType], + **kwargs: Any + ) -> None: """Puts a list with a single item. :param bananas: @@ -869,11 +1000,13 @@ async def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = bananas @@ -884,7 +1017,9 @@ async def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -895,8 +1030,13 @@ async def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty_root_list(self, **kwargs: Any) -> List[JSONType]: + async def get_empty_root_list( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets an empty list as the root element. :return: list of JSON object @@ -916,15 +1056,21 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_root_list_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_root_list_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -942,8 +1088,14 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: + async def put_empty_root_list( + self, + bananas: List[JSONType], + **kwargs: Any + ) -> None: """Puts an empty list as the root element. :param bananas: @@ -965,11 +1117,13 @@ async def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> N } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = bananas @@ -980,7 +1134,9 @@ async def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -991,8 +1147,13 @@ async def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_empty_child_element(self, **kwargs: Any) -> JSONType: + async def get_empty_child_element( + self, + **kwargs: Any + ) -> JSONType: """Gets an XML document with an empty child element. :return: JSON object @@ -1010,15 +1171,21 @@ async def get_empty_child_element(self, **kwargs: Any) -> JSONType: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_child_element_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_child_element_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1036,8 +1203,14 @@ async def get_empty_child_element(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None: + async def put_empty_child_element( + self, + banana: JSONType, + **kwargs: Any + ) -> None: """Puts a value with an empty child element. :param banana: @@ -1057,11 +1230,13 @@ async def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = banana @@ -1072,7 +1247,9 @@ async def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1083,8 +1260,13 @@ async def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def list_containers(self, **kwargs: Any) -> JSONType: + async def list_containers( + self, + **kwargs: Any + ) -> JSONType: """Lists containers in a storage account. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -1127,19 +1309,24 @@ async def list_containers(self, **kwargs: Any) -> JSONType: "ServiceEndpoint": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str + comp = kwargs.pop('comp', "list") # type: str + request = build_xml_list_containers_request( comp=comp, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1157,8 +1344,13 @@ async def list_containers(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_service_properties(self, **kwargs: Any) -> JSONType: + async def get_service_properties( + self, + **kwargs: Any + ) -> JSONType: """Gets storage service properties. :keyword comp: The default value is "properties". Note that overriding this default value may @@ -1255,13 +1447,16 @@ async def get_service_properties(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + request = build_xml_get_service_properties_request( comp=comp, restype=restype, @@ -1269,7 +1464,9 @@ async def get_service_properties(self, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1287,8 +1484,14 @@ async def get_service_properties(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_service_properties(self, properties: JSONType, **kwargs: Any) -> None: + async def put_service_properties( + self, + properties: JSONType, + **kwargs: Any + ) -> None: """Puts storage service properties. :param properties: @@ -1387,13 +1590,15 @@ async def put_service_properties(self, properties: JSONType, **kwargs: Any) -> N } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = properties @@ -1406,7 +1611,9 @@ async def put_service_properties(self, properties: JSONType, **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1417,8 +1624,13 @@ async def put_service_properties(self, properties: JSONType, **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_acls(self, **kwargs: Any) -> List[JSONType]: + async def get_acls( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets storage ACLs for a container. :keyword comp: The default value is "acl". Note that overriding this default value may result @@ -1449,13 +1661,16 @@ async def get_acls(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_xml_get_acls_request( comp=comp, restype=restype, @@ -1463,7 +1678,9 @@ async def get_acls(self, **kwargs: Any) -> List[JSONType]: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1481,8 +1698,14 @@ async def get_acls(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace_async - async def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: + async def put_acls( + self, + properties: List[JSONType], + **kwargs: Any + ) -> None: """Puts storage ACLs for a container. :param properties: @@ -1515,13 +1738,15 @@ async def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = properties @@ -1534,7 +1759,9 @@ async def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1545,8 +1772,13 @@ async def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def list_blobs(self, **kwargs: Any) -> JSONType: + async def list_blobs( + self, + **kwargs: Any + ) -> JSONType: """Lists blobs in a storage container. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -1651,13 +1883,16 @@ async def list_blobs(self, **kwargs: Any) -> JSONType: "ServiceEndpoint": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_xml_list_blobs_request( comp=comp, restype=restype, @@ -1665,7 +1900,9 @@ async def list_blobs(self, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1683,8 +1920,14 @@ async def list_blobs(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def json_input(self, properties: JSONType, **kwargs: Any) -> None: + async def json_input( + self, + properties: JSONType, + **kwargs: Any + ) -> None: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -1702,11 +1945,13 @@ async def json_input(self, properties: JSONType, **kwargs: Any) -> None: "id": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = properties @@ -1717,7 +1962,9 @@ async def json_input(self, properties: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1728,8 +1975,13 @@ async def json_input(self, properties: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def json_output(self, **kwargs: Any) -> JSONType: + async def json_output( + self, + **kwargs: Any + ) -> JSONType: """A Swagger with XML that has one operation that returns JSON. ID number 42. :return: JSON object @@ -1744,15 +1996,21 @@ async def json_output(self, **kwargs: Any) -> JSONType: "id": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_json_output_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_json_output_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1770,8 +2028,13 @@ async def json_output(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_xms_text(self, **kwargs: Any) -> JSONType: + async def get_xms_text( + self, + **kwargs: Any + ) -> JSONType: """Get back an XML object with an x-ms-text property, which should translate to the returned object's 'language' property being 'english' and its 'content' property being 'I am text'. @@ -1788,15 +2051,21 @@ async def get_xms_text(self, **kwargs: Any) -> JSONType: "language": "str" # Optional. Returned value should be 'english'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_xms_text_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_xms_text_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1814,8 +2083,13 @@ async def get_xms_text(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def get_bytes(self, **kwargs: Any) -> JSONType: + async def get_bytes( + self, + **kwargs: Any + ) -> JSONType: """Get an XML document with binary property. :return: JSON object @@ -1830,15 +2104,21 @@ async def get_bytes(self, **kwargs: Any) -> JSONType: "Bytes": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_bytes_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_bytes_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1856,8 +2136,14 @@ async def get_bytes(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: + async def put_binary( + self, + slideshow: JSONType, + **kwargs: Any + ) -> None: """Put an XML document with binary property. :param slideshow: @@ -1874,11 +2160,13 @@ async def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: "Bytes": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = slideshow @@ -1889,7 +2177,9 @@ async def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1900,8 +2190,13 @@ async def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace_async - async def get_uri(self, **kwargs: Any) -> JSONType: + async def get_uri( + self, + **kwargs: Any + ) -> JSONType: """Get an XML document with uri property. :return: JSON object @@ -1916,15 +2211,21 @@ async def get_uri(self, **kwargs: Any) -> JSONType: "Url": str # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_uri_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_uri_request( + ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1942,8 +2243,14 @@ async def get_uri(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def put_uri(self, model: JSONType, **kwargs: Any) -> None: + async def put_uri( + self, + model: JSONType, + **kwargs: Any + ) -> None: """Put an XML document with uri property. :param model: @@ -1960,11 +2267,13 @@ async def put_uri(self, model: JSONType, **kwargs: Any) -> None: "Url": str # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = model @@ -1975,7 +2284,9 @@ async def put_uri(self, model: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1985,3 +2296,5 @@ async def put_uri(self, model: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/__init__.py index 9096fef93cd..783684b7f5e 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import XmlOperations __all__ = [ - "XmlOperations", + 'XmlOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py index a0748e60e5b..48deb5d56bd 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py @@ -9,515 +9,792 @@ from typing import Any, Callable, Dict, List, Optional, TypeVar from xml.etree import ElementTree as ET -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from msrest import Serializer - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_xml_get_complex_type_ref_no_meta_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_complex_type_ref_no_meta_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/complex-type-ref-no-meta" + url = '/xml/complex-type-ref-no-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_complex_type_ref_no_meta_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_complex_type_ref_no_meta_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/complex-type-ref-no-meta" + url = '/xml/complex-type-ref-no-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_complex_type_ref_with_meta_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_complex_type_ref_with_meta_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/complex-type-ref-with-meta" + url = '/xml/complex-type-ref-with-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_complex_type_ref_with_meta_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_complex_type_ref_with_meta_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/complex-type-ref-with-meta" + url = '/xml/complex-type-ref-with-meta' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_simple_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_simple_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/simple" + url = '/xml/simple' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_simple_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_simple_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/simple" + url = '/xml/simple' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_wrapped_lists_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_wrapped_lists_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/wrapped-lists" + url = '/xml/wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_wrapped_lists_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_wrapped_lists_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/wrapped-lists" + url = '/xml/wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_headers_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_headers_request( + **kwargs: Any +) -> HttpRequest: # Construct URL - url = "/xml/headers" + url = '/xml/headers' - return HttpRequest(method="GET", url=url, **kwargs) + return HttpRequest( + method="GET", + url=url, + **kwargs + ) -def build_xml_get_empty_list_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_empty_list_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-list" + url = '/xml/empty-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_empty_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_empty_list_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-list" + url = '/xml/empty-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_empty_wrapped_lists_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_empty_wrapped_lists_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-wrapped-lists" + url = '/xml/empty-wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_empty_wrapped_lists_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_empty_wrapped_lists_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-wrapped-lists" + url = '/xml/empty-wrapped-lists' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_root_list_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_root_list_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/root-list" + url = '/xml/root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_root_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_root_list_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/root-list" + url = '/xml/root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_root_list_single_item_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_root_list_single_item_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/root-list-single-item" + url = '/xml/root-list-single-item' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_root_list_single_item_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_root_list_single_item_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/root-list-single-item" + url = '/xml/root-list-single-item' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_empty_root_list_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_empty_root_list_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-root-list" + url = '/xml/empty-root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_empty_root_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_empty_root_list_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-root-list" + url = '/xml/empty-root-list' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_empty_child_element_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_empty_child_element_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/empty-child-element" + url = '/xml/empty-child-element' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_empty_child_element_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_empty_child_element_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/empty-child-element" + url = '/xml/empty-child-element' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_list_containers_request(**kwargs: Any) -> HttpRequest: - comp = kwargs.pop("comp", "list") # type: str +def build_xml_list_containers_request( + **kwargs: Any +) -> HttpRequest: + comp = kwargs.pop('comp', "list") # type: str accept = "application/xml" # Construct URL - url = "/xml/" + url = '/xml/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_xml_get_service_properties_request(**kwargs: Any) -> HttpRequest: - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str +def build_xml_get_service_properties_request( + **kwargs: Any +) -> HttpRequest: + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str accept = "application/xml" # Construct URL - url = "/xml/" + url = '/xml/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_xml_put_service_properties_request(*, content: Any, **kwargs: Any) -> HttpRequest: - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_service_properties_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/" + url = '/xml/' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + content=content, + **kwargs ) -def build_xml_get_acls_request(**kwargs: Any) -> HttpRequest: - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str +def build_xml_get_acls_request( + **kwargs: Any +) -> HttpRequest: + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str accept = "application/xml" # Construct URL - url = "/xml/mycontainer" + url = '/xml/mycontainer' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_xml_put_acls_request(*, content: Any, **kwargs: Any) -> HttpRequest: - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_acls_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/mycontainer" + url = '/xml/mycontainer' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( - method="PUT", url=url, params=query_parameters, headers=header_parameters, content=content, **kwargs + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + content=content, + **kwargs ) -def build_xml_list_blobs_request(**kwargs: Any) -> HttpRequest: - comp = kwargs.pop("comp", "list") # type: str - restype = kwargs.pop("restype", "container") # type: str +def build_xml_list_blobs_request( + **kwargs: Any +) -> HttpRequest: + comp = kwargs.pop('comp', "list") # type: str + restype = kwargs.pop('restype', "container") # type: str accept = "application/xml" # Construct URL - url = "/xml/mycontainer" + url = '/xml/mycontainer' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["comp"] = _SERIALIZER.query("comp", comp, "str") - query_parameters["restype"] = _SERIALIZER.query("restype", restype, "str") + query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, params=query_parameters, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) -def build_xml_json_input_request(*, json: JSONType = None, content: Any = None, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_json_input_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] # Construct URL - url = "/xml/jsoninput" + url = '/xml/jsoninput' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, json=json, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) -def build_xml_json_output_request(**kwargs: Any) -> HttpRequest: +def build_xml_json_output_request( + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/xml/jsonoutput" + url = '/xml/jsonoutput' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_get_xms_text_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_xms_text_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/x-ms-text" + url = '/xml/x-ms-text' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_get_bytes_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_bytes_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/bytes" + url = '/xml/bytes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_binary_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/bytes" + url = '/xml/bytes' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) -def build_xml_get_uri_request(**kwargs: Any) -> HttpRequest: +def build_xml_get_uri_request( + **kwargs: Any +) -> HttpRequest: accept = "application/xml" # Construct URL - url = "/xml/url" + url = '/xml/url' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_xml_put_uri_request(*, content: Any, **kwargs: Any) -> HttpRequest: - content_type = kwargs.pop("content_type", None) # type: Optional[str] +def build_xml_put_uri_request( + *, + content: Any, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] accept = "application/xml" # Construct URL - url = "/xml/url" + url = '/xml/url' # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=url, headers=header_parameters, content=content, **kwargs) + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="PUT", + url=url, + headers=header_parameters, + content=content, + **kwargs + ) class XmlOperations(object): # pylint: disable=too-many-public-methods """XmlOperations operations. @@ -538,7 +815,10 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_complex_type_ref_no_meta(self, **kwargs: Any) -> JSONType: + def get_complex_type_ref_no_meta( + self, + **kwargs: Any + ) -> JSONType: """Get a complex type that has a ref to a complex type with no XML node. :return: JSON object @@ -556,15 +836,21 @@ def get_complex_type_ref_no_meta(self, **kwargs: Any) -> JSONType: "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_complex_type_ref_no_meta_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_complex_type_ref_no_meta_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -582,8 +868,14 @@ def get_complex_type_ref_no_meta(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> None: + def put_complex_type_ref_no_meta( + self, + model: JSONType, + **kwargs: Any + ) -> None: """Puts a complex type that has a ref to a complex type with no XML node. :param model: @@ -603,11 +895,13 @@ def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> None: "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = model @@ -618,7 +912,9 @@ def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -629,8 +925,13 @@ def put_complex_type_ref_no_meta(self, model: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_complex_type_ref_with_meta(self, **kwargs: Any) -> JSONType: + def get_complex_type_ref_with_meta( + self, + **kwargs: Any + ) -> JSONType: """Get a complex type that has a ref to a complex type with XML node. :return: JSON object @@ -648,15 +949,21 @@ def get_complex_type_ref_with_meta(self, **kwargs: Any) -> JSONType: "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_complex_type_ref_with_meta_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_complex_type_ref_with_meta_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -674,8 +981,14 @@ def get_complex_type_ref_with_meta(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) -> None: + def put_complex_type_ref_with_meta( + self, + model: JSONType, + **kwargs: Any + ) -> None: """Puts a complex type that has a ref to a complex type with XML node. :param model: @@ -695,11 +1008,13 @@ def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) -> None "Something": "str" # Optional. Something else (just to avoid flattening). } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = model @@ -710,7 +1025,9 @@ def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -721,8 +1038,13 @@ def put_complex_type_ref_with_meta(self, model: JSONType, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_simple(self, **kwargs: Any) -> JSONType: + def get_simple( + self, + **kwargs: Any + ) -> JSONType: """Get a simple XML document. :return: JSON object @@ -748,15 +1070,21 @@ def get_simple(self, **kwargs: Any) -> JSONType: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_simple_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_simple_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -774,8 +1102,14 @@ def get_simple(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: + def put_simple( + self, + slideshow: JSONType, + **kwargs: Any + ) -> None: """Put a simple XML document. :param slideshow: @@ -803,11 +1137,13 @@ def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = slideshow @@ -818,7 +1154,9 @@ def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -829,8 +1167,13 @@ def put_simple(self, slideshow: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_wrapped_lists(self, **kwargs: Any) -> JSONType: + def get_wrapped_lists( + self, + **kwargs: Any + ) -> JSONType: """Get an XML document with multiple wrapped lists. :return: JSON object @@ -850,15 +1193,21 @@ def get_wrapped_lists(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_wrapped_lists_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_wrapped_lists_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -876,8 +1225,14 @@ def get_wrapped_lists(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> None: + def put_wrapped_lists( + self, + wrapped_lists: JSONType, + **kwargs: Any + ) -> None: """Put an XML document with multiple wrapped lists. :param wrapped_lists: @@ -899,11 +1254,13 @@ def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> None: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = wrapped_lists @@ -914,7 +1271,9 @@ def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -925,23 +1284,34 @@ def put_wrapped_lists(self, wrapped_lists: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_headers(self, **kwargs: Any) -> None: + def get_headers( + self, + **kwargs: Any + ) -> None: """Get strongly-typed response headers. :return: None :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_headers_request() + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_headers_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -950,13 +1320,19 @@ def get_headers(self, **kwargs: Any) -> None: raise HttpResponseError(response=response) response_headers = {} - response_headers["Custom-Header"] = self._deserialize("str", response.headers.get("Custom-Header")) + response_headers['Custom-Header']=self._deserialize('str', response.headers.get('Custom-Header')) + if cls: return cls(pipeline_response, None, response_headers) + + @distributed_trace - def get_empty_list(self, **kwargs: Any) -> JSONType: + def get_empty_list( + self, + **kwargs: Any + ) -> JSONType: """Get an empty list. :return: JSON object @@ -982,15 +1358,21 @@ def get_empty_list(self, **kwargs: Any) -> JSONType: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_list_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_list_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1008,8 +1390,14 @@ def get_empty_list(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: + def put_empty_list( + self, + slideshow: JSONType, + **kwargs: Any + ) -> None: """Puts an empty list. :param slideshow: @@ -1037,11 +1425,13 @@ def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: "title": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = slideshow @@ -1052,7 +1442,9 @@ def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1063,8 +1455,13 @@ def put_empty_list(self, slideshow: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty_wrapped_lists(self, **kwargs: Any) -> JSONType: + def get_empty_wrapped_lists( + self, + **kwargs: Any + ) -> JSONType: """Gets some empty wrapped lists. :return: JSON object @@ -1084,15 +1481,21 @@ def get_empty_wrapped_lists(self, **kwargs: Any) -> JSONType: ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_wrapped_lists_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_wrapped_lists_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1110,8 +1513,14 @@ def get_empty_wrapped_lists(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) -> None: + def put_empty_wrapped_lists( + self, + apple_barrel: JSONType, + **kwargs: Any + ) -> None: """Puts some empty wrapped lists. :param apple_barrel: @@ -1133,11 +1542,13 @@ def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) -> None ] } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = apple_barrel @@ -1148,7 +1559,9 @@ def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) -> None request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1159,8 +1572,13 @@ def put_empty_wrapped_lists(self, apple_barrel: JSONType, **kwargs: Any) -> None if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_root_list(self, **kwargs: Any) -> List[JSONType]: + def get_root_list( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets a list as the root element. :return: list of JSON object @@ -1180,15 +1598,21 @@ def get_root_list(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_root_list_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_root_list_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1206,8 +1630,14 @@ def get_root_list(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: + def put_root_list( + self, + bananas: List[JSONType], + **kwargs: Any + ) -> None: """Puts a list as the root element. :param bananas: @@ -1229,11 +1659,13 @@ def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = bananas @@ -1244,7 +1676,9 @@ def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1255,8 +1689,13 @@ def put_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_root_list_single_item(self, **kwargs: Any) -> List[JSONType]: + def get_root_list_single_item( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets a list with a single item. :return: list of JSON object @@ -1276,15 +1715,21 @@ def get_root_list_single_item(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_root_list_single_item_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_root_list_single_item_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1302,8 +1747,14 @@ def get_root_list_single_item(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any) -> None: + def put_root_list_single_item( + self, + bananas: List[JSONType], + **kwargs: Any + ) -> None: """Puts a list with a single item. :param bananas: @@ -1325,11 +1776,13 @@ def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any) -> N } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = bananas @@ -1340,7 +1793,9 @@ def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any) -> N request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1351,8 +1806,13 @@ def put_root_list_single_item(self, bananas: List[JSONType], **kwargs: Any) -> N if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty_root_list(self, **kwargs: Any) -> List[JSONType]: + def get_empty_root_list( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets an empty list as the root element. :return: list of JSON object @@ -1372,15 +1832,21 @@ def get_empty_root_list(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_root_list_request() + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_root_list_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1398,8 +1864,14 @@ def get_empty_root_list(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: + def put_empty_root_list( + self, + bananas: List[JSONType], + **kwargs: Any + ) -> None: """Puts an empty list as the root element. :param bananas: @@ -1421,11 +1893,13 @@ def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = bananas @@ -1436,7 +1910,9 @@ def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1447,8 +1923,13 @@ def put_empty_root_list(self, bananas: List[JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_empty_child_element(self, **kwargs: Any) -> JSONType: + def get_empty_child_element( + self, + **kwargs: Any + ) -> JSONType: """Gets an XML document with an empty child element. :return: JSON object @@ -1466,15 +1947,21 @@ def get_empty_child_element(self, **kwargs: Any) -> JSONType: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_empty_child_element_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_empty_child_element_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1492,8 +1979,14 @@ def get_empty_child_element(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None: + def put_empty_child_element( + self, + banana: JSONType, + **kwargs: Any + ) -> None: """Puts a value with an empty child element. :param banana: @@ -1513,11 +2006,13 @@ def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None: "name": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = banana @@ -1528,7 +2023,9 @@ def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1539,8 +2036,13 @@ def put_empty_child_element(self, banana: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def list_containers(self, **kwargs: Any) -> JSONType: + def list_containers( + self, + **kwargs: Any + ) -> JSONType: """Lists containers in a storage account. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -1583,19 +2085,24 @@ def list_containers(self, **kwargs: Any) -> JSONType: "ServiceEndpoint": "str" # Required. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str + comp = kwargs.pop('comp', "list") # type: str + request = build_xml_list_containers_request( comp=comp, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1613,8 +2120,13 @@ def list_containers(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_service_properties(self, **kwargs: Any) -> JSONType: + def get_service_properties( + self, + **kwargs: Any + ) -> JSONType: """Gets storage service properties. :keyword comp: The default value is "properties". Note that overriding this default value may @@ -1711,13 +2223,16 @@ def get_service_properties(self, **kwargs: Any) -> JSONType: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + request = build_xml_get_service_properties_request( comp=comp, restype=restype, @@ -1725,7 +2240,9 @@ def get_service_properties(self, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1743,8 +2260,14 @@ def get_service_properties(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_service_properties(self, properties: JSONType, **kwargs: Any) -> None: + def put_service_properties( + self, + properties: JSONType, + **kwargs: Any + ) -> None: """Puts storage service properties. :param properties: @@ -1843,13 +2366,15 @@ def put_service_properties(self, properties: JSONType, **kwargs: Any) -> None: } } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "properties") # type: str - restype = kwargs.pop("restype", "service") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "properties") # type: str + restype = kwargs.pop('restype', "service") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = properties @@ -1862,7 +2387,9 @@ def put_service_properties(self, properties: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1873,8 +2400,13 @@ def put_service_properties(self, properties: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_acls(self, **kwargs: Any) -> List[JSONType]: + def get_acls( + self, + **kwargs: Any + ) -> List[JSONType]: """Gets storage ACLs for a container. :keyword comp: The default value is "acl". Note that overriding this default value may result @@ -1905,13 +2437,16 @@ def get_acls(self, **kwargs: Any) -> List[JSONType]: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[List[JSONType]] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[List[JSONType]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_xml_get_acls_request( comp=comp, restype=restype, @@ -1919,7 +2454,9 @@ def get_acls(self, **kwargs: Any) -> List[JSONType]: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -1937,8 +2474,14 @@ def get_acls(self, **kwargs: Any) -> List[JSONType]: return deserialized + + @distributed_trace - def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: + def put_acls( + self, + properties: List[JSONType], + **kwargs: Any + ) -> None: """Puts storage ACLs for a container. :param properties: @@ -1971,13 +2514,15 @@ def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: } ] """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "acl") # type: str - restype = kwargs.pop("restype", "container") # type: str - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + comp = kwargs.pop('comp', "acl") # type: str + restype = kwargs.pop('restype', "container") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = properties @@ -1990,7 +2535,9 @@ def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2001,8 +2548,13 @@ def put_acls(self, properties: List[JSONType], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def list_blobs(self, **kwargs: Any) -> JSONType: + def list_blobs( + self, + **kwargs: Any + ) -> JSONType: """Lists blobs in a storage container. :keyword comp: The default value is "list". Note that overriding this default value may result @@ -2107,13 +2659,16 @@ def list_blobs(self, **kwargs: Any) -> JSONType: "ServiceEndpoint": "str" # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - comp = kwargs.pop("comp", "list") # type: str - restype = kwargs.pop("restype", "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + restype = kwargs.pop('restype', "container") # type: str + request = build_xml_list_blobs_request( comp=comp, restype=restype, @@ -2121,7 +2676,9 @@ def list_blobs(self, **kwargs: Any) -> JSONType: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2139,8 +2696,14 @@ def list_blobs(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def json_input(self, properties: JSONType, **kwargs: Any) -> None: + def json_input( + self, + properties: JSONType, + **kwargs: Any + ) -> None: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -2158,11 +2721,13 @@ def json_input(self, properties: JSONType, **kwargs: Any) -> None: "id": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = properties @@ -2173,7 +2738,9 @@ def json_input(self, properties: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2184,8 +2751,13 @@ def json_input(self, properties: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def json_output(self, **kwargs: Any) -> JSONType: + def json_output( + self, + **kwargs: Any + ) -> JSONType: """A Swagger with XML that has one operation that returns JSON. ID number 42. :return: JSON object @@ -2200,15 +2772,21 @@ def json_output(self, **kwargs: Any) -> JSONType: "id": 0 # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_json_output_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_json_output_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2226,8 +2804,13 @@ def json_output(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_xms_text(self, **kwargs: Any) -> JSONType: + def get_xms_text( + self, + **kwargs: Any + ) -> JSONType: """Get back an XML object with an x-ms-text property, which should translate to the returned object's 'language' property being 'english' and its 'content' property being 'I am text'. @@ -2244,15 +2827,21 @@ def get_xms_text(self, **kwargs: Any) -> JSONType: "language": "str" # Optional. Returned value should be 'english'. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_xms_text_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_xms_text_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2270,8 +2859,13 @@ def get_xms_text(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def get_bytes(self, **kwargs: Any) -> JSONType: + def get_bytes( + self, + **kwargs: Any + ) -> JSONType: """Get an XML document with binary property. :return: JSON object @@ -2286,15 +2880,21 @@ def get_bytes(self, **kwargs: Any) -> JSONType: "Bytes": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_bytes_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_bytes_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2312,8 +2912,14 @@ def get_bytes(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: + def put_binary( + self, + slideshow: JSONType, + **kwargs: Any + ) -> None: """Put an XML document with binary property. :param slideshow: @@ -2330,11 +2936,13 @@ def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: "Bytes": bytearray("bytearray", encoding="utf-8") # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = slideshow @@ -2345,7 +2953,9 @@ def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2356,8 +2966,13 @@ def put_binary(self, slideshow: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + @distributed_trace - def get_uri(self, **kwargs: Any) -> JSONType: + def get_uri( + self, + **kwargs: Any + ) -> JSONType: """Get an XML document with uri property. :return: JSON object @@ -2372,15 +2987,21 @@ def get_uri(self, **kwargs: Any) -> JSONType: "Url": str # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) - - request = build_xml_get_uri_request() + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_xml_get_uri_request( + ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2398,8 +3019,14 @@ def get_uri(self, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def put_uri(self, model: JSONType, **kwargs: Any) -> None: + def put_uri( + self, + model: JSONType, + **kwargs: Any + ) -> None: """Put an XML document with uri property. :param model: @@ -2416,11 +3043,13 @@ def put_uri(self, model: JSONType, **kwargs: Any) -> None: "Url": str # Optional. } """ - cls = kwargs.pop("cls", None) # type: ClsType[None] - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {})) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") # type: Optional[str] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] _content = model @@ -2431,7 +3060,9 @@ def put_uri(self, model: JSONType, **kwargs: Any) -> None: request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -2441,3 +3072,5 @@ def put_uri(self, model: JSONType, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py index ffc32bf4893..7ea66ee2c54 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py @@ -33,5 +33,5 @@ include_package_data=True, long_description="""\ XMS Error Response Extensions. - """, + """ ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/__init__.py index d1cf7e2a92f..d3432d67be3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/__init__.py @@ -10,10 +10,9 @@ from ._version import VERSION __version__ = VERSION -__all__ = ["XMSErrorResponseExtensions"] +__all__ = ['XMSErrorResponseExtensions'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_configuration.py index d8bbf515bf2..578e782f2d5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_configuration.py @@ -21,22 +21,26 @@ class XMSErrorResponseExtensionsConfiguration(Configuration): # pylint: disable attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(XMSErrorResponseExtensionsConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "xmserrorresponseextensions/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'xmserrorresponseextensions/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_vendor.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_vendor.py index 54f238858ed..e12b61dea67 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_vendor.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_vendor.py @@ -6,6 +6,8 @@ # -------------------------------------------------------------------------- + + def _format_url_section(template, **kwargs): components = template.split("/") while components: @@ -13,5 +15,7 @@ def _format_url_section(template, **kwargs): return template.format(**kwargs) except KeyError as key: formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] template = "/".join(components) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py index 0d43fb8747d..9a3a7c81a97 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_xms_error_response_extensions.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class XMSErrorResponseExtensions: """XMS Error Response Extensions. @@ -30,8 +29,13 @@ class XMSErrorResponseExtensions: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: + self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -40,6 +44,7 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) + def send_request( self, request, # type: HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/__init__.py index dc78ca60218..a6afdd01060 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/__init__.py @@ -7,11 +7,9 @@ # -------------------------------------------------------------------------- from ._xms_error_response_extensions import XMSErrorResponseExtensions - -__all__ = ["XMSErrorResponseExtensions"] +__all__ = ['XMSErrorResponseExtensions'] # `._patch.py` is used for handwritten extensions to the generated code # Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md from ._patch import patch_sdk - patch_sdk() diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_configuration.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_configuration.py index 95f1b3c4181..658c16f25da 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_configuration.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_configuration.py @@ -21,19 +21,25 @@ class XMSErrorResponseExtensionsConfiguration(Configuration): # pylint: disable attributes. """ - def __init__(self, **kwargs: Any) -> None: + def __init__( + self, + **kwargs: Any + ) -> None: super(XMSErrorResponseExtensionsConfiguration, self).__init__(**kwargs) - kwargs.setdefault("sdk_moniker", "xmserrorresponseextensions/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'xmserrorresponseextensions/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py index 229dfabb990..2c290d9bf48 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_xms_error_response_extensions.py @@ -20,7 +20,6 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Dict - class XMSErrorResponseExtensions: """XMS Error Response Extensions. @@ -30,7 +29,12 @@ class XMSErrorResponseExtensions: :paramtype endpoint: str """ - def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: + def __init__( + self, + *, + endpoint: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = AsyncPipelineClient(base_url=endpoint, config=self._config, **kwargs) @@ -39,7 +43,12 @@ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> self._serialize.client_side_validation = False self.pet = PetOperations(self._client, self._config, self._serialize, self._deserialize) - def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + + def send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/__init__.py index ffb3964def4..6376c7a3a74 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py index f492fe75173..8fabf9c8e09 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py @@ -8,29 +8,17 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ...operations._operations import ( - build_pet_do_something_request, - build_pet_get_pet_by_id_request, - build_pet_has_models_param_request, -) - -T = TypeVar("T") +from ...operations._operations import build_pet_do_something_request, build_pet_get_pet_by_id_request, build_pet_has_models_param_request +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - class PetOperations: """PetOperations async operations. @@ -50,7 +38,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: + async def get_pet_by_id( + self, + pet_id: str, + **kwargs: Any + ) -> Optional[JSONType]: """Gets pets by id. :param pet_id: pet id. @@ -68,7 +60,7 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: "name": "str" # Optional. Gets the Pet by id. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] error_map = { 401: ClientAuthenticationError, 409: ResourceExistsError, @@ -76,15 +68,18 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: 404: lambda response: ResourceNotFoundError(response=response), 501: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_pet_get_pet_by_id_request( pet_id=pet_id, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -104,8 +99,14 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: return deserialized + + @distributed_trace_async - async def do_something(self, what_action: str, **kwargs: Any) -> JSONType: + async def do_something( + self, + what_action: str, + **kwargs: Any + ) -> JSONType: """Asks pet to do something. :param what_action: what action the pet should do. @@ -122,22 +123,25 @@ async def do_something(self, what_action: str, **kwargs: Any) -> JSONType: "actionResponse": "str" # Optional. action feedback. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 500: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_pet_do_something_request( what_action=what_action, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -155,8 +159,15 @@ async def do_something(self, what_action: str, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace_async - async def has_models_param(self, *, models: Optional[str] = "value1", **kwargs: Any) -> None: + async def has_models_param( + self, + *, + models: Optional[str] = "value1", + **kwargs: Any + ) -> None: """Ensure you can correctly deserialize the returned PetActionError and deserialization doesn't conflict with the input param name 'models'. @@ -167,22 +178,25 @@ async def has_models_param(self, *, models: Optional[str] = "value1", **kwargs: :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 500: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_pet_has_models_param_request( models=models, ) request.url = self._client.format_url(request.url) pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -192,3 +206,5 @@ async def has_models_param(self, *, models: Optional[str] = "value1", **kwargs: if cls: return cls(pipeline_response, None, {}) + + diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/__init__.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/__init__.py index ffb3964def4..6376c7a3a74 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/__init__.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/__init__.py @@ -9,5 +9,5 @@ from ._operations import PetOperations __all__ = [ - "PetOperations", + 'PetOperations', ] diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py index ae8e17c9594..c2c1e683d11 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py @@ -8,13 +8,7 @@ # -------------------------------------------------------------------------- from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -22,65 +16,88 @@ from msrest import Serializer from .._vendor import _format_url_section - -T = TypeVar("T") +T = TypeVar('T') JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False - -def build_pet_get_pet_by_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: +def build_pet_get_pet_by_id_request( + pet_id: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/errorStatusCodes/Pets/{petId}/GetPet" + url = '/errorStatusCodes/Pets/{petId}/GetPet' path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, "str"), + "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="GET", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) -def build_pet_do_something_request(what_action: str, **kwargs: Any) -> HttpRequest: +def build_pet_do_something_request( + what_action: str, + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/errorStatusCodes/Pets/doSomething/{whatAction}" + url = '/errorStatusCodes/Pets/doSomething/{whatAction}' path_format_arguments = { - "whatAction": _SERIALIZER.url("what_action", what_action, "str"), + "whatAction": _SERIALIZER.url("what_action", what_action, 'str'), } url = _format_url_section(url, **path_format_arguments) # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - return HttpRequest(method="POST", url=url, headers=header_parameters, **kwargs) + return HttpRequest( + method="POST", + url=url, + headers=header_parameters, + **kwargs + ) -def build_pet_has_models_param_request(*, models: Optional[str] = "value1", **kwargs: Any) -> HttpRequest: +def build_pet_has_models_param_request( + *, + models: Optional[str] = "value1", + **kwargs: Any +) -> HttpRequest: accept = "application/json" # Construct URL - url = "/errorStatusCodes/Pets/hasModelsParam" + url = '/errorStatusCodes/Pets/hasModelsParam' # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if models is not None: - query_parameters["models"] = _SERIALIZER.query("models", models, "str") + query_parameters['models'] = _SERIALIZER.query("models", models, 'str') # Construct headers header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=url, params=query_parameters, headers=header_parameters, **kwargs) + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PetOperations(object): """PetOperations operations. @@ -101,7 +118,11 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: + def get_pet_by_id( + self, + pet_id: str, + **kwargs: Any + ) -> Optional[JSONType]: """Gets pets by id. :param pet_id: pet id. @@ -119,7 +140,7 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: "name": "str" # Optional. Gets the Pet by id. } """ - cls = kwargs.pop("cls", None) # type: ClsType[Optional[JSONType]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[JSONType]] error_map = { 401: ClientAuthenticationError, 409: ResourceExistsError, @@ -127,15 +148,18 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: 404: lambda response: ResourceNotFoundError(response=response), 501: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_pet_get_pet_by_id_request( pet_id=pet_id, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -155,8 +179,14 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSONType]: return deserialized + + @distributed_trace - def do_something(self, what_action: str, **kwargs: Any) -> JSONType: + def do_something( + self, + what_action: str, + **kwargs: Any + ) -> JSONType: """Asks pet to do something. :param what_action: what action the pet should do. @@ -173,22 +203,25 @@ def do_something(self, what_action: str, **kwargs: Any) -> JSONType: "actionResponse": "str" # Optional. action feedback. } """ - cls = kwargs.pop("cls", None) # type: ClsType[JSONType] + cls = kwargs.pop('cls', None) # type: ClsType[JSONType] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 500: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + request = build_pet_do_something_request( what_action=what_action, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -206,8 +239,15 @@ def do_something(self, what_action: str, **kwargs: Any) -> JSONType: return deserialized + + @distributed_trace - def has_models_param(self, *, models: Optional[str] = "value1", **kwargs: Any) -> None: + def has_models_param( + self, + *, + models: Optional[str] = "value1", + **kwargs: Any + ) -> None: """Ensure you can correctly deserialize the returned PetActionError and deserialization doesn't conflict with the input param name 'models'. @@ -218,22 +258,26 @@ def has_models_param(self, *, models: Optional[str] = "value1", **kwargs: Any) - :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 500: HttpResponseError, } - error_map.update(kwargs.pop("error_map", {})) + error_map.update(kwargs.pop('error_map', {})) + + request = build_pet_has_models_param_request( models=models, ) request.url = self._client.format_url(request.url) pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, + stream=False, + **kwargs ) response = pipeline_response.http_response @@ -243,3 +287,5 @@ def has_models_param(self, *, models: Optional[str] = "value1", **kwargs: Any) - if cls: return cls(pipeline_response, None, {}) + +